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≔diff⁡y⁡x,x,x−diff⁡y⁡x,x−x⁢exp⁡x=0,eval⁡diff⁡y⁡x,x,x=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≔diff⁡y⁡x,x,x+5⁢diff⁡y⁡x,x2y⁡x=0,eval⁡diff⁡y⁡x,x,x=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=ⅆⅆxy⁡x•Computeⅆ2ⅆx2y⁡xⅆⅆxu⁡x=ⅆ2ⅆx2y⁡x•Use chain rule on the lhsⅆⅆxy⁡x⁢ⅆⅆyu⁡y=ⅆ2ⅆx2y⁡x•Substitute in the definition ofuu⁡y⁢ⅆⅆyu⁡y=ⅆ2ⅆx2y⁡x•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≔diff⁡y⁡x,x,x−diff⁡y⁡x,x−6⁢y⁡x=0,eval⁡diff⁡y⁡x,x,x=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⁢diff⁡y⁡x,x,x−4⁢x⁢diff⁡y⁡x,x+2⁢y⁡x=0,eval⁡diff⁡y⁡x,x,x=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⁢y⁡x=0•Make a change of variablest=ln⁡x▫Substitute the change of variables back into the ODE◦Calculate the1stderivative ofywith respect tox, using the chain ruleⅆⅆxy⁡x=ⅆⅆty⁡t⁢ⅆⅆxt⁡x◦Compute derivativeⅆⅆxy⁡x=ⅆⅆty⁡tx◦Calculate the2ndderivative ofywith respect tox, using the chain ruleⅆ2ⅆx2y⁡x=ⅆ2ⅆt2y⁡t⁢ⅆⅆxt⁡x2+ⅆ2ⅆx2t⁡x⁢ⅆⅆty⁡t◦Compute derivativeⅆ2ⅆx2y⁡x=ⅆ2ⅆt2y⁡tx2−ⅆⅆty⁡tx2Substitute the change of variables back into the ODEx2⁢ⅆ2ⅆt2y⁡tx2−ⅆⅆty⁡tx2−4⁢ⅆⅆty⁡t+2⁢y⁡t=0•Simplifyⅆ2ⅆt2y⁡t−5⁢ⅆⅆty⁡t+2⁢y⁡t=0•Characteristic polynomial of ODEr2−5⁢r+2=0•Use quadratic formula to solve forrr=5±172•Roots of the characteristic polynomialr=52−172,52+172•1st solution of the ODEy1⁡t=ⅇ52−172⁢t•2nd solution of the ODEy2⁡t=ⅇ52+172⁢t•General solution of the ODEy⁡t=C1⁢y1⁡t+C2⁢y2⁡t•Substitute in solutionsy⁡t=C1⁢ⅇ52−172⁢t+C2⁢ⅇ52+172⁢t•Change variables back usingt=ln⁡xy⁡x=C1⁢ⅇ52−172⁢ln⁡x+C2⁢ⅇ52+172⁢ln⁡x•Simplifyy⁡x=x52⁢x−172⁢C1+x172⁢C2▫Check validity of solutiony⁡x=x52⁢x−172⁢c__1+x172⁢_C2◦Use initial conditiony⁡1=−1−1=c__1+_C2◦Compute derivative of the solutionⅆⅆxy⁡x=5⁢x32⁢x−172⁢c__1+x172⁢_C22+x52⁢−x−172⁢17⁢c__12⁢x+x172⁢17⁢_C22⁢x◦Use the initial conditionⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=1010=5⁢c__12+5⁢_C22−17⁢c__12+17⁢_C22◦Solve forc__1and_C2c__1=−12−25⁢1734,_C2=−12+25⁢1734◦Substitute constant values into general solution and simplifyy⁡x=−x52⁢25⁢x−172⁢17−25⁢x172⁢17+17⁢x−172+17⁢x17234•Solution to the IVPy⁡x=−x52⁢25⁢x−172⁢17−25⁢x172⁢17+17⁢x−172+17⁢x17234
ivp5≔−x2+1⁢diff⁡y⁡x,x,x−x⁢diff⁡y⁡x,x+y⁡x=0,eval⁡diff⁡y⁡x,x,x=2=−1,y⁡2=1
ivp5≔−x2+1⁢ⅆ2ⅆx2y⁡x−x⁢ⅆⅆxy⁡x+y⁡x=0,ⅆⅆxy⁡xx=2|ⅆⅆxy⁡xx=2=−1,y⁡2=1
ODESteps⁡ivp5
Let's solve−x2+1⁢ⅆ2ⅆx2y⁡x−x⁢ⅆⅆxy⁡x+y⁡x=0,ⅆⅆxy⁡xx=2|ⅆⅆxy⁡xx=2=−1,y⁡2=1•Highest derivative means the order of the ODE is2ⅆ2ⅆx2y⁡x•Isolate 2nd derivativeⅆ2ⅆx2y⁡x=y⁡xx2−1−x⁢ⅆⅆxy⁡xx2−1•Group terms withy⁡xon the lhs of the ODE and the rest on the rhs of the ODE; ODE is linearⅆ2ⅆx2y⁡x+x⁢ⅆⅆxy⁡xx2−1−y⁡xx2−1=0•Multiply by denominators of ODE−x2+1⁢ⅆ2ⅆx2y⁡x−x⁢ⅆⅆxy⁡x+y⁡x=0•Make a change of variablesθ=arccos⁡x•Calculateⅆⅆxy⁡xwith change of variablesⅆⅆxy⁡x=ⅆⅆθy⁡θ⁢ⅆⅆxθ⁡x•Compute1stderivativeⅆⅆxy⁡xⅆⅆxy⁡x=−ⅆⅆθy⁡θ−x2+1•Calculateⅆ2ⅆx2y⁡xwith change of variablesⅆ2ⅆx2y⁡x=ⅆ2ⅆθ2y⁡θ⁢ⅆⅆxθ⁡x2+ⅆ2ⅆx2θ⁡x⁢ⅆⅆθy⁡θ•Compute2ndderivativeⅆ2ⅆx2y⁡xⅆ2ⅆx2y⁡x=ⅆ2ⅆθ2y⁡θ−x2+1−x⁢ⅆⅆθy⁡θ−x2+132•Apply the change of variables to the ODE−x2+1⁢ⅆ2ⅆθ2y⁡θ−x2+1−x⁢ⅆⅆθy⁡θ−x2+132+x⁢ⅆⅆθy⁡θ−x2+1+y⁡x=0•Multiply through−ⅆ2ⅆθ2y⁡θ⁢x2−x2+1+ⅆ2ⅆθ2y⁡θ−x2+1+x3⁢ⅆⅆθy⁡θ−x2+132−x⁢ⅆⅆθy⁡θ−x2+132+x⁢ⅆⅆθy⁡θ−x2+1+y⁡x=0•Simplify ODEⅆ2ⅆθ2y⁡θ+y⁡x=0•ODE is that of a harmonic oscillator with given general solutiony⁡θ=C1⁢sin⁡θ+C2⁢cos⁡θ•Revert back toxy⁡x=C1⁢sin⁡arccos⁡x+C2⁢cos⁡arccos⁡x•Use trig identity to simplifysin⁡arccos⁡xsin⁡arccos⁡x=−x2+1•Simplify solution to the ODEy⁡x=C1⁢−x2+1+C2⁢x▫Check validity of solutiony⁡x=c__1⁢−x2+1+c__2⁢x◦Use initial conditiony⁡2=11=c__1⁢−3+2⁢c__2◦Compute derivative of the solutionⅆⅆxy⁡x=−c__1⁢x−x2+1+c__2◦Use the initial conditionⅆⅆxy⁡xx=2|ⅆⅆxy⁡xx=2=−1−1=2⁢c__1⁢−33+c__2◦Solve forc__1andc__2c__1=3⁢−3,c__2=5◦Substitute constant values into general solution and simplifyy⁡x=3⁢I⁢3⁢−x2+1+5⁢x•Solution to the IVPy⁡x=3⁢I⁢3⁢−x2+1+5⁢x
See Also
diff
Int
Student
Student[ODEs]
Student[ODEs][ODESteps]
Download Help Document