Math::Lsoda - Solve ordinary differential equation systems using lsoda.
use Math::Lsoda;
Equation:
sub eqns { my ($t, $x, $y) = @_; @$y[0] = 1.0e+4 * @$x[1] * @$x[2] - 0.04 * @$x[0]; @$y[2] = 3.0e+7 * @$x[1] * @$x[1]; @$y[1] = -(@$y[0] + @$y[2]); }
Solver:
my $solver = Math::Lsoda->new(equation => \&eqns, initial => [1.0, 0.0, 0.0], start => 0.0, end => 100.0, dt => 0.1, relative_tolerance => [1.0e-4, 1.0e-8, 1.0e-4], absolute_tolerance => [1.0e-6, 1.0e-10,1.0e-6], filename => 'file.dat');
Math::Lsoda is a numerical module used for solving ordinary differential equations. The module is suitable for both stiff and non-stiff systems using the FORTRAN library odepack.
Naoya Sato <synclover@gmail.com>
A. C. Hindmarsh, "ODEPACK, A Systematized Collection of ODE Solvers," in Scientific Computing, R. S. Stepleman et al., North-Holland, Amsterdam, 1983 pp. 55-64.
K. Radhakrishnan and A. C. Hindmarsh, "Description and Use of LSODE, the Livermore Solver for Ordinary Differential Equations," LLNL report UCRL-ID-113855, December 1993.
Copyright (c) 2010 Naoya Sato.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Math::Lsoda, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Lsoda
CPAN shell
perl -MCPAN -e shell install Math::Lsoda
For more information on module installation, please visit the detailed CPAN module installation guide.