solver

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Euler

type Euler struct {
	F func(x, y float64) (float64, error) // calculator for f(x,y) = y'
}

Euler method for solving initial value problem for differential equations

func (*Euler) Solve

func (e *Euler) Solve(stepSize, x0, y0, xEnd float64) (num.Line, error)

Solve the initial value problem with Euler method

type Exact

type Exact struct {
	// F is a function y(x) = f(x), the solution for the initial value problem,
	// requires a constant, that is calculated with initial values
	F func(x, c float64) (float64, error)
	// C calculates the constant for the F
	C func(x0, y0 float64) (float64, error)
}

Exact solver just draws the exact solution directly, without applying any specific algorithm

func (*Exact) Solve

func (e *Exact) Solve(stepSize, x0, y0, xEnd float64) (num.Line, error)

Solve just plots the graph, without applying any algorithm

type ImprovedEuler

type ImprovedEuler struct {
	F func(x, y float64) (float64, error) // calculator for f(x,y) = y'
}

ImprovedEuler method for solving initial value problem for differential equations

func (*ImprovedEuler) Solve

func (i *ImprovedEuler) Solve(stepSize, x0, y0, xEnd float64) (num.Line, error)

Solve the differential equations with the given initial data

type Interface

type Interface interface {
	Solve(stepSize, x0, y0, xEnd float64) (line num.Line, err error)
}

Interface describes methods that the solver should implement in order to solve the Initial Value problem

type RungeKutta

type RungeKutta struct {
	F func(x, y float64) (float64, error) // calculator for f(x,y) = y'
}

RungeKutta method for solving initial value problem for differential equations

func (*RungeKutta) Solve

func (r *RungeKutta) Solve(stepSize, x0, y0, xEnd float64) (num.Line, error)

Solve the differential equation with the given initial values

Jump to

Keyboard shortcuts

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