github.com/Daniel-M/odeint (go): Package odeint implements Ordinary Differential Equations integrators. for initial value problems to be solved by explicit methods. The package features methods for the standard library types,  The methods implemented so far are,  * Euler  * Mid point  * Runge-Kutta 4  The package is easily extensible to provide other methods, you can follow the template files as reference,  The integrator can be used to integrate the ODE for the harmonic oscillator.  which can be decomposed as the system,  If we want to solve the system using float32, we must import the adequate subpackage,  So we begin by defining the system of coupled differential equations  declare the state and parameters variables,  Putting the inital conditions  And the parameters  We create an instance of the system,  And an instance of the integrator with Midpoint method,  Set the system to the integrator before integrating the system  And finally we integrate within a loop  The code above will print the data columns to the standard output. To write to a file you could create a file with  and write to it with  where w implements the interface  There are more examples at the examples path  A subpackage for each numeric type?  You might be thinking, why does this guy have a subpackage for each numeric type? Well, though it makes the package harder to maintain, having type specific integrators is a priority for me. I could have used interface-based integrators but it would be at the expense of the extensibility of the integrators to more custom numerical types, a feature which I find relevant too.  This code is licensed under MIT license that can be found in the LICENSE file as,  And at the begining of the source code files as the fragment,
Keywords: go|golang|integrator|numerical-integration|numerical-methods|ode-solver|ordinary-differential-equations|solver