REDUCE

17.5 Ordinary Differential Equations

A Runge-Kutta method of order 3 finds an approximate graph for the solution of a ordinary differential equation real initial value problem.

Syntax:

num_odesolve
(exp,depvar = dv,indepvar=(from..to)

[,accuracy = a][,iterations = i])

where

exp is the differential expression/equation,

depvar is an identifier representing the dependent variable (function to be found),

indepvar is an identifier representing the independent variable,

exp is an equation (or an expression implicitly set to zero) which contains the first derivative of depvar wrt indepvar,

from is the starting point of integration,

to is the endpoint of integration (allowed to be below from),

dv is the initial value of depvar in the point indepvar = from.

The ODE exp is converted into an explicit form, which then is used for a Runge Kutta iteration over the given range. The number of steps is controlled by the value of i (default: 20). If the steps are too coarse to reach the desired accuracy in the neighborhood of the starting point, the number is increased automatically.

Result is a list of pairs, each representing a point of the approximate solution of the ODE problem.

Remarks:

  1. Note that the dependent variable must be explicitly declared using a depend statement, e.g., depend y,x.
  2. The REDUCE package SOLVE is used to convert the form into an explicit ODE. If that process fails or has no unique result, the evaluation is stopped with an error message.

Example:

 
    depend y,x;  
 
    num_odesolve(df(y,x)=y,y=1,x=(0 .. 1), iterations=5);  
 
{{x,y},  
 
 {0.0,1.0},  
 
 {0.2,1.22140275816},  
 
 {0.4,1.49182469764},  
 
 {0.6,1.82211880039},  
 
 {0.8,2.22554092849},  
 
 {1.0,2.71828182846}}