Documentation
¶
Index ¶
- func Brent(fn Diffable, x_lo, x_hi, epsAbs, epsRel float64) (float64, error)
- func DebugReport(on bool)
- func Derivative(fn vec.FnDim0, v vec.Vector, i int, h, epsabs float64) (float64, error)
- func Gradient(fn vec.FnDim0, v vec.Vector, h, epsabs float64) (vec.Vector, error)
- func Iterative(stages []DiffSystem, start []vec.Vector, epsAbs, epsRel []float64, ...) ([]vec.Vector, error)
- func MatrixToGSL(m []vec.Vector, target *C.gsl_matrix)
- func MultiDim(fn DiffSystem, start vec.Vector, epsAbs, epsRel float64) (vec.Vector, error)
- func OneDimDerivative(fn Func1D, x, h, epsAbs float64) (float64, error)
- func OneDimDiffRoot(f Func1D, start, epsAbs, epsRel float64) (float64, error)
- func Simple2ndDiff(f Func1D, x0, h float64) (float64, error)
- func SimpleFdf(F vec.FnDim0, Df vec.FnDim1) vec.FnDim0_1
- func SimpleMixed2ndDiff(f func(x, y float64) (float64, error), x0, y0, hx, hy float64) (float64, error)
- func VecFromGSL(v *C.gsl_vector) vec.Vector
- func VecToGSL(v vec.Vector, target *C.gsl_vector)
- type DiffSystem
- type Diffable
- type Func1D
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Derivative ¶
Numerical central derivative of fn(v) with respect to v_i within tolerance epsabs. h is the initial step size.
func Iterative ¶
func Iterative(stages []DiffSystem, start []vec.Vector, epsAbs, epsRel []float64, accept func([]vec.Vector)) ([]vec.Vector, error)
Solve each system in `stages` iteratively, starting with stages[0] and proceeding upward. After solving each stage, check if all previous stages are still solved. If they are not, return to stages[0]. `accept` should take a []Vector representing the current state of each stage and store it; this allows the stages to be coupled.
func MultiDim ¶
Multidimensional root-finder. Implemented by providing an interface to GSL implementation of Powell's Hybrid method (gsl_multiroot_fdfsolver_hybridsj). Callback passing through cgo follows the model at: http://stackoverflow.com/questions/6125683/call-go-functions-from-c/6147097#6147097
func OneDimDerivative ¶
Derivative of `fn` at `x` to precision `espAbs`; use initial step size `h`
func OneDimDiffRoot ¶
Find a root for `f` near `start` using a first-derivative based solver (the derivative is found automatically).
func Simple2ndDiff ¶
Three-point algorithm for second derivative of f(x) at x0. Error ~ h^2.
Types ¶
type DiffSystem ¶
type DiffSystem struct {
F vec.FnDim1
Df func(vec.Vector) ([]vec.Vector, error)
Fdf func(vec.Vector) (vec.Vector, []vec.Vector, error)
NumFuncs int // length of F output vector and Df slice
Dimension int // length of input vectors and Df output vector
}
System of functions plus first derivatives.
func Combine ¶
func Combine(fns []Diffable) DiffSystem
Combine fns into one function, suitable for passing to MultiDim. All funcs passed in must have the same dimension.