in reply to How to define equations for Math::RungeKutta?

You don't exactly write down the equation, but you write a piece of perl code that evaluates the equation.

If your system of equations is of this form:

f'(x) = x * y g'(x) = x + y;

You write in your program:

sub dydt { my ($t, $x, $y) = @_; return ($x * $y, $x + $y); }

And then proceed as the example in the docs shows.

Math::RungeKutta doesn't deal with symbolic equations, but expects you to do the evaluation instead.

Replies are listed 'Best First'.
Re^2: How to define equations for Math::RungeKutta?
by hda (Chaplain) on Nov 02, 2008 at 21:08 UTC
    Thanks! That's what I needed!