Systems of ODEs with IVP - 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 with IVP

 

Overview

Examples

Overview

• 

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

• 

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

Examples

withStudent:-ODEs:

high_order_ivp1diffyx,x,x,x+3diffyx,x,x+4diffyx,x+2yx=0,evaldiffyx,x,x=0=1,evaldiffyx,x,x,x=0=2,y0=1

high_order_ivp1ⅆ3ⅆx3yx+3ⅆ2ⅆx2yx+4ⅆⅆxyx+2yx=0,ⅆ2ⅆx2yxx=0|ⅆ2ⅆx2yxx=0=2,ⅆⅆxyxx=0|ⅆⅆxyxx=0=−1,y0=1

(1)

ODEStepshigh_order_ivp1

Let's solveⅆ3ⅆx3yx+3ⅆ2ⅆx2yx+4ⅆⅆxyx+2yx=0,ⅆ2ⅆx2yxx=0|ⅆ2ⅆx2yxx=0=2,ⅆⅆxyxx=0|ⅆⅆxyxx=0=−1,y0=1Highest derivative means the order of the ODE is3ⅆ3ⅆx3yxCharacteristic polynomial of ODEr3+3r2+4r+2=0Roots of the characteristic polynomialr=−1,−1I,−1+ISolution fromr=−1y1x=ⅇxSolutions fromr=−1Iandr=−1+Iy2x=ⅇxsinx,y3x=ⅇxcosxGeneral solution of the ODEyx=c__1y1x+c__2y2x+c__3y3xSubstitute in solutions and simplifyyx=ⅇxc__1+c__2sinx+c__3cosxUse the initial conditiony0=11=c__1+c__3Calculate the 1st derivative of the solutionⅆⅆxyx=ⅇxc__1+c__2sinx+c__3cosx+ⅇxc__2cosxc__3sinxUse the initial conditionⅆⅆxyxx=0|ⅆⅆxyxx=0=−1−1=c__1c__3+c__2Calculate the 2nd derivative of the solutionⅆ2ⅆx2yx=ⅇxc__1+c__2sinx+c__3cosx2ⅇxc__2cosxc__3sinx+ⅇxc__2sinxc__3cosxUse the initial conditionⅆ2ⅆx2yxx=0|ⅆ2ⅆx2yxx=0=22=c__12c__2Solve for the unknown coefficientsc__1=2,c__2=0,c__3=−1Solution to the IVPyx=ⅇx2cosx

(2)

macroY=y1x,y2x:

ivpsys2diffY,x=%.Matrix7,1,`-`4,3,Y,evalY,x=0=1,1

ivpsys2ⅆⅆxy1xⅆⅆxy2x=71−43·y1xy2x,y10y20=11

(3)

ODEStepsivpsys2

Let's solveⅆⅆxy1xⅆⅆxy2x=71−43·y1xy2x,y10y20=11Define vectoryx=y1xy2xSystem to solveⅆⅆxyx=71−43·yxDefine the coefficient matrixA=71−43Rewrite the system asⅆⅆxyx=A·yxTo solve the system, find the eigenvalues and eigenvectors ofAEigenpairs ofA5,121,5,00Consider eigenpair, with eigenvalue of algebraic multiplicity 25,121First solution from eigenvalue5y1x=ⅇ5x121Form of the 2nd homogeneous solution wherepis to be solved for,λ=5is the eigenvalue, andvis the eigenvectory2x=ⅇλxxv+pNote that thexmultiplyingvmakes this solution linearly independent to the 1st solution obtained fromλ=5Substitutey2xinto the homogeneous systemλⅇλxxv+p+ⅇλxv=ⅇλxA·xv+pUse the fact thatvis an eigenvector ofAλⅇλxxv+p+ⅇλxv=ⅇλxλxv+A·pSimplify equationλp+v=A·pMake use of the identity matrixIλI·p+v=A·pConditionpmust meet fory2xto be a solution to the homogeneous systemAλI·p=vChoosepto use in the second solution to the homogeneous system from eigenvalue571−4351001·p=121Choice ofpp=140Second solution from eigenvalue5y2x=ⅇ5xx121+140General solution to the system of ODEsy=c__1y1x+c__2y2xSubstitute solutions into the general solutiony=c__1ⅇ5x121+c__2ⅇ5xx121+140Fundamental matrixLetφxbe the matrix whose columns are the independent solutions of the homogeneous system.φx=ⅇ5x2ⅇ5xx214ⅇ5xⅇ5xxThe fundamental matrix,Φxis a normalized version ofφxsatisfyingΦ0=IwhereIis the identity matrixΦx=φx·φ0−1Substitute the value ofφxandφ0Φx=ⅇ5x2ⅇ5xx214ⅇ5xⅇ5xx·121410−1Evaluate and simplify to get the fundamental matrixΦx=ⅇ5x2x+1ⅇ5xx4ⅇ5xxⅇ5x12xRemember that the fundamental matrix has columns that are basis vectors atx=0, so the solution to the IVP is the columns of the fundamental matrix multiplied by the entries of the initial condition vectoryx=Φx·11Compute solution to the IVPyx=ⅇ5x2x+1+ⅇ5xx4ⅇ5xx+ⅇ5x12xSolution to the system of ODEsy1xy2x=ⅇ5x3x+1ⅇ5x6x+1

(4)

ivpsys3diffY,x=Matrix1,2,3,2·Y+1,expx,evalY,x=1=0,1

ivpsys3ⅆⅆxy1xⅆⅆxy2x=y1x+2y2x+13y1x+2y2x+ⅇx,y11y21=0−1

(5)

ODEStepsivpsys3

Let's solveⅆⅆxy1xⅆⅆxy2x=y1x+2y2x+13y1x+2y2x+ⅇx,y11y21=0−1Define vectoryx=y1xy2xSystem to solveⅆⅆxyx=1232·yx+1ⅇxDefine the forcing functionfx=1ⅇxDefine the coefficient matrixA=1232Rewrite the system asⅆⅆxyx=A·yx+fTo solve the system, find the eigenvalues and eigenvectors ofAEigenpairs ofA−1,−11,4,231Consider eigenpair−1,−11Solution to homogeneous system from eigenpairy1=ⅇx−11Consider eigenpair4,231Solution to homogeneous system from eigenpairy2=ⅇ4x231General solution of the system of ODEs can be written in terms of the particular solutionypxyx=c__1y1+c__2y2+ypxFundamental matrixLetφxbe the matrix whose columns are the independent solutions of the homogeneous system.φx=ⅇx2ⅇ4x3ⅇxⅇ4xThe fundamental matrix,Φx,1is a normalized version ofφxsatisfyingΦ1,1=IwhereIis the identity matrixΦx=φx·φ1−1Substitute the value ofφxandφ1Φx,1=ⅇx2ⅇ4x3ⅇxⅇ4x·ⅇ−12ⅇ43ⅇ−1ⅇ4−1Evaluate and simplify to get the fundamental matrixΦx,1=3ⅇ1x5+2ⅇ4+4x52ⅇ1x5+2ⅇ4+4x53ⅇ1x5+3ⅇ4+4x52ⅇ1x5+3ⅇ4+4x5Find a particular solution of the system of ODEs using variation of parametersLet the particular solution be the fundamental matrix multiplied byvxand solve forvxypx=Φx·vxTake the derivative of the particular solutionⅆⅆxypx=ⅆⅆxΦx·vx+Φx·ⅆⅆxvxSubstitute particular solution and its derivative into the system of ODEsⅆⅆxΦx·vx+Φx·ⅆⅆxvx=A·Φx·vx+fxThe fundamental matrix has columns that are solutions to the homogeneous system so its derivative follows that of the homogeneous systemA·Φx·vx+Φx·ⅆⅆxvx=A·Φx·vx+fxCancel like termsΦx·ⅆⅆxvx=fxMultiply by the inverse of the fundamental matrixⅆⅆxvx=Φx−1·fxIntegrate to solve forvxvx=0xΦs−1·fsⅆsPlugvxinto the equation for the particular solutionypx=Φx·0xΦs−1·fsⅆsPlug in the fundamental matrix and the forcing function and computeypx=7ⅇ4x30+12ⅇx32ⅇx57ⅇ4x2034+2ⅇx5Plug particular solution back into general solutionyx=c__1y1+c__2y2+7ⅇ4x30+12ⅇx32ⅇx57ⅇ4x2034+2ⅇx5Remember that the fundamental matrix has columns that are basis vectors atx=1, so we can use the fundamental matrix to solve the IVP. Define the initial condition vectora=0−1From here on we will writeΦx,1asΦxΦx=Φx,1This is the form of the solutionyx=Φx·ayp1+ypxSince the fundamental matrix is the identity atx=1, evaluating this solution atx=1gives the initial condition as requiredy1=ayp1+yp1Show that this solution solves the ODEFirst calculateⅆⅆxyxⅆⅆxyx=ⅆⅆxΦx·ayp1+ⅆⅆxypxUseⅆⅆxypx=ⅆⅆxΦx·vx+Φx·ⅆⅆxvxfound while computingypxⅆⅆxyx=ⅆⅆxΦx·ayp1+ⅆⅆxΦx·vx+Φx·ⅆⅆxvxThe columns of the fundamental matrix are solutions to the homogeneous system so its derivative follows that of the homogeneous system, that isⅆⅆxΦx=A·Φxⅆⅆxyx=A·Φx·ayp1+A·Φx·vx+Φx·ⅆⅆxvxRecall that when finding the particular solution to the system we foundfx=Φx·ⅆⅆxvxⅆⅆxyx=A·Φx·ayp1+A·ypx+fxGroup termsⅆⅆxyx=A·Φx·ayp1+ypx+fxUsingyx=Φx·ayp1+ypx, it is clear thatyxis a solution to the systemⅆⅆxyx=A·yx+fxSolution to the system of ODEsy1xy2x=ⅇ1x53ⅇ4+4x10+12+ⅇ2x5ⅇx3+2ⅇ3+4x15ⅇ1x59ⅇ4+4x2034ⅇ2x5+ⅇ3+4x5

(6)

ivpsys4diffwx,x=wx+2zx,diffzx,x=3wx+2zx+expx,w1=2,z1=2

ivpsys4ⅆⅆxwx=wx+2zx,ⅆⅆxzx=3wx+2zx+ⅇx,w−1=2,z−1=−2

(7)

ODEStepsivpsys4

Let's solveⅆⅆxwx=wx+2zx,ⅆⅆxzx=3wx+2zx+ⅇx,w−1=2,z−1=−2Define vectorwx=wxzxConvert system into a vector equationⅆⅆxwx=1232·wx+0ⅇxSystem to solveⅆⅆxwx=1232·wx+0ⅇxDefine the forcing functionfx=0ⅇxDefine the coefficient matrixA=1232Rewrite the system asⅆⅆxwx=A·wx+fTo solve the system, find the eigenvalues and eigenvectors ofAEigenpairs ofA−1,−11,4,231Consider eigenpair−1,−11Solution to homogeneous system from eigenpairw1=ⅇx−11Consider eigenpair4,231Solution to homogeneous system from eigenpairw2=ⅇ4x231General solution of the system of ODEs can be written in terms of the particular solutionwpxwx=c__1w1+c__2w2+wpxFundamental matrixLetφxbe the matrix whose columns are the independent solutions of the homogeneous system.φx=ⅇx2ⅇ4x3ⅇxⅇ4xThe fundamental matrix,Φx,−1is a normalized version ofφxsatisfyingΦ−1,−1=IwhereIis the identity matrixΦx=φx·φ−1−1Substitute the value ofφxandφ−1Φx,−1=ⅇx2ⅇ4x3ⅇxⅇ4x·ⅇ2ⅇ−43ⅇⅇ−4−1Evaluate and simplify to get the fundamental matrixΦx,−1=3ⅇ1x5+2ⅇ4+4x52ⅇ1x5+2ⅇ4+4x53ⅇ1x5+3ⅇ4+4x52ⅇ1x5+3ⅇ4+4x5Find a particular solution of the system of ODEs using variation of parametersLet the particular solution be the fundamental matrix multiplied byvxand solve forvxwpx=Φx·vxTake the derivative of the particular solutionⅆⅆxwpx=ⅆⅆxΦx·vx+Φx·ⅆⅆxvxSubstitute particular solution and its derivative into the system of ODEsⅆⅆxΦx·vx+Φx·ⅆⅆxvx=A·Φx·vx+fxThe fundamental matrix has columns that are solutions to the homogeneous system so its derivative follows that of the homogeneous systemA·Φx·vx+Φx·ⅆⅆxvx=A·Φx·vx+fxCancel like termsΦx·ⅆⅆxvx=fxMultiply by the inverse of the fundamental matrixⅆⅆxvx=Φx−1·fxIntegrate to solve forvxvx=0xΦs−1·fsⅆsPlugvxinto the equation for the particular solutionwpx=Φx·0xΦs−1·fsⅆsPlug in the fundamental matrix and the forcing function and computewpx=ⅇx5+2ⅇ4x15ⅇx3ⅇx5+ⅇ4x5Plug particular solution back into general solutionwx=c__1w1+c__2w2+ⅇx5+2ⅇ4x15ⅇx3ⅇx5+ⅇ4x5Remember that the fundamental matrix has columns that are basis vectors atx=−1, so we can use the fundamental matrix to solve the IVP. Define the initial condition vectora=2−2From here on we will writeΦx,−1asΦxΦx=Φx,−1This is the form of the solutionyx=Φx·ayp−1+ypxSince the fundamental matrix is the identity atx=−1, evaluating this solution atx=−1gives the initial condition as requiredy−1=ayp−1+yp−1Show that this solution solves the ODEFirst calculateⅆⅆxyxⅆⅆxyx=ⅆⅆxΦx·ayp−1+ⅆⅆxypxUseⅆⅆxypx=ⅆⅆxΦx·vx+Φx·ⅆⅆxvxfound while computingypxⅆⅆxyx=ⅆⅆxΦx·ayp−1+ⅆⅆxΦx·vx+Φx·ⅆⅆxvxThe columns of the fundamental matrix are solutions to the homogeneous system so its derivative follows that of the homogeneous system, that isⅆⅆxΦx=A·Φxⅆⅆxyx=A·Φx·ayp−1+A·Φx·vx+Φx·ⅆⅆxvxRecall that when finding the particular solution to the system we foundfx=Φx·ⅆⅆxvxⅆⅆxyx=A·Φx·ayp−1+A·ypx+fxGroup termsⅆⅆxyx=A·Φx·ayp−1+ypx+fxUsingyx=Φx·ayp−1+ypx, it is clear thatyxis a solution to the systemⅆⅆxyx=A·yx+fxSubstitute in vector of dependent variableswxzx=2ⅇ3+4x15ⅇx3+ⅇ2x5+2ⅇ1xⅇ3+4x5ⅇ2x52ⅇ1xSolution to the system of ODEswx=2ⅇ3+4x15ⅇx3+ⅇ2x5+2ⅇ1x,zx=ⅇ3+4x5ⅇ2x52ⅇ1x

(8)

See Also

diff

Int

Student

Student[ODEs]

Student[ODEs][ODESteps]