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.
withStudent:-ODEs:
ivp1≔diffyx,x,x−diffyx,x−xexpx=0,evaldiffyx,x,x=0=0,y0=1
ivp1≔ⅆ2ⅆx2yx−ⅆⅆxyx−xⅇx=0,ⅆⅆxyxx=0|ⅆⅆxyxx=0=0,y0=1
ODEStepsivp1
Let's solveⅆ2ⅆx2yx−ⅆⅆxyx−xⅇx=0,ⅆⅆxyxx=0|ⅆⅆxyxx=0=0,y0=1•Highest derivative means the order of the ODE is2ⅆ2ⅆx2yx•Isolate 2nd derivativeⅆ2ⅆx2yx=ⅆⅆxyx+xⅇx•Group terms withyxon the lhs of the ODE and the rest on the rhs of the ODE; ODE is linearⅆ2ⅆx2yx−ⅆⅆxyx=xⅇx•Characteristic polynomial of homogeneous ODEr2−r=0•Factor the characteristic polynomialrr−1=0•Roots of the characteristic polynomialr=0,1•1st solution of the homogeneous ODEy1x=1•2nd solution of the homogeneous ODEy2x=ⅇx•General solution of the ODEyx=C1y1x+C2y2x+ypx•Substitute in solutions of the homogeneous ODEyx=C1+C2ⅇx+ypx▫Find a particular solutionypxof the ODE◦Use variation of parameters to findypherefxis the forcing functionypx=−y1x∫y2xfxWy1x,y2xⅆx+y2x∫y1xfxWy1x,y2xⅆx,fx=xⅇx◦Wronskian of solutions of the homogeneous equationWy1x,y2x=1ⅇx0ⅇx◦Compute WronskianWy1x,y2x=ⅇx◦Substitute functions into equation forypxypx=−∫xⅇxⅆx+ⅇx∫xⅆx◦Compute integralsypx=ⅇx1−x+12x2•Substitute particular solution into general solution to ODEyx=C1+C2ⅇx+ⅇx1−x+12x2▫Check validity of solutionyx=_C1+_C2ⅇx+ⅇx1−x+12x2◦Use initial conditiony0=11=_C1+_C2+1◦Compute derivative of the solutionⅆⅆxyx=_C2ⅇx+ⅇx1−x+12x2+x−1ⅇx◦Use the initial conditionⅆⅆxyxx=0|ⅆⅆxyxx=0=00=_C2◦Solve for_C1and_C2_C1=0,_C2=0◦Substitute constant values into general solution and simplifyyx=ⅇxx2−2x+22•Solution to the IVPyx=ⅇxx2−2x+22
ivp2≔diffyx,x,x+5diffyx,x2yx=0,evaldiffyx,x,x=1=−3,y1=1
ivp2≔ⅆ2ⅆx2yx+5ⅆⅆxyx2yx=0,ⅆⅆxyxx=1|ⅆⅆxyxx=1=−3,y1=1
ODEStepsivp2
Let's solveⅆ2ⅆx2yx+5ⅆⅆxyx2yx=0,ⅆⅆxyxx=1|ⅆⅆxyxx=1=−3,y1=1•Highest derivative means the order of the ODE is2ⅆ2ⅆx2yx•Define new dependent variableuux=ⅆⅆxyx•Computeⅆ2ⅆx2yxⅆⅆxux=ⅆ2ⅆx2yx•Use chain rule on the lhsⅆⅆxyxⅆⅆyuy=ⅆ2ⅆx2yx•Substitute in the definition ofuuyⅆⅆyuy=ⅆ2ⅆx2yx•Make substitutionsⅆⅆxyx=uy,ⅆ2ⅆx2yx=uyⅆⅆyuyto reduce order of ODEuyⅆⅆyuy+5uy2y=0•Separate variablesⅆⅆyuyuy=−5y•Integrate both sides with respect toy∫ⅆⅆyuyuyⅆy=∫−5yⅆy+C1•Evaluate integrallnuy=−5lny+C1•Solve foruyuy=ⅇC1y5•Solve 1st ODE foruyuy=ⅇC1y5•Revert to original variables with substitutionuy=ⅆⅆxyx,y=yxⅆⅆxyx=ⅇC1yx5•Separate variablesⅆⅆxyxyx5=ⅇC1•Integrate both sides with respect tox∫ⅆⅆxyxyx5ⅆx=∫ⅇC1ⅆx+C2•Evaluate integralyx66=ⅇC1x+C2•Solve foryxyx=6ⅇC1x+6C216,yx=−6ⅇC1x+6C216▫Check validity of solutionyx=6ⅇc__1x+6_C216◦Use initial conditiony1=11=6ⅇc__1+6_C216◦Compute derivative of the solutionⅆⅆxyx=ⅇc__16ⅇc__1x+6_C256◦Use the initial conditionⅆⅆxyxx=1|ⅆⅆxyxx=1=−3−3=ⅇc__16ⅇc__1+6_C256◦Solve forc__1and_C2c__1=ln3+Iπ,_C2=196◦Substitute constant values into general solution and simplifyyx=−18x+1916▫Check validity of solutionyx=−6ⅇc__1x+6_C216◦Use initial conditiony1=11=−6ⅇc__1+6_C216◦Compute derivative of the solutionⅆⅆxyx=−ⅇc__16ⅇc__1x+6_C256◦Use the initial conditionⅆⅆxyxx=1|ⅆⅆxyxx=1=−3−3=−ⅇc__16ⅇc__1+6_C256◦Solve forc__1and_C2◦The solution does not satisfy the initial conditions•Solution to the IVPyx=−18x+1916
ivp3≔diffyx,x,x−diffyx,x−6yx=0,evaldiffyx,x,x=1=a,y1=0
ivp3≔ⅆ2ⅆx2yx−ⅆⅆxyx−6yx=0,ⅆⅆxyxx=1|ⅆⅆxyxx=1=a,y1=0
ODEStepsivp3
Let's solveⅆ2ⅆx2yx−ⅆⅆxyx−6yx=0,ⅆⅆxyxx=1|ⅆⅆxyxx=1=a,y1=0•Highest derivative means the order of the ODE is2ⅆ2ⅆx2yx•Characteristic polynomial of ODEr2−r−6=0•Factor the characteristic polynomialr+2r−3=0•Roots of the characteristic polynomialr=−2,3•1st solution of the ODEy1x=ⅇ−2x•2nd solution of the ODEy2x=ⅇ3x•General solution of the ODEyx=C1y1x+C2y2x•Substitute in solutionsyx=C1ⅇ−2x+C2ⅇ3x▫Check validity of solutionyx=c__1ⅇ−2x+_C2ⅇ3x◦Use initial conditiony1=00=c__1ⅇ−2+_C2ⅇ3◦Compute derivative of the solutionⅆⅆxyx=−2c__1ⅇ−2x+3_C2ⅇ3x◦Use the initial conditionⅆⅆxyxx=1|ⅆⅆxyxx=1=aa=−2c__1ⅇ−2+3_C2ⅇ3◦Solve forc__1and_C2c__1=−a5ⅇ−2,_C2=a5ⅇ3◦Substitute constant values into general solution and simplifyyx=−aⅇ2−2x−ⅇ−3+3x5•Solution to the IVPyx=−aⅇ2−2x−ⅇ−3+3x5
ivp4≔x2diffyx,x,x−4xdiffyx,x+2yx=0,evaldiffyx,x,x=1=10,y1=−1
ivp4≔x2ⅆ2ⅆx2yx−4xⅆⅆxyx+2yx=0,ⅆⅆxyxx=1|ⅆⅆxyxx=1=10,y1=−1
ODEStepsivp4
Let's solvex2ⅆ2ⅆx2yx−4xⅆⅆxyx+2yx=0,ⅆⅆxyxx=1|ⅆⅆxyxx=1=10,y1=−1•Highest derivative means the order of the ODE is2ⅆ2ⅆx2yx•Isolate 2nd derivativeⅆ2ⅆx2yx=−2yxx2+4ⅆⅆxyxx•Group terms withyxon the lhs of the ODE and the rest on the rhs of the ODE; ODE is linearⅆ2ⅆx2yx−4ⅆⅆxyxx+2yxx2=0•Multiply by denominators of the ODEx2ⅆ2ⅆx2yx−4xⅆⅆxyx+2yx=0•Make a change of variablest=lnx▫Substitute the change of variables back into the ODE◦Calculate the1stderivative ofywith respect tox, using the chain ruleⅆⅆxyx=ⅆⅆtytⅆⅆxtx◦Compute derivativeⅆⅆxyx=ⅆⅆtytx◦Calculate the2ndderivative ofywith respect tox, using the chain ruleⅆ2ⅆx2yx=ⅆ2ⅆt2ytⅆⅆxtx2+ⅆ2ⅆx2txⅆⅆtyt◦Compute derivativeⅆ2ⅆx2yx=ⅆ2ⅆt2ytx2−ⅆⅆtytx2Substitute the change of variables back into the ODEx2ⅆ2ⅆt2ytx2−ⅆⅆtytx2−4ⅆⅆtyt+2yt=0•Simplifyⅆ2ⅆt2yt−5ⅆⅆtyt+2yt=0•Characteristic polynomial of ODEr2−5r+2=0•Use quadratic formula to solve forrr=5±172•Roots of the characteristic polynomialr=52−172,52+172•1st solution of the ODEy1t=ⅇ52−172t•2nd solution of the ODEy2t=ⅇ52+172t•General solution of the ODEyt=C1y1t+C2y2t•Substitute in solutionsyt=C1ⅇ52−172t+C2ⅇ52+172t•Change variables back usingt=lnxyx=C1ⅇ52−172lnx+C2ⅇ52+172lnx•Simplifyyx=x52x−172C1+x172C2▫Check validity of solutionyx=x52x−172c__1+x172_C2◦Use initial conditiony1=−1−1=c__1+_C2◦Compute derivative of the solutionⅆⅆxyx=5x32x−172c__1+x172_C22+x52−x−17217c__12x+x17217_C22x◦Use the initial conditionⅆⅆxyxx=1|ⅆⅆxyxx=1=1010=5c__12+5_C22−17c__12+17_C22◦Solve forc__1and_C2c__1=−12−251734,_C2=−12+251734◦Substitute constant values into general solution and simplifyyx=−x5225x−17217−25x17217+17x−172+17x17234•Solution to the IVPyx=−x5225x−17217−25x17217+17x−172+17x17234
ivp5≔−x2+1diffyx,x,x−xdiffyx,x+yx=0,evaldiffyx,x,x=2=−1,y2=1
ivp5≔−x2+1ⅆ2ⅆx2yx−xⅆⅆxyx+yx=0,ⅆⅆxyxx=2|ⅆⅆxyxx=2=−1,y2=1
ODEStepsivp5
Let's solve−x2+1ⅆ2ⅆx2yx−xⅆⅆxyx+yx=0,ⅆⅆxyxx=2|ⅆⅆxyxx=2=−1,y2=1•Highest derivative means the order of the ODE is2ⅆ2ⅆx2yx•Isolate 2nd derivativeⅆ2ⅆx2yx=yxx2−1−xⅆⅆxyxx2−1•Group terms withyxon the lhs of the ODE and the rest on the rhs of the ODE; ODE is linearⅆ2ⅆx2yx+xⅆⅆxyxx2−1−yxx2−1=0•Multiply by denominators of ODE−x2+1ⅆ2ⅆx2yx−xⅆⅆxyx+yx=0•Make a change of variablesθ=arccosx•Calculateⅆⅆxyxwith change of variablesⅆⅆxyx=ⅆⅆθyθⅆⅆxθx•Compute1stderivativeⅆⅆxyxⅆⅆxyx=−ⅆⅆθyθ−x2+1•Calculateⅆ2ⅆx2yxwith change of variablesⅆ2ⅆx2yx=ⅆ2ⅆθ2yθⅆⅆxθx2+ⅆ2ⅆx2θxⅆⅆθyθ•Compute2ndderivativeⅆ2ⅆx2yxⅆ2ⅆx2yx=ⅆ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+yx=0•Multiply through−ⅆ2ⅆθ2yθx2−x2+1+ⅆ2ⅆθ2yθ−x2+1+x3ⅆⅆθyθ−x2+132−xⅆⅆθyθ−x2+132+xⅆⅆθyθ−x2+1+yx=0•Simplify ODEⅆ2ⅆθ2yθ+yx=0•ODE is that of a harmonic oscillator with given general solutionyθ=C1sinθ+C2cosθ•Revert back toxyx=C1sinarccosx+C2cosarccosx•Use trig identity to simplifysinarccosxsinarccosx=−x2+1•Simplify solution to the ODEyx=C1−x2+1+C2x▫Check validity of solutionyx=c__1−x2+1+c__2x◦Use initial conditiony2=11=c__1−3+2c__2◦Compute derivative of the solutionⅆⅆxyx=−c__1x−x2+1+c__2◦Use the initial conditionⅆⅆxyxx=2|ⅆⅆxyxx=2=−1−1=2c__1−33+c__2◦Solve forc__1andc__2c__1=3−3,c__2=5◦Substitute constant values into general solution and simplifyyx=3I3−x2+1+5x•Solution to the IVPyx=3I3−x2+1+5x
See Also
diff
Int
Student
Student[ODEs]
Student[ODEs][ODESteps]
Download Help Document