odetest - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Differential Equations : odetest

odetest

test the explicit or implicit results from ODE-solvers

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

odetest(sol, ODE, y(x))

odetest(sol, ODE, series, point=x0)

Parameters

sol

-

Ordinary Differential Equation (ODE) solution being tested; can be a set or list of them

ODE

-

ODE, or a set or list of them which can also include initial or boundary conditions

y(x)

-

(optional) indeterminate function of the ODE or a set or list of them

series

-

required when testing series solutions

point=x0

-

(optional) specification of the expansion point, x0, when testing series solutions

Description

• 

The odetest command checks explicit and implicit solutions for ODEs by making a careful simplification of the ODE with respect to the given solution. If the solution is valid, the returned result will be 0; otherwise, the algebraic remaining expression will be returned. In the case of systems of ODEs, odetest can only test explicit solutions, given either as a set or as a list of sets. (For information on non-composed sets of solutions for nonlinear systems, see dsolve,system.)

• 

To test whether a solution satisfies one or many initial or boundary conditions, pass to odetest the ODE together with the initial or boundary conditions, enclosed as a set or list, as second argument.

• 

If odetest returns a nonzero result, the solution being tested is not necessarily wrong; sometimes further simplifications or manipulations of odetest's output are required to obtain zero, and so verify the solution is correct. If the solution was obtained using the dsolve command, it is recommended that you recompute the solution using one or both of the useInt and implicit options - see dsolve. This may facilitate the verification process. Also, an alternative testing technique, particularly useful with linear ODEs, is to try to recompute the ODE departing from the solution which odetest fails in testing. Examples of both types are found at the end of the next section.

• 

To test series solutions, pass the keyword series as an extra argument. Only one series solution for one ODE (can be a set with initial/boundary conditions) can be tested.

Examples

An ODE problem with initial conditions

ODEⅆⅆxyx=sinxyx,y0=8

ODE:=ⅆⅆxyx=sinxyx,y0=8

(1)

soldsolveODE

sol:=yx=x2arctantan4x2tan4+xtan4x+x+2+2π

(2)

odetestsol,ODE

0,0

(3)

A second order ODE problem with boundary conditions

ODEⅆ2ⅆx2yx+ⅆⅆxyx+yx=0

ODE:=ⅆ2ⅆx2yx+ⅆⅆxyx+yx=0

(4)

bcy0=1,y2π=1

bc:=y0=1,y2π=1

(5)

soldsolveODE,bc

sol:=yx=cos3πⅇπ1ⅇ12xsin123xⅇπsin3π+ⅇ12xcos123x

(6)

odetestsol,ODE,bc

0,0,0

(7)

A series solution for a nonlinear ODE with initial conditions

ODEⅆ2ⅆx2yx+ⅆⅆxyx2=0,ya=0,Dya=1

ODE:=ⅆ2ⅆx2yx+ⅆⅆxyx2=0,ya=0,Dya=1

(8)

soldsolveODE,yx,type='series'

sol:=yx=xa12xa2+13xa314xa4+15xa5+Oxa6

(9)

odetestsol,ODE,series

0,0,0

(10)

When testing series solutions and the initial conditions are not present in the input to odetest, an indication of the expansion point is required

ODEⅆⅆxⅆⅆxyx=3x2+cⅆⅆxyx+3bxayx

ODE:=ⅆ2ⅆx2yx=3x2+cⅆⅆxyx+3bxayx

(11)

solyx=series11a2x2+1b6+121ca6x3+1a2241cb24+1c81c2a24x4+Ox5,x,5

sol:=yx=112ax2+16b+1216cax3+124a2124cb+18c124c2ax4+Ox5

(12)

odetestsol,ODE,series,point=0

0

(13)

An ODE with an arbitrary function _F1 of (x, y, dy/dx) and a solution involving nested integrals with a RootOf in the integrand

ODEⅆ2ⅆx2yx=1_F1ⅆⅆxyxxyxyxx2

ODE:=ⅆ2ⅆx2yx=_F1ⅆⅆxyxxyxyxx2

(14)

soldsolveODE

sol:=yx=ⅇ∫lnxRootOf∫_Z1_a_a2+_F1_aⅆ_a_b+_C1ⅆ_b+_C2

(15)

odetestsol,ODE

0

(16)

Testing ODE solutions given in implicit form, that is, not solved for the unknown (here y(x))

ODEⅆⅆxyx=Fyxxlnxx+lnx

ODE:=ⅆⅆxyx=Fyxxlnxx+lnx

(17)

soldsolveODE,implicit

sol:=lnx∫lnx+yxx11+F_a_aⅆ_a_C1=0

(18)

odetestsol,ODE

0

(19)

When the ODE has derivatives of other indeterminate functions and the solution is implicit, the specification of the indeterminate function of the problem is required by both dsolve and odetest

ODEⅆⅆxyx=xfx2x+2yx3+fxx+3yx2ⅆⅆxfxyxfx

ODE:=ⅆⅆxyx=xfx2x+2yx3+fxx+3yx2ⅆⅆxfxyxfx

(20)

soldsolveODE,yx,implicit

sol:=_C1+arctanhfxyxxxfxyxx+2+2+12xfxyxx+2+2fxyx=0

(21)

odetestsol,ODE,yx

0

(22)

Testing reductions of order returned by dsolve using ODESolStructures

ODEⅆ2ⅆx2yx=ⅆⅆxyxyx3fx+3xyx2ⅆⅆxyx+xⅆⅆxfxx

ODE:=ⅆ2ⅆx2yx=ⅆⅆxyxyx3fx+3xyx2ⅆⅆxyx+ⅆⅆxfxxx

(23)

soldsolveODE,yx

sol:=yx=_b_a &where ⅆⅆ_a_b_a_a_b_a3_C1_a+f_a_a=0,_a=x,_b_a=yx,x=_a,yx=_b_a

(24)

odetestsol,ODE

0

(25)

A linear system of ODEs. The solution is a set containing x(t) and y(t) as functions of t.

sysODEⅆⅆtyt=xt,ⅆⅆtxt=yt,x,yt

sysODE:=ⅆⅆtxt=yt,ⅆⅆtyt=xt,xt,yt

(26)

solsysdsolvesysODE

solsys:=xt=_C1sint+_C2cost,yt=_C1cost_C2sint

(27)

odetestsolsys,sysODE

0

(28)

A nonlinear system of ODEs. The solution is a list of sets, the first one containing the possible answers for x(t), and the second one expressing y(t) as a function of x(t):

sysODEⅆⅆtyt=xt2,ⅆⅆtxt=yt,x,yt

sysODE:=ⅆⅆtxt=yt,ⅆⅆtyt=xt2,xt,yt

(29)

solsysdsolvesysODE

solsys:=xt=6WeierstrassPt+_C1,0,_C2,yt=ⅆⅆtxt

(30)

These answers can be tests by passing them to odetest as a list.

odetestsolsys,sysODE

0

(31)

Alternatively, you can call dsolve with the 'explicit' extra argument to directly obtain (many) composed solution sets. To test all these answers, use the map function to apply odetest to each solution set:

solsysdsolvesysODE,explicit

solsys:=xt=6WeierstrassPt+_C1,0,_C2,yt=6WeierstrassPPrimet+_C1,0,_C2

(32)

mapodetest,solsys,sysODE

0

(33)

One possible workaround for an example where odetest fails in verifying dsolve's solution

ODEⅆⅆtyt=b+2+2tyt+111+t2

ODE:=ⅆⅆtyt=b+2+2tyt+111+t2

(34)

soldsolveODE

sol:=yt=t12b1t+212b1122212bt12b+1hypergeom12b,12b+1,2+12b,12tb+2+_C1

(35)

odetestsol,ODE

14212b+1tt+212bbhypergeom12b+1,2+12b,3+12b,12t+2212bt+212bhypergeom12b,12b+1,2+12b,12tb+2412bt+212bhypergeom12b,12b+1,2+12b,12t4b164+btt+2

(36)

sol2dsolveODE,useInt

sol2:=yt=∫ⅇ∫b+2+2ttt+2ⅆttt+2ⅆt+_C1ⅇ∫b+2+2ttt+2ⅆt

(37)

odetestsol2,ODE

0

(38)

By evaluating the integrals appearing in sol2, the output returned by dsolve without using the 'useInt' option can be constructed from the one obtained using the 'useInt' option, which was already verified to be correct.

An example hard to test due to the presence of radicals and Kummer functions in the solution

ODEⅆ2ⅆx2yx=a1F+a0Ex+Bea1yxB2e2xE3

ODE:=ⅆ2ⅆx2yx=Ea0Fa1x+Bea1yxB2e2xE3

(39)

soldsolveODE,hyper3

sol:=yx=_C1ⅇEa0Fa1xBeE3/2xhypergeom122Ea0Fa1E3/2+a1Ea0Fa1E3/2,2,2Ea0Fa1xBeE3/2+_C2ⅇEa0Fa1xBeE3/2xKummerU122Ea0Fa1E3/2+a1Ea0Fa1E3/2,2,2Ea0Fa1xBeE3/2

(40)

odePDEtools[dpolyform]sol,no_Fn

ode:=ⅆ2ⅆx2yx=yxBea1+Exa0Fxa1B2e2xE3 &where

(41)

normalODEop1,1,ode

0=0

(42)

Yet another alternative is to convert the special functions entering sol to other functions easier to test; in this example convert from Kummer to Whittaker functions:

sol_Wconvertsol,Whittaker

sol_W:=yx=12_C1WhittakerM0,12,Ea0Fa1xBeE3/2WhittakerM12a1Ea0Fa1E3/2,12,2Ea0Fa1xBeE3/2ⅇEa0Fa1xBeE3/2BeE3/2ⅇ12Ea0Fa1xBeE3/2Ea0Fa1+12_C2WhittakerM0,12,Ea0Fa1xBeE3/2WhittakerW12a1Ea0Fa1E3/2,12,2Ea0Fa1xBeE3/2ⅇEa0Fa1xBeE3/2BeE3/2ⅇ12Ea0Fa1xBeE3/2Ea0Fa1

(43)

odetestsol_W,ODE

0

(44)

See Also

DEtools

dsolve

dsolve,system

odeadvisor

pdetest

symgen

symtest

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam