ODE Steps for Second Order IVPs
Overview
Examples
This help page gives a few examples of using the command ODESteps to solve second order initial value problems.
See Student[ODEs][ODESteps] for a general description of the command ODESteps and its calling sequence.
with⁡Student:-ODEs:
ivp1 ≔ ⅆ2ⅆx2⁢y⁡x−ⅆⅆx⁢y⁡x−x⁢ⅇx=0,ⅆⅆx⁢y⁡xx=0|ⅆⅆx⁢y⁡xx=0=0,y⁡0=1
ivp1≔ⅆ2ⅆx2y⁡x−ⅆⅆxy⁡x−x⁢ⅇx=0,ⅆⅆxy⁡xx=0|ⅆⅆxy⁡xx=0=0,y⁡0=1
ODESteps⁡ivp1
Let's solveⅆ2ⅆx2y⁡x−ⅆⅆxy⁡x−x⁢ⅇx=0,ⅆⅆxy⁡xx=0|ⅆⅆxy⁡xx=0=0,y⁡0=1•Highest derivative means the order of the ODE is2ⅆ2ⅆx2y⁡x•Isolate 2nd derivativeⅆ2ⅆx2y⁡x=ⅆⅆxy⁡x+x⁢ⅇx•Group terms withy⁡xon the lhs of the ODE and the rest on the rhs of the ODE; ODE is linearⅆ2ⅆx2y⁡x−ⅆⅆxy⁡x=x⁢ⅇx•Characteristic polynomial of homogeneous ODEr2−r=0•Factor the characteristic polynomialr⁢r−1=0•Roots of the characteristic polynomialr=0,1•1st solution of the homogeneous ODEy1⁡x=1•2nd solution of the homogeneous ODEy2⁡x=ⅇx•General solution of the ODEy⁡x=C1⁢y1⁡x+C2⁢y2⁡x+yp⁡x•Substitute in solutions of the homogeneous ODEy⁡x=C1+C2⁢ⅇx+yp⁡x▫Find a particular solutionyp⁡xof the ODE◦Use variation of parameters to findypheref⁡xis the forcing functionyp⁡x=−y1⁡x⁢∫y2⁡x⁢f⁡xW⁡y1⁡x,y2⁡xⅆx+y2⁡x⁢∫y1⁡x⁢f⁡xW⁡y1⁡x,y2⁡xⅆx,f⁡x=x⁢ⅇx◦Wronskian of solutions of the homogeneous equationW⁡y1⁡x,y2⁡x=1ⅇx0ⅇx◦Compute WronskianW⁡y1⁡x,y2⁡x=ⅇx◦Substitute functions into equation foryp⁡xyp⁡x=−∫x⁢ⅇxⅆx+ⅇx⁢∫xⅆx◦Compute integralsyp⁡x=ⅇx⁢1−x+12⁢x2•Substitute particular solution into general solution to ODEy⁡x=C1+C2⁢ⅇx+ⅇx⁢1−x+12⁢x2▫Check validity of solutiony⁡x=_C1+_C2⁢ⅇx+ⅇx⁢1−x+12⁢x2◦Use initial conditiony⁡0=11=_C1+_C2+1◦Compute derivative of the solutionⅆⅆxy⁡x=_C2⁢ⅇx+ⅇx⁢1−x+12⁢x2+x−1⁢ⅇx◦Use the initial conditionⅆⅆxy⁡xx=0|ⅆⅆxy⁡xx=0=00=_C2◦Solve for_C1and_C2_C1=0,_C2=0◦Substitute constant values into general solution and simplifyy⁡x=ⅇx⁢x2−2⁢x+22•Solution to the IVPy⁡x=ⅇx⁢x2−2⁢x+22
ivp2 ≔ ⅆ2ⅆx2⁢y⁡x+5⁢ⅆⅆx⁢y⁡x2y⁡x=0,ⅆⅆx⁢y⁡xx=1|ⅆⅆx⁢y⁡xx=1=−3,y⁡1=1
ivp2≔ⅆ2ⅆx2y⁡x+5⁢ⅆⅆxy⁡x2y⁡x=0,ⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=−3,y⁡1=1
ODESteps⁡ivp2
Let's solveⅆ2ⅆx2y⁡x+5⁢ⅆⅆxy⁡x2y⁡x=0,ⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=−3,y⁡1=1•Highest derivative means the order of the ODE is2ⅆ2ⅆx2y⁡x•Define new dependent variableuu⁡x=•Computeⅆ2ⅆx2y⁡x=•Use chain rule on the lhs⁢=•Substitute in the definition ofuu⁡y⁢=•Make substitutionsⅆⅆxy⁡x=u⁡y,ⅆ2ⅆx2y⁡x=u⁡y⁢ⅆⅆyu⁡yto reduce order of ODEu⁡y⁢ⅆⅆyu⁡y+5⁢u⁡y2y=0•Separate variablesⅆⅆyu⁡yu⁡y=−5y•Integrate both sides with respect toy∫ⅆⅆyu⁡yu⁡yⅆy=∫−5yⅆy+C1•Evaluate integralln⁡u⁡y=−5⁢ln⁡y+C1•Solve foru⁡yu⁡y=ⅇC1y5•Solve 1st ODE foru⁡yu⁡y=ⅇC1y5•Revert to original variables with substitutionu⁡y=ⅆⅆxy⁡x,y=y⁡xⅆⅆxy⁡x=ⅇC1y⁡x5•Separate variablesⅆⅆxy⁡x⁢y⁡x5=ⅇC1•Integrate both sides with respect tox∫ⅆⅆxy⁡x⁢y⁡x5ⅆx=∫ⅇC1ⅆx+C2•Evaluate integraly⁡x66=ⅇC1⁢x+C2•Solve fory⁡xy⁡x=6⁢ⅇC1⁢x+6⁢C216,y⁡x=−6⁢ⅇC1⁢x+6⁢C216▫Check validity of solutiony⁡x=6⁢ⅇc__1⁢x+6⁢_C216◦Use initial conditiony⁡1=11=6⁢ⅇc__1+6⁢_C216◦Compute derivative of the solutionⅆⅆxy⁡x=ⅇc__16⁢ⅇc__1⁢x+6⁢_C256◦Use the initial conditionⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=−3−3=ⅇc__16⁢ⅇc__1+6⁢_C256◦Solve forc__1and_C2c__1=ln⁡3+I⁢π,_C2=196◦Substitute constant values into general solution and simplifyy⁡x=−18⁢x+1916▫Check validity of solutiony⁡x=−6⁢ⅇc__1⁢x+6⁢_C216◦Use initial conditiony⁡1=11=−6⁢ⅇc__1+6⁢_C216◦Compute derivative of the solutionⅆⅆxy⁡x=−ⅇc__16⁢ⅇc__1⁢x+6⁢_C256◦Use the initial conditionⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=−3−3=−ⅇc__16⁢ⅇc__1+6⁢_C256◦Solve forc__1and_C2◦The solution does not satisfy the initial conditions•Solution to the IVPy⁡x=−18⁢x+1916
ivp3 ≔ ⅆ2ⅆx2⁢y⁡x−ⅆⅆx⁢y⁡x−6⁢y⁡x=0,ⅆⅆx⁢y⁡xx=1|ⅆⅆx⁢y⁡xx=1=a,y⁡1=0
ivp3≔ⅆ2ⅆx2y⁡x−ⅆⅆxy⁡x−6⁢y⁡x=0,ⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=a,y⁡1=0
ODESteps⁡ivp3
Let's solveⅆ2ⅆx2y⁡x−ⅆⅆxy⁡x−6⁢y⁡x=0,ⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=a,y⁡1=0•Highest derivative means the order of the ODE is2ⅆ2ⅆx2y⁡x•Characteristic polynomial of ODEr2−r−6=0•Factor the characteristic polynomialr+2⁢r−3=0•Roots of the characteristic polynomialr=−2,3•1st solution of the ODEy1⁡x=ⅇ−2⁢x•2nd solution of the ODEy2⁡x=ⅇ3⁢x•General solution of the ODEy⁡x=C1⁢y1⁡x+C2⁢y2⁡x•Substitute in solutionsy⁡x=C1⁢ⅇ−2⁢x+C2⁢ⅇ3⁢x▫Check validity of solutiony⁡x=c__1⁢ⅇ−2⁢x+_C2⁢ⅇ3⁢x◦Use initial conditiony⁡1=00=c__1⁢ⅇ−2+_C2⁢ⅇ3◦Compute derivative of the solutionⅆⅆxy⁡x=−2⁢c__1⁢ⅇ−2⁢x+3⁢_C2⁢ⅇ3⁢x◦Use the initial conditionⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=aa=−2⁢c__1⁢ⅇ−2+3⁢_C2⁢ⅇ3◦Solve forc__1and_C2c__1=−a5⁢ⅇ−2,_C2=a5⁢ⅇ3◦Substitute constant values into general solution and simplifyy⁡x=−a⁢ⅇ2−2⁢x−ⅇ−3+3⁢x5•Solution to the IVPy⁡x=−a⁢ⅇ2−2⁢x−ⅇ−3+3⁢x5
ivp4 ≔ x2⁢ⅆ2ⅆx2⁢y⁡x−4⁢x⁢ⅆⅆx⁢y⁡x+2⁢y⁡x=0,ⅆⅆx⁢y⁡xx=1|ⅆⅆx⁢y⁡xx=1=10,y⁡1=−1
ivp4≔x2⁢ⅆ2ⅆx2y⁡x−4⁢x⁢ⅆⅆxy⁡x+2⁢y⁡x=0,ⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=10,y⁡1=−1
ODESteps⁡ivp4
Let's solvex2⁢ⅆ2ⅆx2y⁡x−4⁢x⁢ⅆⅆxy⁡x+2⁢y⁡x=0,ⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=10,y⁡1=−1•Highest derivative means the order of the ODE is2ⅆ2ⅆx2y⁡x•Isolate 2nd derivativeⅆ2ⅆx2y⁡x=−2⁢y⁡xx2+4⁢ⅆⅆxy⁡xx•Group terms withy⁡xon the lhs of the ODE and the rest on the rhs of the ODE; ODE is linearⅆ2ⅆx2y⁡x−4⁢ⅆⅆxy⁡xx+2⁢y⁡xx2=0•Multiply by denominators of the ODEx2⁢ⅆ2ⅆx2y⁡x−4⁢x⁢ⅆⅆxy⁡x+2⁢