Systems of ODEs - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


ODE Steps for Systems of ODEs

 

Overview

Examples

Overview

• 

This help page gives a few examples of using the command ODESteps to solve systems of ordinary differential equations.

• 

See Student[ODEs][ODESteps] for a general description of the command ODESteps and its calling sequence.

Examples

> 

with⁡Student:-ODEs:

> 

high_order_ode1≔diff⁡y⁡x,x,x,x+3⁢diff⁡y⁡x,x,x+4⁢diff⁡y⁡x,x+2⁢y⁡x=0

high_order_ode1≔ⅆ3ⅆx3y⁡x+3⁢ⅆ2ⅆx2y⁡x+4⁢ⅆⅆxy⁡x+2⁢y⁡x=0

(1)
> 

ODESteps⁡high_order_ode1

Let's solveⅆ3ⅆx3y⁡x+3⁢ⅆ2ⅆx2y⁡x+4⁢ⅆⅆxy⁡x+2⁢y⁡x=0•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

(2)
> 

macro⁡Y=y1⁡x,y2⁡x:

> 

sys2≔diff⁡Y,x=%.⁡Matrix⁡7,1,`-`⁡4,3,Y

sys2≔ⅆⅆxy1⁡xⅆⅆxy2⁡x=71−43·y1⁡xy2⁡x

(3)
> 

ODESteps⁡sys2

Let's solveⅆⅆxy1⁡xⅆⅆxy2⁡x=71−43·y1⁡xy2⁡x•Define vectory→⁡x=y1⁡xy2⁡x•System to solveⅆⅆxy→⁡x=71−43·y→⁡x•Define the coefficient matrixA=71−43•Rewrite the system asⅆⅆxy→⁡x=A·y→⁡x•To solve the system, find the eigenvalues and eigenvectors ofA•Eigenpairs ofA5,−121,5,00•Consider eigenpair, with eigenvalue of algebraic multiplicity 25,−121•First solution from eigenvalue5y→1⁡x=ⅇ5⁢x⋅−121•Form of the 2nd homogeneous solution wherep→is to be solved for,λ=5is the eigenvalue, andv→is the eigenvectory→2⁡x=ⅇλ⁢x⁢x⁢v→+p→•Note that thexmultiplyingv→makes this solution linearly independent to the 1st solution obtained fromλ=5•Substitutey→2⁡xinto the homogeneous systemλ⁢ⅇλ⁢x⁢x⁢v→+p→+ⅇλ⁢x⁢v→=ⅇλ⁢x⁢A·x⁢v→+p→•Use the fact thatv→is an eigenvector ofAλ⁢ⅇλ⁢x⁢x⁢v→+p→+ⅇλ⁢x⁢v→=ⅇλ⁢x⁢λ⁢x⁢v→+A·p→•Simplify equationλ⁢p→+v→=A·p→•Make use of the identity matrixIλ⋅I·p→+v→=A·p→•Conditionp→must meet fory→2⁡xto be a solution to the homogeneous systemA−λ⋅I·p→=v→•Choosep→to use in the second solution to the homogeneous system from eigenvalue571−43−5⋅1001·p→=−121•Choice ofp→p→=−140•Second solution from eigenvalue5y→2⁡x=ⅇ5⁢x⋅x⋅−121+−140•General solution to the system of ODEsy→=c__1⁢y→1⁡x+c__2⁢y→2⁡x•Substitute solutions into the general solutiony→=c__1⁢ⅇ5⁢x⋅−121+c__2⁢ⅇ5⁢x⋅x⋅−121+−140•Solution to the system of ODEsy1⁡xy2⁡x=−ⅇ5⁢x⁢2⁢c__2⁢x+2⁢c__1+c__24ⅇ5⁢x⁢c__2⁢x+c__1

(4)
> 

sys3≔diff⁡Y,x=Matrix⁡1,2,3,2·Y+1,exp⁡x

sys3≔ⅆⅆxy1⁡xⅆⅆxy2⁡x=y1⁡x+2⁢y2⁡x+13⁢y1⁡x+2⁢y2⁡x+ⅇx

(5)
> 

ODESteps⁡sys3

Let's solveⅆⅆxy1⁡xⅆⅆxy2⁡x=y1⁡x+2⁢y2⁡x+13⁢y1⁡x+2⁢y2⁡x+ⅇx•Define vectory→⁡x=y1⁡xy2⁡x•System to solveⅆⅆxy→⁡x=1232·y→⁡x+1ⅇx•Define the forcing functionf→⁡x=1ⅇx•Define the coefficient matrixA=1232•Rewrite the system asⅆⅆxy→⁡x=A·y→⁡x+f→•To solve the system, find the eigenvalues and eigenvectors ofA•Eigenpairs ofA−1,−11,4,231•Consider eigenpair−1,−11•Solution to homogeneous system from eigenpairy→1=ⅇ−x⋅−11•Consider eigenpair4,231•Solution to homogeneous system from eigenpairy→2=ⅇ4⁢x⋅231•General solution of the system of ODEs can be written in terms of the particular solutiony→p⁡xy→⁡x=c__1⁢y→1+c__2⁢y→2+y→p⁡x▫Fundamental matrix◦Letφ⁡xbe the matrix whose columns are the independent solutions of the homogeneous system.φ⁡x=−ⅇ−x2⁢ⅇ4⁢x3ⅇ−xⅇ4⁢x◦The fundamental matrix,Φ⁡xis a normalized version ofφ⁡xsatisfyingΦ⁡0=IwhereIis the identity matrixΦ⁡x=φ⁡x·φ⁡0−1◦Substitute the value ofφ⁡xandφ⁡0Φ⁡x=−ⅇ−x2⁢ⅇ4⁢x3ⅇ−xⅇ4⁢x·−12311−1◦Evaluate and simplify to get the fundamental matrixΦ⁡x=3⁢ⅇ−x5+2⁢ⅇ4⁢x5−2⁢ⅇ−x5+2⁢ⅇ4⁢x5−3⁢ⅇ−x5+3⁢ⅇ4⁢x52⁢ⅇ−x5+3⁢ⅇ4⁢x5▫Find a particular solution of the system of ODEs using variation of parameters◦Let the particular solution be the fundamental matrix multiplied byv→⁡xand solve forv→⁡xy→p⁡x=Φ⁡x·v→⁡x◦Take the derivative of the particular solutionⅆⅆxy→p⁡x=ⅆⅆxΦ⁡x·v→⁡x+Φ⁡x·ⅆⅆxv→⁡x◦Substitute particular solution and its derivative into the system of ODEsⅆⅆxΦ⁡x·v→⁡x+Φ⁡x·ⅆⅆxv→⁡x=A·Φ⁡x·v→⁡x+f→⁡x◦The fundamental matrix has columns that are solutions to the homogeneous system so its derivative follows that of the homogeneous systemA·Φ⁡x·v→⁡x+Φ⁡x·ⅆⅆxv→⁡x=A·Φ⁡x·v→⁡x+f→⁡x◦Cancel like termsΦ⁡x·ⅆⅆxv→⁡x=f→⁡x◦Multiply by the inverse of the fundamental matrixⅆⅆxv→⁡x=Φ⁡x−1·f→⁡x◦Integrate to solve forv→⁡xv→⁡x=∫0xΦ⁡s−1·f→⁡sⅆs◦Plugv→⁡xinto the equation for the particular solutiony→p⁡x=Φ⁡x·∫0xΦ⁡s−1·f→⁡sⅆs◦Plug in the fundamental matrix and the forcing function and computey→p⁡x=12−2⁢ⅇ−x5−ⅇx3+7⁢ⅇ4⁢x30−34+2⁢ⅇ−x5+7⁢ⅇ4⁢x20•Plug particular solution back into general solutiony→⁡x=c__1⁢y→1+c__2⁢y→2+12−2⁢ⅇ−x5−ⅇx3+7⁢ⅇ4⁢x30−34+2⁢ⅇ−x5+7⁢ⅇ4⁢x20•Solution to the system of ODEsy1⁡xy2⁡x=ⅇ−x⁢−30⁢c__1−1230+20⁢c__2+7⁢ⅇ4⁢x30−ⅇx3+12ⅇ−x⁢20⁢c__1+820−34+20⁢c__2+7⁢ⅇ4⁢x20

(6)
> 

sys4≔diff⁡w⁡x,x=w⁡x+2⁢z⁡x,diff⁡z⁡x,x=3⁢w⁡x+2⁢z⁡x+exp⁡x

sys4≔ⅆⅆxw⁡x=w⁡x+2⁢z⁡x,ⅆⅆxz⁡x=3⁢w⁡x+2⁢z⁡x+ⅇx

(7)
> 

ODESteps⁡sys4

Let's solveⅆⅆxw⁡x=w⁡x+2⁢z⁡x,ⅆⅆxz⁡x=3⁢w⁡x+2⁢z⁡x+ⅇx•Define vectorw→⁡x=w⁡xz⁡x•Convert system into a vector equationⅆⅆxw→⁡x=1232·w→⁡x+0ⅇx•System to solveⅆⅆxw→⁡x=1232·w→⁡x+0ⅇx•Define the forcing functionf→⁡x=0ⅇx•Define the coefficient matrixA=1232•Rewrite the system asⅆⅆxw→⁡x=A·w→⁡x+f→•To solve the system, find the eigenvalues and eigenvectors ofA•Eigenpairs ofA−1,−11,4,231•Consider eigenpair−1,−11•Solution to homogeneous system from eigenpairw→1=ⅇ−x⋅−11•Consider eigenpair4,231•Solution to homogeneous system from eigenpairw→2=ⅇ4⁢x⋅231•General solution of the system of ODEs can be written in terms of the particular solutionw→p⁡xw→⁡x=c__1⁢w→1+c__2⁢w→2+w→p⁡x▫Fundamental matrix◦Letφ⁡xbe the matrix whose columns are the independent solutions of the homogeneous system.φ⁡x=−ⅇ−x2⁢ⅇ4⁢x3ⅇ−xⅇ4⁢x◦The fundamental matrix,Φ⁡xis a normalized version ofφ⁡xsatisfyingΦ⁡0=IwhereIis the identity matrixΦ⁡x=φ⁡x·φ⁡0−1◦Substitute the value ofφ⁡xandφ⁡0Φ⁡x=−ⅇ−x2⁢ⅇ4⁢x3ⅇ−xⅇ4⁢x·−12311−1◦Evaluate and simplify to get the fundamental matrixΦ⁡x=3⁢ⅇ−x5+2⁢ⅇ4⁢x5−2⁢ⅇ−x5+2⁢ⅇ4⁢x5−3⁢ⅇ−x5+3⁢ⅇ4⁢x52⁢ⅇ−x5+3⁢ⅇ4⁢x5▫Find a particular solution of the system of ODEs using variation of parameters◦Let the particular solution be the fundamental matrix multiplied byv→⁡xand solve forv→⁡xw→p⁡x=Φ⁡x·v→⁡x◦Take the derivative of the particular solutionⅆⅆxw→p⁡x=ⅆⅆxΦ⁡x·v→⁡x+Φ⁡x·ⅆⅆxv→⁡x◦Substitute particular solution and its derivative into the system of ODEsⅆⅆxΦ⁡x·v→⁡x+Φ⁡x·ⅆⅆxv→⁡x=A·Φ⁡x·v→⁡x+f→⁡x◦The fundamental matrix has columns that are solutions to the homogeneous system so its derivative follows that of the homogeneous systemA·Φ⁡x·v→⁡x+Φ⁡x·ⅆⅆxv→⁡x=A·Φ⁡x·v→⁡x+f→⁡x◦Cancel like termsΦ⁡x·ⅆⅆxv→⁡x=f→⁡x◦Multiply by the inverse of the fundamental matrixⅆⅆxv→⁡x=Φ⁡x−1·f→⁡x◦Integrate to solve forv→⁡xv→⁡x=∫0xΦ⁡s−1·f→⁡sⅆs◦Plugv→⁡xinto the equation for the particular solutionw→p⁡x=Φ⁡x·∫0xΦ⁡s−1·f→⁡sⅆs◦Plug in the fundamental matrix and the forcing function and computew→p⁡x=ⅇ−x5−ⅇx3+2⁢ⅇ4⁢x15−ⅇ−x5+ⅇ4⁢x5•Plug particular solution back into general solutionw→⁡x=c__1⁢w→1+c__2⁢w→2+ⅇ−x5−ⅇx3+2⁢ⅇ4⁢x15−ⅇ−x5+ⅇ4⁢x5•Substitute in vector of dependent variablesw⁡xz⁡x=ⅇ−x⁢−15⁢c__1+315+10⁢c__2+2⁢ⅇ4⁢x15−ⅇx3ⅇ−x⁢1+5⁢c__2⁢ⅇ5⁢x−1+5⁢c__15•Solution to the system of ODEsw⁡x=ⅇ−x⁢−15⁢c__1+315+10⁢c__2+2⁢ⅇ4⁢x15−ⅇx3,z⁡x=ⅇ−x⁢1+5⁢c__2⁢ⅇ5⁢x−1+5⁢c__15

(8)

See Also

diff

Int

Student

Student[ODEs]

Student[ODEs][ODESteps]