dsolve/piecewise
find solution of ordinary differential equations with piecewise coefficients
Description
Examples
The dsolve function solves differential equations with piecewise coefficients. It solves general first order linear, linear constant coefficient with piecewise perturbation, and Riccati equations. It can handle some cases where the differential equation is solved by integration or variation of parameters.
The solutions are found in terms of distribution theory and translated into a piecewise expression.
You can verify a solution by substituting the solution into the equation. However, if the differential equation has jump discontinuities, the verification must be done in terms of Heaviside functions because the derivative at a discontinuous point is undefined in the piecewise function.
The theory is based on the dissertation Martin von Mohrenschildt. "Symbolic Solutions of Discontinuous Differential Equations." Swiss Federal Institute of Technology ETHZ No. 10768
First Order:
FO≔diff⁡y⁡x,x+piecewise⁡x<0,x⁢x,0<x,3⁢x⁢y⁡x=0
FO≔ⅆⅆxy⁡x+x2x<03⁢x0<x⁢y⁡x=0
dsolve⁡FO
y⁡x=ⅇ−x33⁢c__1x<0ⅇ−3⁢x22⁢c__10≤x
Linear with discontinuous perturbation:
ode≔diff⁡y⁡x,`$`⁡x,2+y⁡x=piecewise⁡x<0,−1,x<1,1,x<2,sin⁡x
ode≔ⅆ2ⅆx2y⁡x+y⁡x=−1x<01x<1sin⁡xx<2
sol≔dsolve⁡ode
sol≔y⁡x=sin⁡x⁢c__2+cos⁡x⁢c__1−1x<0sin⁡x⁢c__2+cos⁡x⁢c__1+1−2⁢cos⁡xx<1sin⁡x⁢c__2+cos⁡x⁢c__1−cos⁡x⁢x2+sin⁡x4+cos⁡x−1+sin⁡x−24−3⁢cos⁡x2x<2sin⁡x⁢c__2+cos⁡x⁢c__1+cos⁡x−1+sin⁡x−24−5⁢cos⁡x2−sin⁡x−442≤x
Solutions can also be tested by using odetest.
odetest⁡sol,ode
undefinedx=0∨x=1∨x=20otherwise
Non linear:
ode≔diff⁡y⁡x,x=convert⁡−signum⁡x⁢abs⁡1−abs⁡x,piecewise⁢y⁡x2
ode≔ⅆⅆxy⁡x=−1−xx≤−1x+1x<00x=0x−1x<11−x1≤x⁢y⁡x2
sol≔y⁡x=−2−x2−2⁢c__1−2⁢xx<−1−2x2−2⁢c__1+2⁢x+2x<0−2x2−2⁢c__1−2⁢x+2x<1−2−x2−2⁢c__1+2⁢x1≤x
undefinedx=00otherwise
See Also
convert[Heaviside]
convert[piecewise]
dsolve
dsolve[taylorseries]
odetest
piecewise
Download Help Document