Skip to content

func #

fn Fn.new #

fn Fn.new(f Fn) Fn

Fn.new returns an arbitrary function with parameters

fn FnFdf.new #

fn FnFdf.new(fn_fdf FnFdf) FnFdf

FnFdf.new returns an arbitrary function returning two values, r1, r2

fn FnVec.new #

fn FnVec.new(f FnVec) FnVec

FnVec.new returns an arbitrary vector-valued function with parameters

type ArbitraryFn #

type ArbitraryFn = fn (x f64, params []f64) f64

type DfFn #

type DfFn = fn (x f64, params []f64) f64

type FdfFn #

type FdfFn = fn (x f64, params []f64) (f64, f64)

type VectorValuedFn #

type VectorValuedFn = fn (x f64, y []f64, params []f64) f64

struct Fn #

struct Fn {
pub:
	f ArbitraryFn @[required]
mut:
	params []f64
}

Definition of an arbitrary function with parameters

fn (Fn) eval #

fn (f Fn) eval(x f64) f64

fn (Fn) safe_eval #

fn (f Fn) safe_eval(x f64) !f64

Call the pointed-to function with argument x, put its result in y, and return an error if the function value is inf/nan.

struct FnFdf #

struct FnFdf {
pub:
	f   ?ArbitraryFn
	df  ?DfFn
	fdf ?FdfFn
mut:
	params []f64
}

Definition of an arbitrary function returning two values, r1, r2

fn (FnFdf) eval_f #

fn (fdf FnFdf) eval_f(x f64) ?f64

fn (FnFdf) eval_df #

fn (fdf FnFdf) eval_df(x f64) ?f64

fn (FnFdf) eval_f_df #

fn (fdf FnFdf) eval_f_df(x f64) ?(f64, f64)

struct FnVec #

struct FnVec {
	f VectorValuedFn @[required]
mut:
	params []f64
}

Definition of an arbitrary vector-valued function with parameters

fn (FnVec) eval #

fn (f FnVec) eval(x f64, y []f64) f64