Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moritz/math-rungekutta
Runge-Kutta integration of ordinary differential equations with Perl 6
https://github.com/moritz/math-rungekutta
Last synced: 16 days ago
JSON representation
Runge-Kutta integration of ordinary differential equations with Perl 6
- Host: GitHub
- URL: https://github.com/moritz/math-rungekutta
- Owner: moritz
- Created: 2010-06-02T17:52:19.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2017-10-08T19:11:21.000Z (over 7 years ago)
- Last Synced: 2024-11-05T20:49:11.624Z (2 months ago)
- Language: Perl 6
- Homepage:
- Size: 21.5 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Introduction
Runge-Kutta integration for systems of ordinary, linear differential
equations.WARNING: this module is not yet thoroughly tested. Use it at your own risk.
Bug reports, tests and patches are welcome!Let's say you have a differential equation for the function f(t),
with the equationdf/dt = f(t)^2 + t
and the initial value f(t=0) = 1;
In the context of this module, we call df/dt the "derivative",
t the "parameter"You'd solve that numerically with this Perl 6 code:
# synopsis.pl
use Math::RungeKutta;
# function that calculates the derivative that
# Math::RungeKutta will integrate
sub d($t, @values) { @values[0]**2 + $t}
# that's a function that gets called with the
# current values after each integration step
sub callback($t, @values) { say "$t @values[0]" };
my @initial = 1;
adaptive-rk-integrate(
:from(0),
:to(0.5),
:@initial,
:derivative(&d),
:do(&callback)
);And then look at the result:
$ PERL6LIB=lib perl6 synopsis.pl | xmgrace -nxy -
The interfaces is inspired by Perl 5 module Math::RungeKutta, to be found at
.# Build Status
[![Build Status](https://travis-ci.org/moritz/Math-RungeKutta.svg)](https://travis-ci.org/moritz/Math-RungeKutta)
# License
This module is licensed under the [Artistic License version 2.0](https://opensource.org/licenses/Artistic-2.0).
Its accompanying tests and examples are public domain, as defined by the [CC0 1.0 Universal (CC0 1.0) Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/).