Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters) - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Warning, The use of global variables in numerical ODE problems is deprecated, and will be removed in a future release. Use the 'parameters' argument instead (see ?dsolve,numeric,parameters)

Interactive features of numeric ODE/DAE solutions

 

Description

Examples

Description

  

Procedure form outputs for initial value dsolve/numeric solutions (ODE and DAE) have several interactive features. This page describes these features, and demonstrates how to use them.

Examples

Initial values

  

The initial values used in obtaining the current solution can be queried by calling the dsolve/numeric output procedure with option 'initial' as follows:

dsndsolvediffyx,xyx=0,y0=1,numeric

dsnprocx_rkf45...end proc

(1)

dsn1

x=1.,yx=2.71828133411964

(2)

dsninitial

x=0.,yx=1.

(3)

dsn2dsolvediffyx,xyx=0,y0=1,numeric,output=operator

dsn2x=procx...end proc,y=procx...end proc

(4)

dsn21

x=1.,y1=2.71828133411964

(5)

dsn2initial

xinitial=0.,yinitial=1.

(6)
  

In addition, initial values can be changed by calling the solution procedure with an equation of the form initial=newvalues, where newvalues is a list of new numeric initial values in the same order as specified for the solution output (i.e. if calling the solution procedure returns the values for x,y in a list, initial must be specified as x0,yx0).

dsninitial=0,2

x=0.,yx=2.

(7)

dsn1

x=1.,yx=5.43656271691257

(8)
  

For listprocedure and operator output form, the list can be provided to any of the procedures, or individual values can be changed by providing a single value instead of a list:

op1,2,dsn2initial=0,2:

dsn21

x=1.,y1=5.43656271691257

(9)

op2,2,dsn2initial=12:

dsn20

x=0.,y0=0.500000000000000

(10)

dsn21

x=1.,y1=1.35914065144134

(11)
  

New to Maple 12, this feature now also works with range solutions and DAE problems.

  

For DAE problems, the process is the same as for initial value problems, but consistency checks are performed as soon as any values are changed. Note that if the initial values are changed to inconsistent values, the solution procedure(s) will not be usable until correct values are set:

dsn3dsolvext2+yt2=1,diffxt,t,t=ltxt,diffyt,t,t=ltyt10,x0=0,y0=1,Dx0=1,Dy0=0,numeric

dsn3procx_rkf45_dae...end proc

(12)

dsn3initial

t=0.,lt=−11.,xt=0.,ⅆⅆtxt=1.,yt=−1.,ⅆⅆtyt=0.

(13)

dsn31

t=1.,lt=−10.9999995226619,xt=−0.000243191292859493,ⅆⅆtxt=−0.999999878673894,yt=−0.999999970376998,ⅆⅆtyt=0.000243191369033599

(14)
  

Choose a bad value for y(0):

dsn3initial=0,11,1,0,1,1

Error, (in `dsolve/numeric/DAE/checkconstraints`) the initial conditions do not satisfy the algebraic constraints
  error = 1., tolerance = .200e-5, constraint = x(t)^2+y(t)^2-1
  error = 1., tolerance = .100e-5, constraint = x(t)*diff(x(t),t)+y(t)*diff(y(t),t)

dsn31

Error, (in dsn3) parameters must be initialized before solution can be computed

  

Correct it:

dsn3initial=0,11,1,0,0,1

t=0.,lt=11.,xt=1.,ⅆⅆtxt=0.,yt=0.,ⅆⅆtyt=1.

(15)

dsn31

t=1.,lt=−11.5367008026070,xt=−0.936291714443607,ⅆⅆtxt=−0.994927567859575,yt=−0.351223327520403,ⅆⅆtyt=2.65227952244895

(16)
  

For range solutions (both for ODE and DAE), the solution is recomputed for the originally specified range whenever the initial values are changed.

Parametrized problems

  

It is now possible to obtain procedure solutions for parametrized ODE and DAE initial value problems with dsolve/numeric. Both the ODE/DAE defining equations, and the initial values, can depend upon the parameters.

  

The problem parameters must be declared when obtaining the dsolve/numeric solution procedure, and can be set using the procedure in much the same way as the initial values. For example:

dsn4dsolvediffyx,x=ayx,yx0=y0,numeric,parameters=x0,y0,a

dsn4procx_rkf45...end proc

(17)
  

Solutions cannot be obtained until the parameters are set:

dsn41

Error, (in dsn4) parameters must be initialized before solution can be computed

  

Parameter values can be queried and set as follows:

dsn4parameters

x0=undefined,y0=undefined,a=undefined

(18)

dsn4parameters=0,1,1

x0=0.,y0=1.,a=−1.

(19)

dsn40

x=0.,yx=1.

(20)

dsn41

x=1.,yx=0.367879356307219

(21)

dsn4parameters

x0=0.,y0=1.,a=−1.

(22)

dsn4parameters=a=2

x0=0.,y0=1.,a=−2.

(23)

dsn40

x=0.,yx=1.

(24)

dsn41

x=1.,yx=0.135335201861774

(25)
  

Parameters also work for DAE problems, as well as problems with specified ranges. For DAE problems though, just as for setting of the initial data, the parameters must be consistent with the constraints of the problem:

dsn5dsolvext2+yt2=r2,diffxt,t,t=ltxt,diffyt,t,t=ltytg,x0=0,y0=y0,Dx0=Dx0,Dy0=0,numeric,parameters=y0,Dx0,g,r

dsn5procx_rkf45_dae...end proc

(26)

dsn51

Error, (in dsn5) parameters must be initialized before solution can be computed

dsn5parameters

y0=undefined,Dx0=undefined,g=undefined,r=undefined

(27)

dsn5parameters=2,1,10,1

Error, (in `dsolve/numeric/DAE/checkconstraints`) the initial conditions do not satisfy the algebraic constraints
  error = 3., tolerance = .400e-5, constraint = x(t)^2+y(t)^2-r^2

dsn51

Error, (in dsn5) parameters must be initialized before solution can be computed

  

Repair the incorrect value

dsn5parameters=y0=1

y0=−1.,Dx0=1.,g=10.,r=1.

(28)

dsn51

t=1.,lt=−10.9999995226619,xt=−0.000243191292859331,ⅆⅆtxt=−0.999999878673895,yt=−0.999999970376998,ⅆⅆtyt=0.000243191369033434

(29)
  

Note that it is not always possible to simply adjust the parameters of a problem to be consistent with the constraints, but it may also be necessary to adjust the initial conditions simultaneously. When this is the case, the initial_and_parameters keyword must be used instead. For example:

dsn5bdsolvext2+yt2=r2,diffxt,t,t=ltxt,diffyt,t,t=ltytg,x0=0,y0=0,Dx0=0,Dy0=0,numeric,parameters=g,r

dsn5bprocx_rkf45_dae...end proc

(30)

dsn5b1

Error, (in dsn5b) parameters must be initialized before solution can be computed

dsn5binitial_and_parameters

t=0.,lt=Floatundefined,xt=0.,ⅆⅆtxt=0.,yt=0.,ⅆⅆtyt=0.,g=undefined,r=undefined

(31)

dsn5binitial_and_parameters=0,0,1,1,0,g=10,r=1

t=0.,lt=0.,xt=0.,ⅆⅆtxt=1.,yt=−1.,ⅆⅆtyt=0.,g=10.,r=1.

(32)

dsn5b1

t=1.,lt=−10.9999995226619,xt=−0.000243191292859331,ⅆⅆtxt=−0.999999878673895,yt=−0.999999970376998,ⅆⅆtyt=0.000243191369033434

(33)

Other Features

  

In addition to the features discussed above, there are several other small interactive features available for dsolve/numeric procedures.

dsn6dsolvediffyx,xyx=0,y1=exp1,numeric

dsn6procx_rkf45...end proc

(34)

dsn60

x=0.,yx=0.999999757634219

(35)
  

The argument 'start' can be used to query the initial point specified for the problem:

dsn6start

1.

(36)
  

The argument 'last' can be used to query the last computed point for the solution procedure (the last computed point does not include the interactive queries described on this page). This is most useful for problems with events.

dsn6last

x=0.,yx=0.999999757634219

(37)
  

For range-defined problems, 'left' and 'right' can be used to query the endpoints of the range.

dsn7dsolvediffyx,xyx=0,y1=1,numeric,range=0..2

dsn7procx_rkf45...end proc

(38)

dsn7left

0.

(39)

dsn7right

2.

(40)
  

The 'method' argument can be used to query the numerical method being used to obtain the solution of the problem:

dsn7method

rkf45

(41)
  

The 'numfun' argument can be used to query the number of function evaluations performed for integration from the initial point to the most recently requested solution value (supported for all solvers that support maxfun):

dsn7numfun

43

(42)

See Also

dsolve[Events]

dsolve[maxfun]

dsolve[numeric,DAE]

dsolve[numeric,IVP]

dsolve[numeric]