ode

package module
v0.0.0-...-0502445 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2017 License: MIT Imports: 0 Imported by: 2

README

ode

An ordinary differential equation solving library in golang.

Build Status Coverage Status goreport

Features

Numerical methods

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Integrable

type Integrable interface {
	GetState() []float64                   // Get the latest state of this integrable.
	SetState(t float64, s []float64)       // Set the state s of a given time t.
	Stop(t float64) bool                   // Return whether to stop the integration at time t.
	Func(t float64, s []float64) []float64 // ODE function from time t and state s, must return a new state.
}

Integrable defines something which can be integrated, i.e. has a state vector. WARNING: Implementation must manage its own state based on the iteration.

type RK4

type RK4 struct {
	X0        float64    // The initial x0.
	StepSize  float64    // The step size.
	Integator Integrable // What is to be integrated.
}

RK4 defines an RK4 integrator using math.Big Floats.

func NewRK4

func NewRK4(x0 float64, stepSize float64, inte Integrable) (r *RK4)

NewRK4 returns a new RK4 integrator instance.

func (*RK4) Solve

func (r *RK4) Solve() (uint64, float64, error)

Solve solves the configured RK4. Returns the number of iterations performed and the last X_i, or an error.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL