dbf

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

README

Gosl. dbf. Database of functions of a scalar and a vector like f(t,{x}) (e.g. time-space)

go.dev reference

More information is available in the documentation of this package.

Some functions of scalar and vector

  1. add -- addition
  2. cdist -- circle distance
  3. cos -- cosine
  4. cte -- constant
  5. exc1 -- excitation 1
  6. exc2 -- excitation 2
  7. halo -- halo
  8. lin -- linear
  9. mul -- multiplication
  10. pts -- points
  11. pulse -- pulse 1
  12. ref-dec-gen -- reference decreasing generic
  13. ref-dec-sp1 -- reference decreasing special 1
  14. ref-inc-rl1 -- reference increasing: right-to-left
  15. rmp -- ramp
  16. srmps -- smooth-ramp-smooth
1 add – Addition

Addition
2 cdist – Circle distance

Circle distance
3 cos – Cosine

Cosine
4 cte – Constant

Constant
5 exc1 – Excitation 1

Excitation 1
6 exc2 – Excitation 2

Excitation 2
7 halo – Halo

Halo
8 lin – Linear

Linear
9 mul – Multiplication

Multiplication
10 pts – Points

Points
11 pulse – Pulse 1

Pulse 1
12 ref-dec-gen – Reference decreasing generic

Reference decreasing generic
13 ref-dec-sp1 – Reference decreasing special 1

Reference decreasing special 1
14 ref-inc-rl1 – Reference increasing: right-to-left

Reference increasing: right-to-left
15 rmp – Ramp

Ramp
16 srmps – Smooth-ramp-smooth

Smooth-ramp-smooth

Documentation

Overview

Package dbf implements a database of f(t,{x}) functions (e.g. time-space functions). The functions in this package are accompanied by derivatives w.r.t t and gradients w.r.t {x}. For instance: g(t,{x}) = df/dt, h(t,{x}) = dg/dt, and grad = df/d{x}

Index

Constants

This section is empty.

Variables

View Source
var One = Cte{1}

One implements an specialisation of Cte function that always returns one

Functions

func CheckDerivT

func CheckDerivT(tst *testing.T, o T, t0, tf float64, xcte []float64, np int, tskip []float64, sktol, dtol, dtol2 float64, ver bool)

CheckDerivT checks derivatives w.r.t to t for fixed coordinates x

func CheckDerivX

func CheckDerivX(tst *testing.T, o T, tcte float64, xmin, xmax []float64, np int, xskip [][]float64, sktol, dtol float64, ver bool)

CheckDerivX checks derivatives w.r.t to x for fixed t

func PlotT

func PlotT(o T, dirout, fnkey string, t0, tf float64, xcte []float64, np int)

PlotT plots F, G and H for varying t and fixed coordinates x

fnkey       -- filename key (without extension)
args{F,G,H} -- if any is "", the corresponding plot is not created

func PlotX

func PlotX(o T, dirout, fnkey string, tcte float64, xmin, xmax []float64, np int)

PlotX plots F and the gradient of F, Gx and Gy, for varying x and fixed t

hlZero  -- highlight F(t,x) = 0
axEqual -- use axis['equal']

Types

type Add

type Add struct {
	Fa, Fb T
	A, B   float64
}

Add implements the addition of two other functions.

F(t, x) := A*Fa(t,x) + B*Fb(t,x)

func (Add) F

func (o Add) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Add) G

func (o Add) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Add) Grad

func (o Add) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Add) H

func (o Add) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Add) Init

func (o *Add) Init(prms Params)

Init initialises the function

type Cdist

type Cdist struct {
	// contains filtered or unexported fields
}

Cdist implements the distance from point to a circle (2D) or a sphere (3D) where the circle/sphere is implicitly defined by means of F(x) = 0.

where
  F(x) = sqrt((x-xc) dot (x-xc)) - r
with r being the radius and xc the coordinates of the centre.
Thus F > 0 is outside and F < 0 is inside the circle/sphere

func (Cdist) F

func (o Cdist) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Cdist) G

func (o Cdist) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Cdist) Grad

func (o Cdist) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Cdist) H

func (o Cdist) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Cdist) Init

func (o *Cdist) Init(prms Params)

Init initialises the function

type Cos

type Cos struct {

	// parameters
	A float64
	B float64
	C float64
	// contains filtered or unexported fields
}

Cos implements y(t) = a * cos(b*t) + c Input:

b/pi -- is a flag that says that b is in fact b divided by π
        thus, the code will multiply b by π internally

func (Cos) F

func (o Cos) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Cos) G

func (o Cos) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Cos) Grad

func (o Cos) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Cos) H

func (o Cos) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Cos) Init

func (o *Cos) Init(prms Params)

Init initialises the function

type Cte

type Cte struct {
	C float64
}

Cte implements a constant function

var Zero Cte

Zero implements an specialisation of Cte function that always returns zero

func (Cte) F

func (o Cte) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Cte) G

func (o Cte) G(t float64, x []float64) float64

G computes the first derivative G returns ∂y/∂t_cteX = G(t, x)

func (Cte) Grad

func (o Cte) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Cte) H

func (o Cte) H(t float64, x []float64) float64

H computes the second derivative H returns ∂²y/∂t²_cteX = H(t, x)

func (*Cte) Init

func (o *Cte) Init(prms Params)

Init initialises the function

type CutSin

type CutSin struct {

	// parameters
	A float64
	B float64
	C float64
	// contains filtered or unexported fields
}

CutSin implements a sine function such as:

if find["cps"]: # means cut_positive is True
	if y < 0: y(t) = a * sin(b*t) + c
 	else: y(t) = 0
else:			# means cut_positive is False so cut negative values
	if y > 0: y(t) = a * sin(b*t) + c
 	else: y(t) = 0

Input:

b/pi -- is a flag that says that b is in fact b divided by π
        thus, the code will multiply b by π internally

func (CutSin) F

func (o CutSin) F(t float64, x []float64) float64

F returns y = F(t, x)

func (CutSin) G

func (o CutSin) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (CutSin) Grad

func (o CutSin) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (CutSin) H

func (o CutSin) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*CutSin) Init

func (o *CutSin) Init(prms Params)

Init initialises the function

type Exc1

type Exc1 struct {
	A, B float64
}

Exc1 implements excitation #1 y(t) = a * (1 - cos(b*π*t)) / 2

func (Exc1) F

func (o Exc1) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Exc1) G

func (o Exc1) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Exc1) Grad

func (o Exc1) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Exc1) H

func (o Exc1) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Exc1) Init

func (o *Exc1) Init(prms Params)

Init initialises the function

type Exc2

type Exc2 struct {
	Ta float64
	A  float64
	B  float64
}

Exc2 implements excitation # 2: y(t) = if t < ta a*sin(b*π*t), else 0

func (Exc2) F

func (o Exc2) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Exc2) G

func (o Exc2) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Exc2) Grad

func (o Exc2) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Exc2) H

func (o Exc2) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Exc2) Init

func (o *Exc2) Init(prms Params)

Init initialises the function

type Halo

type Halo struct {
	// contains filtered or unexported fields
}

Halo implements the equation of a circle in 2D or a sphere in 3D by means of the following implicit form F(x) = 0

where
  F(x) = (x-xc) dot (x-xc) - r^2
with r being the radius and xc the coordinates of the centre.
Thus F > 0 is outside and F < 0 is inside the circle/sphere

func (Halo) F

func (o Halo) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Halo) G

func (o Halo) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Halo) Grad

func (o Halo) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Halo) H

func (o Halo) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Halo) Init

func (o *Halo) Init(prms Params)

Init initialises the function

type Lin

type Lin struct {
	M  float64 // slope
	Ts float64 // shift
}

Lin implements a linear function w.r.t t

y = m * (t - ts)

func (Lin) F

func (o Lin) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Lin) G

func (o Lin) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Lin) Grad

func (o Lin) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Lin) H

func (o Lin) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Lin) Init

func (o *Lin) Init(prms Params)

Init initialises the function

type Mul

type Mul struct {
	Fa, Fb T
}

Mul implements the multiplication of two other functions.

F(t, x) := fa(t,x) * fb(t,x)

func (Mul) F

func (o Mul) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Mul) G

func (o Mul) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Mul) Grad

func (o Mul) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Mul) H

func (o Mul) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Mul) Init

func (o *Mul) Init(prms Params)

Init initialises the function

type P

type P struct {

	// input
	N      string  `json:"n"`      // name of parameter
	V      float64 `json:"v"`      // value of parameter
	Min    float64 `json:"min"`    // min value
	Max    float64 `json:"max"`    // max value
	S      float64 `json:"s"`      // standard deviation
	D      string  `json:"d"`      // probability distribution type
	U      string  `json:"u"`      // unit (not verified)
	Adj    int     `json:"adj"`    // adjustable: unique ID (greater than zero)
	Dep    int     `json:"dep"`    // depends on "adj"
	Extra  string  `json:"extra"`  // extra data
	Inact  bool    `json:"inact"`  // parameter is inactive in optimisation
	SetDef bool    `json:"setdef"` // tells model to use a default value

	// auxiliary
	Fcn   T  // a function y=f(t,x)
	Other *P // dependency: connected parameter
	// contains filtered or unexported fields
}

P holds numeric parameters defined by a name N and a value V.

P is convenient to store the range of allowed values in Min and Max, and other information such as standard deviation S, probability distribution type D, among others.

Dependent variables may be connected to P using Connect so when Set is called, the dependendt variable is updated as well.

Other parameters can be linked to this one via the Other data member and Fcn may be useful to compute y=f(t,x)

func (*P) Connect

func (o *P) Connect(V *float64)

Connect connects parameter to variable

func (*P) Set

func (o *P) Set(V float64)

Set sets parameter, including connected variables

type Params

type Params []*P

Params holds many parameters

A set of Params can be initialized as follows:

  var params Params
  params = []*P{
      {N: "klx", V: 1.0},
      {N: "kly", V: 2.0},
      {N: "klz", V: 3.0},
  }

Alternatively, see NewParams function

func NewParams added in v1.1.0

func NewParams(pp ...interface{}) (o Params)

NewParams returns a set of parameters

This is an alternative to initializing Params by setting slice items

A set of Params can be initialized as follows:

  params := NewParams(
      &P{N: "P1", V: 1},
      &P{N: "P2", V: 2},
      &P{N: "P3", V: 3},
  )

Alternatively, you may set slice components directly (see Params definition)

func (*Params) CheckAndGetValues

func (o *Params) CheckAndGetValues(names []string) (values []float64)

CheckAndGetValues check min/max limits and return values. Will panic if values are outside corresponding min/max range. Will also panic if a parameter name is not found.

func (*Params) CheckAndSetVariables added in v1.1.0

func (o *Params) CheckAndSetVariables(names []string, variables []*float64)

CheckAndSetVariables get parameter values and check limits defined in Min and Max Will panic if values are outside corresponding Min/Max range. Will also panic if a parameter name is not found.

func (*Params) CheckLimits

func (o *Params) CheckLimits()

CheckLimits check limits of variables given in Min/Max Will panic if values are outside corresponding Min/Max range.

func (*Params) Connect

func (o *Params) Connect(V *float64, name, caller string) (errorMessage string)

Connect connects parameter

func (*Params) ConnectSet

func (o *Params) ConnectSet(V []*float64, names []string, caller string) (errorMessage string)

ConnectSet connects set of parameters

func (*Params) ConnectSetOpt added in v1.0.1

func (o *Params) ConnectSetOpt(V []*float64, names []string, optional []bool, caller string) (errorMessage string)

ConnectSetOpt connects set of parameters with some being optional

func (*Params) Find

func (o *Params) Find(name string) *P

Find finds a parameter by name

Note: returns nil if not found

func (*Params) GetBool added in v1.1.0

func (o *Params) GetBool(name string) bool

GetBool reads Boolean parameter or Panic Returns true if P[name] > 0; otherwise returns false Will panic if name does not exist in parameters set

func (*Params) GetBoolOrDefault added in v1.1.0

func (o *Params) GetBoolOrDefault(name string, defaultValue bool) bool

GetBoolOrDefault reads Boolean parameter or returns default value Returns true if P[name] > 0; otherwise returns false Will return defaultValue if name does not exist in parameters set

func (*Params) GetIntOrDefault added in v1.1.0

func (o *Params) GetIntOrDefault(name string, defaultInt int) int

GetIntOrDefault reads parameter or returns default value Will return defaultInt if name does not exist in parameters set

func (*Params) GetValue added in v1.1.0

func (o *Params) GetValue(name string) float64

GetValue reads parameter or Panic Will panic if name does not exist in parameters set

func (*Params) GetValueOrDefault added in v1.1.0

func (o *Params) GetValueOrDefault(name string, defaultValue float64) float64

GetValueOrDefault reads parameter or returns default value Will return defaultValue if name does not exist in parameters set

func (*Params) GetValues

func (o *Params) GetValues(names []string) (values []float64, found []bool)

GetValues get parameter values

func (*Params) SetBool added in v1.1.0

func (o *Params) SetBool(name string, value float64)

SetBool sets Boolean parameter or Panic Sets +1==true if value > 0; otherwise sets -1==false Will panic if name does not exist in parameters set

func (*Params) SetValue added in v1.1.0

func (o *Params) SetValue(name string, value float64)

SetValue sets parameter or Panic Will panic if name does not exist in parameters set

func (Params) String

func (o Params) String() (l string)

String returns a summary of parameters

type Pts

type Pts struct {
	// contains filtered or unexported fields
}

Pts is a function based on a linear interpolation over a set of points

func (Pts) F

func (o Pts) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Pts) G

func (o Pts) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Pts) Grad

func (o Pts) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Pts) H

func (o Pts) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Pts) Init

func (o *Pts) Init(prms Params)

Init initialises the function

type Pulse

type Pulse struct {
	Ca float64
	Cb float64
	Ta float64
	Tb float64
}

Pulse implements a ramp function

func (Pulse) F

func (o Pulse) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Pulse) G

func (o Pulse) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Pulse) Grad

func (o Pulse) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Pulse) H

func (o Pulse) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Pulse) Init

func (o *Pulse) Init(prms Params)

Init initialises the function

type RefDecGen

type RefDecGen struct {
	A, B float64 // lambda function coeficients
	// contains filtered or unexported fields
}

RefDecGen implements the reference decreasing model (general)

[1] Pedroso DM, Sheng D, Zhao J. The concept of reference curves for constitutive modelling in soil mechanics, Computers and Geotechnics, 36, 1-2, http://dx.doi.org/10.1016/j.compgeo.2008.01.009

func (RefDecGen) F

func (o RefDecGen) F(t float64, x []float64) float64

F returns y = F(t, x)

func (RefDecGen) G

func (o RefDecGen) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (RefDecGen) Grad

func (o RefDecGen) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (RefDecGen) H

func (o RefDecGen) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*RefDecGen) Init

func (o *RefDecGen) Init(prms Params)

Init initialises the function

type RefDecSp1

type RefDecSp1 struct {
	// contains filtered or unexported fields
}

RefDecSp1 implements a specialisation of the reference decreasing model

[1] Pedroso DM, Sheng D, Zhao J. The concept of reference curves for constitutive modelling in soil mechanics, Computers and Geotechnics, 36, 1-2, http://dx.doi.org/10.1016/j.compgeo.2008.01.009

              y ^
                |
             ya o
                | \
                |
                |   \
                |
    ------------+-------------------------> x
                |
             yb o--._ -\-------- λ0 = 0
                |    `.
                |      \\
                |       .
                |        \
                |         \---
                |          \ | λ1
                |           \|
                |            \
                |
                |

func (RefDecSp1) F

func (o RefDecSp1) F(t float64, x []float64) float64

F returns y = F(t, x)

func (RefDecSp1) G

func (o RefDecSp1) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (RefDecSp1) Grad

func (o RefDecSp1) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (RefDecSp1) H

func (o RefDecSp1) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*RefDecSp1) Init

func (o *RefDecSp1) Init(prms Params)

Init initialises the model

type RefIncRL1

type RefIncRL1 struct {
	// contains filtered or unexported fields
}

RefIncRL1 implements a specialisation of the reference increasing model Reference concept model: dydx growth but solved from right to left with right-most initial point @ x,y=1,1 with (0 <= x <= 1) Flipped model is also available if λ1 < λ0 ( b == 1 )

func (RefIncRL1) F

func (o RefIncRL1) F(t float64, x []float64) float64

F returns y = F(t, x)

func (RefIncRL1) G

func (o RefIncRL1) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (RefIncRL1) Grad

func (o RefIncRL1) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (RefIncRL1) H

func (o RefIncRL1) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*RefIncRL1) Init

func (o *RefIncRL1) Init(prms Params)

Init initialises the model

type Rmp

type Rmp struct {
	Ca float64
	Cb float64
	Ta float64
	Tb float64
}

Rmp implements a ramp function

func (Rmp) F

func (o Rmp) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Rmp) G

func (o Rmp) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Rmp) Grad

func (o Rmp) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Rmp) H

func (o Rmp) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Rmp) Init

func (o *Rmp) Init(prms Params)

Init initialises the function

type Sin

type Sin struct {

	// parameters
	A float64
	B float64
	C float64
	// contains filtered or unexported fields
}

Sin implements y(t) = a * sin(b*t) + c Input:

b/pi -- is a flag that says that b is in fact b divided by π
        thus, the code will multiply b by π internally

func (Sin) F

func (o Sin) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Sin) G

func (o Sin) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Sin) Grad

func (o Sin) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Sin) H

func (o Sin) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Sin) Init

func (o *Sin) Init(prms Params)

Init initialises the function

type Srmps

type Srmps struct {
	Ca, Cb float64
	Ta, Tb float64
}

Srmps implements the increasing or decreasing smooth-ramp-smooth function

func (Srmps) F

func (o Srmps) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Srmps) G

func (o Srmps) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Srmps) Grad

func (o Srmps) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Srmps) H

func (o Srmps) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Srmps) Init

func (o *Srmps) Init(prms Params)

Init initialises the function

type T

type T interface {
	Init(prms Params)                         // initialise function parameters
	F(t float64, x []float64) float64         // y = F(t, x)
	G(t float64, x []float64) float64         // ∂y/∂t_cteX = G(t, x)
	H(t float64, x []float64) float64         // ∂²y/∂t²_cteX = H(t, x)
	Grad(v []float64, t float64, x []float64) // ∇F = ∂y/∂x = Grad(t, x)
}

T defines the interface for t-x functions; i.e. f(t, {x})

func New

func New(name string, prms Params) T

New allocates function by name

type Xpoly1

type Xpoly1 struct {
	// contains filtered or unexported fields
}

Xpoly1 implements F(x) as a 1st order polynomial with the components x[i]

functions:

  F(x) =  a0 x0  +  a1 x1  +  a2 x2

or, if '2D = true':

  F(x) =  a0 x0  +  a1 x1

func (Xpoly1) F

func (o Xpoly1) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Xpoly1) G

func (o Xpoly1) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Xpoly1) Grad

func (o Xpoly1) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Xpoly1) H

func (o Xpoly1) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Xpoly1) Init

func (o *Xpoly1) Init(prms Params)

Init initialises the function

type Xpoly2

type Xpoly2 struct {
	// contains filtered or unexported fields
}

Xpoly2 implements F(x) as a 2nd order polynomial with the components x[i]

functions:

  F(x) =  a0 x0    +  a1 x1    +  a2 x2
       +  b0 x0²   +  b1 x1²   +  b2 x2²
       + c01 x0 x1 + c12 x1 x2 + c20 x2 x0

or, if '2D = true':

  F(x) =  a0 x0    +  a1 x1
       +  b0 x0²   +  b1 x1²
       + c01 x0 x1

func (Xpoly2) F

func (o Xpoly2) F(t float64, x []float64) float64

F returns y = F(t, x)

func (Xpoly2) G

func (o Xpoly2) G(t float64, x []float64) float64

G returns ∂y/∂t_cteX = G(t, x)

func (Xpoly2) Grad

func (o Xpoly2) Grad(v []float64, t float64, x []float64)

Grad returns ∇F = ∂y/∂x = Grad(t, x)

func (Xpoly2) H

func (o Xpoly2) H(t float64, x []float64) float64

H returns ∂²y/∂t²_cteX = H(t, x)

func (*Xpoly2) Init

func (o *Xpoly2) Init(prms Params)

Init initialises the function

Jump to

Keyboard shortcuts

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