Solver:

Filter: Extension

numerical solver of systems of Ordinary Differential Equations of any order

Solver is the base class to inherit from to implement numerical solving methods for ODEs.

Part of MathLib, a diverse library of mathematical functions.

WARNING: This class can be quite cpu intensive and with small dt values can completly freeze supercollider. ODE's of higher order are solved by converting them to systems of equations of the first order.

y' = F(t,y)

where F:RxR -> R and y = y(t) and y' the derivative of f.

Systems of equations take the form:

dy1/dt = F1(t,y1) ... dyn/dt = Fn(t,yn)

or in vector form:

DY = F^(t,Y)

where F^ = { F1,...,Fn}, Y = { Y1,...,Yn}, and DY is the jacobian matrix of Y.

y = F(t,y,dy/dt,...,dNy/dtN)

and Systems of M equation of order N take the form;

dNy1/dtN = F1(t,y,dy1/dt,...,dN-1y1/dtN-1) ... dNyM/dtN = FM(t,y,dyM/dt,...,dN-1yM/dtN-1)

or in vector form

DY = F^(t,Y,DY,...,DNY)

Create a solver for a one dimensional equation or system of equations.

f |
see -f below |

dt |
calculation time step in seconds |

t |
initial time |

y |
initial position: a number or array of numbers |

Create a solver for a higher dimensional equation or system of equations.

f |
see -f below |

dt |
calculation time step in seconds |

t |
initial time |

y |
initial position: a number or array of numbers |

Set or return the order of the ODE

f is the function F defining the equation DY = F^(t,Y,DY,...,DNY), and can take the following forms:

D ODE | { |t,y| ... } |

System of 1D ODEs | [{ |t,y| ... },...,{ |t,y| ... }] |

N-order ODE | { |t,y,dy,..., dN-1y| ... } |

System of M, N-order ODEs | [{ |t,y,dy1,..., dN-1y1,...,dyM,..., dN-1yM| ... } ,...,{ |t,y,dy1,..., dN-1y1,...,dyM,..., dN-1yM| ... }] |

Set or return calculation time step in seconds

Set or return time in seconds

It can take the following forms:

1D ODE | y |

System of 1D ODEs | [y1,...,yn] |

N-order ODE | [y,dy,..., dN-1y] |

System of M, N-order ODEs | [[y1,dy1,..., dN-1y1],...,[yM,dy1,..., dN-1yM]] |

The value can be reset and the calculation will continue from there.

Get the next value from the solver.

In general this will be: [[y1,y'1,...,y1^(n-1)],...,[yM,y'M,...,yM^(n-1)]]

Miguel Negro, 2009.

helpfile source: /Library/Application Support/SuperCollider/downloaded-quarks/MathLib/HelpSource/Classes/Solver.schelp

link::Classes/Solver::

link::Classes/Solver::