## `detools::modode` -- modified equation

#### Introduction

`detools::modode` implements the method of the modified equation for the analysis of numerical integration methods applied to ordinary differential equations.

#### Call(s)

`detools::modode(Psi, depvars, indvar, step, order)`
`detools::modode(F, method, depvars, indvar, step, order)`

#### Parameters

`Psi` | - | the step function for the numerical method applied to the given differential equation: a list of expressions
`depvars` | - | the names of the unknown functions: a list of (indexed) identifiers.
`indvar` | - | the name of the independent variable: an (indexed) identifier.
`step` | - | the name of the step size: an (indexed) identifier.
`depvars` | - | the order (in `step`) to which the modified equation should be computed: a positive integer.
`F` | - | the right hand side of the differential equation: a procedure of the same form as required by `numeric::odesolve`.
`method` | - | the name of the chosen numerical method: a string.

#### Returns

a list of expressions representing the right hand side of the modified equation.

#### Related Functions

`numeric::odesolve`

#### Details

- The method of the modified equation is based on the following observation. Given a differential equation a numerical integration scheme will produce a sequence of points approximating a solution of the equation. There exist differential equations such that these points lie very close to their solutions (closer than to the approximated solution of the original equation). Such equations are called modified equations and can be computed as truncated power series in the step size `step`. Their analysis allows statements about the properties of the chosen numerical method applied to the given equation.
- The application of the method of the modified equation is straightforward for explicit one-step methods.
- For numerical methods implemented in `numeric::odesolve` it is not necessary to give explicitly the step function `Psi`. Instead one can give to `detools::modode` the right hand side `F` of the differential equation in the form used by `numeric::odesolve` and the name `method` of the integrator one is interested in. `detools::modode` will then call `numeric::odesolve` with the option Symbolic and thus automatically derive the step function `Psi`.

#### Example 1

The following input determines the modified equation of order 3 for the (forward) Euler method applied to the differential equation diff(y,t)=z and diff(z,t)=-y.

    >> detools::modode([z, - y], [y, z], t, h, 3)

                --            2      3               2      3   --
                |      h y   h  z   h  y  h z       h  y   h  z  |
                |  z + --- - ---- - ----, --- - y + ---- - ----  |
                --      2     3      4     2         3      4   --

The same result is obtained with the following sequence of commands.

    >> F := proc(t,y) begin [y[2], - y[1]] end_proc:
       detools::modode(F, EULER1, [y, z], t, h, 3)

                --            2      3               2      3   --
                |      h y   h  z   h  y  h z       h  y   h  z  |
                |  z + --- - ---- - ----, --- - y + ---- - ----  |
                --      2     3      4     2         3      4   --

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000