ODE Steps for Systems of ODEs with IVP
Overview
Examples
This help page gives a few examples of using the command ODESteps to solve systems of ordinary differential equations with initial values.
See Student[ODEs][ODESteps] for a general description of the command ODESteps and its calling sequence.
with⁡Student:-ODEs:
high_order_ivp1≔diff⁡y⁡x,x,x,x+3⁢diff⁡y⁡x,x,x+4⁢diff⁡y⁡x,x+2⁢y⁡x=0,eval⁡diff⁡y⁡x,x,x=0=−1,eval⁡diff⁡y⁡x,x,x,x=0=2,y⁡0=1
high_order_ivp1≔ⅆ3ⅆx3y⁡x+3⁢ⅆ2ⅆx2y⁡x+4⁢ⅆⅆxy⁡x+2⁢y⁡x=0,ⅆ2ⅆx2y⁡xx=0|ⅆ2ⅆx2y⁡xx=0=2,ⅆⅆxy⁡xx=0|ⅆⅆxy⁡xx=0=−1,y⁡0=1
ODESteps⁡high_order_ivp1
Let's solveⅆ3ⅆx3y⁡x+3⁢ⅆ2ⅆx2y⁡x+4⁢ⅆⅆxy⁡x+2⁢y⁡x=0,ⅆ2ⅆx2y⁡xx=0|ⅆ2ⅆx2y⁡xx=0=2,ⅆⅆxy⁡xx=0|ⅆⅆxy⁡xx=0=−1,y⁡0=1•Highest derivative means the order of the ODE is3ⅆ3ⅆx3y⁡x•Characteristic polynomial of ODEr3+3⁢r2+4⁢r+2=0•Roots of the characteristic polynomialr=−1,−1−I,−1+I•Solution fromr=−1y1⁡x=ⅇ−x•Solutions fromr=−1−Iandr=−1+Iy2⁡x=ⅇ−x⁢sin⁡x,y3⁡x=ⅇ−x⁢cos⁡x•General solution of the ODEy⁡x=c__1⁢y1⁡x+c__2⁢y2⁡x+c__3⁢y3⁡x•Substitute in solutions and simplifyy⁡x=ⅇ−x⁢c__1+c__2⁢sin⁡x+c__3⁢cos⁡x•Use the initial conditiony⁡0=11=c__1+c__3•Calculate the 1st derivative of the solutionⅆⅆxy⁡x=−ⅇ−x⁢c__1+c__2⁢sin⁡x+c__3⁢cos⁡x+ⅇ−x⁢c__2⁢cos⁡x−c__3⁢sin⁡x•Use the initial conditionⅆⅆxy⁡xx=0|ⅆⅆxy⁡xx=0=−1−1=−c__1−c__3+c__2•Calculate the 2nd derivative of the solutionⅆ2ⅆx2y⁡x=ⅇ−x⁢c__1+c__2⁢sin⁡x+c__3⁢cos⁡x−2⁢ⅇ−x⁢c__2⁢cos⁡x−c__3⁢sin⁡x+ⅇ−x⁢−c__2⁢sin⁡x−c__3⁢cos⁡x•Use the initial conditionⅆ2ⅆx2y⁡xx=0|ⅆ2ⅆx2y⁡xx=0=22=c__1−2⁢c__2•Solve for the unknown coefficientsc__1=2,c__2=0,c__3=−1•Solution to the IVPy⁡x=ⅇ−x⁢2−cos⁡x
macro⁡Y=y1⁡x,y2⁡x:
ivpsys2≔diff⁡Y,x=`%.`⁡Matrix⁡7,1,`-`⁡4,3,Y,eval⁡Y,x=0=1,1
ivpsys2≔ⅆⅆxy1⁡xⅆⅆxy2⁡x=71−43·y1⁡xy2⁡x,y1⁡0y2⁡0=11
ODESteps⁡ivpsys2
ivpsys3≔diff⁡Y,x=Matrix⁡1,2,3,2·Y+1,exp⁡x,eval⁡Y,x=1=0,−1
ivpsys3≔ⅆⅆxy1⁡xⅆⅆxy2⁡x=y1⁡x+2⁢y2⁡x+13⁢y1⁡x+2⁢y2⁡x+ⅇx,y1⁡1y2⁡1=0−1
ODESteps⁡ivpsys3
ivpsys4≔diff⁡w⁡x,x=w⁡x+2⁢z⁡x,diff⁡z⁡x,x=3⁢w⁡x+2⁢z⁡x+exp⁡x,w⁡−1=2,z⁡−1=−2
ivpsys4≔ⅆⅆxw⁡x=w⁡x+2⁢z⁡x,ⅆⅆxz⁡x=3⁢w⁡x+2⁢z⁡x+ⅇx,w⁡−1=2,z⁡−1=−2
ODESteps⁡ivpsys4
See Also
diff
Int
Student
Student[ODEs]
Student[ODEs][ODESteps]
Download Help Document