odetest - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


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

ODEdiffyx,x=sinxyx,y0=8

ODEⅆⅆxyx=sinxyx,y0=8

(1)

soldsolveODE

solyx=x2arctantan4x2tan4+xtan4x+x+2+2π

(2)

odetestsol,ODE

0,0

(3)

A second order ODE problem with boundary conditions

ODEdiffyx,x,x+diffyx,x+yx=0

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

(4)

bcy0=1,y2π=1

bcy0=1,y2π=1

(5)

soldsolveODE,bc

solyx=ⅇx2csc3πⅇπcot3πsin3x2+cos3x2

(6)

odetestsol,ODE,bc

0,0,0

(7)

A series solution for a nonlinear ODE with initial conditions

ODEdiffyx,x,x+diffyx,x2=0,ya=0,Dya=1

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

(8)

soldsolveODE,yx,type=series

solyx=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

ODEdiffdiffyx,x,x=3x2+cdiffyx,x+3bxayx

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

(11)

solyx=series1+12ax2+16b+1216cax3+124a2124cb+18c124c2ax4+Ox5,x,5

solyx=112ax2+b6+12ca6x3+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

ODEdiffyx,x,x=1x2_F1diffyx,xxyxyx

ODEⅆ2ⅆx2yx=_F1ⅆⅆxyxxyxyxx2

(14)

soldsolveODE

solyx=ⅇ` `lnxRootOf` `_Z1_a_a2+_F1_aⅆ_a_b+c__1ⅆ_b+c__2

(15)

odetestsol,ODE

0

(16)

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

ODEdiffyx,x=Fyxxlnxx+lnx

ODEⅆⅆxyx=Fyxxlnxx+lnx

(17)

soldsolveODE,implicit

sollnx` `lnx+yxx11+F_a_aⅆ_ac__1=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

ODEdiffyx,x=xfx2x+2yx3+fxx+3yx2difffx,xfxyx

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

(20)

soldsolveODE,yx,implicit

solc__1+arctanhfxyxxxfxyxx+2+2+xfxyxx+2+22fxyx=0

(21)

odetestsol,ODE,yx

0

(22)

Testing reductions of order returned by dsolve using ODESolStructures

ODEdiffyx,x,x=diffyx,xyx3fx+3xyx2diffyx,x+xdifffx,xx

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

(23)

soldsolveODE,yx

solyx=_b_awhereⅆⅆ_a_b_a_a_b_a3c__1_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.

sysODEdiffxt,t=yt,diffyt,t=xt,x,yt

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

(26)

solsysdsolvesysODE

solsysxt=c__1sint+c__2cost,yt=c__1costc__2sint

(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):

sysODEdiffxt,t=yt,diffyt,t=xt2,x,yt

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

(29)

solsysdsolvesysODE

solsysxt=6WeierstrassPt+c__1,0,c__2,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

solsysxt=6WeierstrassPt+c__1,0,c__2,yt=6WeierstrassPPrimet+c__1,0,c__2

(32)

mapodetest,solsys,sysODE

0

(33)

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

ODEdiffyt,t=b+2+2tyt+111+t2

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

(34)

soldsolveODE

solyt=22b2tb2+1hypergeomb2,b2+1,2+b2,t22b+2+c__1t+2b21tb21

(35)

odetestsol,ODE

1+t2b2hypergeomb2+1,b2+1,2+b2,t2bt+2hypergeomb2,b2,b2+1,t2b1+t2b2+41+t2b2hypergeomb2,b2,b2+1,t22b4b+tb+2+t2t+22t2b+2

(36)

sol2dsolveODE,useInt

sol2yt=ⅇb+2+2ttt+2ⅆttt+2ⅆt+c__1ⅇ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

ODEdiffyx,`$`x,2=a1F+a0Ex+Bea1yxB2e2xE3

ODEⅆ2ⅆx2yx=a0Ea1Fx+Bea1yxB2e2xE3

(39)

soldsolveODE,hyper3

solyx=c__1ⅇa0Ea1FxBeE32xhypergeom2a0Ea1FE32+a12a0Ea1FE32,2,2a0Ea1FxBeE32+c__2ⅇa0Ea1FxBeE32xKummerU2a0Ea1FE32+a12a0Ea1FE32,2,2a0Ea1FxBeE32

(40)

odePDEtoolsdpolyformsol,no_Fn

odeⅆ2ⅆx2yx=Bea1+Exa0Fxa1yxB2e2xE3where

(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_Wyx=c__1WhittakerM−1,12,a0Ea1FxBeE32B2e2E3WhittakerMa12a0Ea1FE32,12,2a0Ea1FxBeE32ⅇa0Ea1FxBeE322ⅇa0Ea1Fx2BeE32a0Ea1Fxc__2WhittakerM−1,12,a0Ea1FxBeE32B2e2E3WhittakerWa12a0Ea1FE32,12,2a0Ea1FxBeE32ⅇa0Ea1FxBeE322ⅇa0Ea1Fx2BeE32a0Ea1Fx

(43)

odetestsol_W,ODE

0

(44)

See Also

DEtools

dsolve

dsolve,system

odeadvisor

pdetest

symgen

symtest