help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Numerical Methods


From: Ben Sapp
Subject: Re: Numerical Methods
Date: Fri, 28 Jan 2000 08:20:12 -0700

Claudio Tellez wrote:
> 
> Please,
> 
> Does anyone know about how to solve EDOs and EDPs numerically using Octave? > 
> For example, in matlab I usually work with "ode23" (Runge Kutta), but I've > 
> not found >any similar in octave yet.

Marc Compare released a number of Runge Kutta implementations in the
octave_ode_solvers_v1.0 package.   I do not know where it is officially
located but if you want octave_ode_solvers_v1.0 I still have a copy and
will put it on the web for download at your request.   I have atteached
the readme that comes with it.  

-- 
Ben Sapp                         Los Alamos National Laboratory
email: <mailto:address@hidden>   Phone: (505)667-3277
Fax:   (505)665-7920             URL:   http://www.neutrino.lanl.gov/
--
This is the readme.txt file for octave_ode_solvers version 1.0.

This directory contains 8 files that provide an octave user with
several options for numerically integrating ode.
There are 3 fixed-step Runge-Kutta algorithms and
3 variable step Runge-Kutta-Fehlberg algorithms.

----------------------------------------------------------------------
The archive octave_ode_solvers_v1.0.tar.gz should contain:

   - ode23.m    : variable step, 2nd-3rd order, Runge-Kutta, single-step method
   - ode45.m    : variable step, 4th-5th order, Runge-Kutta, single-step method
   - ode78.m    : variable step, 7th-8th order, Runge-Kutta, single-step method

   - rk2fixed.m : fixed step, 2nd order, Runge-Kutta, single-step method
   - rk4fixed.m : fixed step, 4th order, Runge-Kutta, single-step method
   - rk8fixed.m : fixed step, 8th order, Runge-Kutta, single-step method

   - pendulum.m : a sample m-file script that runs all solvers
   - penddot.m  : derivative function file, returning dy/dt for a simple 
pendulum
   - readme.txt : this file

----------------------------------------------------------------------
Steps for testing these ode solvers in octave version 2.0.14,
from a unix shell:

(1) unzip and untar the archive:
        gunzip octave_ode_solvers.tar.gz
        tar xvf octave_ode_solvers.tar
(2) change directories into the newly created directory and start octave
        cd octave_ode_solvers
        octave
(3) run the sample pemdulum script that will sequentially run all integrators
        pendulum

----------------------------------------------------------------------
I've made an effort to make these portable to most octave installations
as well as for use in most Matlab versions.  These work with no modification
in Matlab v5.2.  If you want to use these in Matlab, however,
you'll do yourself a favor by renaming ode45.m and ode23.m to something else,
like ode45_octave.m and ode23_octave.m.  This is because Matlab already has
two integrators named ode45 and ode23.
Don't forget to change the function names inside ode45_octave.m and
ode23_octave.m as well.

Not much effort has been made to create ode45 or ode23 with the same argument
structure as their Matlab counterparts.  Feel free to change them and 
redistribute
as you see fit.  You are welcome to mail me for useful changes I (may) make
and continue to distribute from the same ftp site.

In general, the higher the integration order, the smaller the local 
error is at each time step.  This is demonstrated by ode78 generating far fewer
steps for solving the same problem over the same time interval with the same 
error
criterion as ode23.
The cost of the higher order solvers is the number of function evaluations.

   - ode23.m    : requires 3 function evaluations per step
   - ode45.m    : requires 6 function evaluations per step
   - ode78.m    : requires 13 function evaluations per step

   - rk2fixed.m : requires 2 function evaluations per step
   - rk4fixed.m : requires 4 function evaluations per step
   - rk8fixed.m : requires 13 function evaluations per step

If you get to looking at pendulum.m, try turning on the 'trace' variable
for screen output.  This slows things down, though.

----------------------------------------------------------------------
Two of the original files rk4fixed.m and ode78.m came from other
people.  rk4fixed.m was written by:
     Dr. Raul Longoria, Dept. of Mechanical Engineering,
     The Univ. of Texas at Austin and
ode78.m was originally written by:
     Dr. Howard Wilson & 
     Daljeet Singh, Dept. Of Electrical Engineering,
     The University of Alabama

The other files were created from the structure of these 
along with coefficients from standard numerical methods books.
Dr. Longoria has given permission to redistribute rk4fixed.m.

ode78.m was origianlly found at:
ftp://ftp.mathworks.com/pub/contrib/v4/diffeq/ode78.m.
& I am redistributing a modified version with Dr. Wilson's
permission.  

Numerous applications in ordinary and partial differential equations
can be found in Dr. Wilson's text:

     Howard Wilson and Louis Turcotte, 'Advanced Mathematics and 
     Mechanics Applications Using MATLAB', 2nd Ed, CRC Press, 1997

----------------------------------------------------------------------

Bug's or changes or comments should be directed to the email address
below.

Marc Compere
address@hidden
6 October 1999

reply via email to

[Prev in Thread] Current Thread [Next in Thread]