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 paramaters 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⁢x2−2⁢x+22•Substitute particular solution into general solution to ODEy⁡x=_C1+_C2⁢ⅇx+ⅇx⁢x2−2⁢x+22•Use initial conditiony⁡0=11=_C1+_C2+1•Compute derivative of the solutionⅆⅆxy⁡x=_C2⁢ⅇx+ⅇx⁢x2−2⁢x+22+ⅇx⁢2⁢x−22•Use the initial conditionⅆⅆxy⁡xx=0|ⅆⅆxy⁡xx=0=00=_C2•Solve for_C1and_C2_C1=0,_C2=0•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 variableyu⁡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 fory⁡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•Use initial conditiony⁡1=11=6⁢ⅇ_C1+6⁢_C216•Compute derivative of the solutionⅆⅆxy⁡x=ⅇ_C16⁢ⅇ_C1⁢x+6⁢_C256•Use the initial conditionⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=−3−3=ⅇ_C16⁢ⅇ_C1+6⁢_C256•Solution is complex•Use initial conditiony⁡1=11=−6⁢ⅇ_C1+6⁢_C216•Compute derivative of the solutionⅆⅆxy⁡x=−ⅇ_C16⁢ⅇ_C1⁢x+6⁢_C256•Use the initial conditionⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=−3−3=−ⅇ_C16⁢ⅇ_C1+6⁢_C256•Solution is complex
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•Use initial conditiony⁡1=00=_C1⁢ⅇ−2+_C2⁢ⅇ3•Compute derivative of the solutionⅆⅆxy⁡x=−2⁢_C1⁢ⅇ−2⁢x+3⁢_C2⁢ⅇ3⁢x•Use the initial conditionⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=aa=−2⁢_C1⁢ⅇ−2+3⁢_C2⁢ⅇ3•Solve for_C1and_C2_C1=−a5⁢ⅇ−2,_C2=a5⁢ⅇ3•Solution to the IVPy⁡x=−a⁢ⅇ−2⁢x5⁢ⅇ−2+a⁢ⅇ3⁢x5⁢ⅇ3
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 the 1st derivative ofywith respect tox, using the chain ruleⅆⅆty⁡t=ⅆⅆxy⁡x◦Compute derivativeⅆⅆty⁡t=ⅆⅆty⁡tx◦Calculate the 2nd derivative ofywith respect tox, using the chain ruleⅆ2ⅆt2y⁡t=ⅆ2ⅆx2y⁡x◦Compute derivativeⅆ2ⅆt2y⁡t=−ⅆⅆty⁡tx2+ⅆ2ⅆt2y⁡tx2Substitute the change of variables back into the ODEx2⁢−ⅆⅆty⁡tx2+ⅆ2ⅆt2y⁡tx2−4⁢ⅆⅆty⁡t+2⁢y⁡t=0•Simplify−5⁢ⅆⅆty⁡t+ⅆ2ⅆt2y⁡t+2⁢y⁡t=0•Characteristic polynomial of ODEr2−5⁢r+2=0•Use quadratic formula to solve forrr=5±2•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⁢+_C2⁢ⅇ52+172⁢•Simplifyy⁡x=_C1⁢ⅇ−−5+17⁢2+_C2⁢ⅇ5+17⁢2•Use initial conditiony⁡1=−1−1=_C1+_C2•Compute derivative of the solutionⅆⅆxy⁡x=−_C1⁢−5+17⁢ⅇ−−5+17⁢ln⁡x22⁢x+_C2⁢5+17⁢ⅇ5+17⁢ln⁡x22⁢x•Use the initial conditionⅆⅆxy⁡xx=1|ⅆⅆxy⁡xx=1=1010=−_C1⁢−5+172+_C2⁢5+172•Solve for_C1and_C2_C1=−12−25⁢1734,_C2&e