MATH 302-010
Ordinary Differential Equations
Prof. D. A. Edwards
Copyright 2024

Higher Order ODEs

We begin with our standard command:

Quit[]

Higher Order

Mathematica can solve higher-order equations just like lower-order ones.  The key is to use the D operator to simplify the taking of derivatives.  We do so by writing (((d^n)y)/(dt^n))=D[y[t],{t,n}]:

D[y[t],{t,5}]
D[t^6-Sin[t],{t,4}]

Once we have the notation, we can solve any order equation we wish:

high1 = D[y[t],{t,4}]+2*D[y[t],{t,3}]-8*y''[t]-2*y'[t]+7*y[t]==0
DSolve[high1,y[t],t]

This provides the general solution.  In order to obtain a unique solution, we must have four conditions, one on each of y, y', y'', and (((d^3)y)/(dt^3)).  The first two are easy, as we have done them before:

hic1 = y[0]==1
hic2 = y'[0] == 0
hic3 = y''[0]==1
DSolve[{high1,hic1,hic2,hic3},y[t],t]

To do multiple derivatives, we use the same command, but then evaluate at t=0:

der3 = D[y[t],{t,3}]/.(t->0)
hic4 = der3==-1
DSolve[{high1,hic1,hic2,hic3,hic4},y[t],t]

The same sets of commands also hold for solving more complicated equations numerically:

high2 = (1+Sin[t])*D[y[t],{t,4}]-2*(t+3)*D[y[t],{t,3}]-t*y''[t]+2*y'[t]+(t+3)*y[t]==0
DSolve[high2,y[t],t]

IMPORTANT: Whenever you use NDSolve, you must include all the necessary initial conditions:

numhigh2 = NDSolve[{high2,hic1,hic2,hic3,hic4},y,{t,0,3}];
y[1]/.numhigh2

Plot[y[t]/.numhigh2,{t,0,1},PlotRange->All]

Exercise

1.  Write the solution of (((d^4)y)/(dt^4))+11 (((d^3)y)/(dt^3))+40y''+53y'+15y=0, y(0)=a, y'(0)=0, y''(0)=0,  (((d^3)y)/(dt^3))(0)=0.  Plot the solution for  a=1, 2, 3, 4, and 5, and for 0<t<5.

Solution

p2eq = D[y[t],{t,4}]+11*D[y[t],{t,3}]+40*y''[t]+53*y'[t]+15*y[t]==0
ic2a = y[0]==a
ic2b = y'[0]==0
ic2c = y''[0]==0
ic2d = (D[y[t],{t,3}]/.(t->0))==0

Table[NDSolve[{p2eq,ic2a,ic2b,ic2c,ic2d},y,{t,0,5}],{a,1,5}];
Plot[y[t]/.%,{t,0,5}]

Titles

In order to separate your Mathematica notebooks into parts, it’s useful to use titles or sections to separate the parts clearly.   You can select the style under the Format...Style menu.

This is a title.

This is a subtitle.

This is a subsubtitle.

This is a section.

This is a subsection.

This is a subsubsection.