Documentation ¶
Overview ¶
Package symexpr implements symbolic equations as an AST. It aims to provide ease of dynamic manipulation of the tree.
This work comes out of my Masters thesis at Binghamton University and is geared towards Symbolic Regression.
Index ¶
- func DumpExprTypes()
- func PRK4(xn int, eqn Expr, ti, tj float64, x_in, x_out, x_tmp, c, s []float64) float64
- func PrintPRK4(xn int, eqn Expr, ti, to float64, x_in, x_out, x_tmp, c, s []float64) float64
- func RK4(eqn []Expr, ti, tj float64, x_in, x_tmp, c, s []float64) (x_out []float64)
- type Abs
- func (u *Abs) AmIAlmostSame(r Expr) bool
- func (u *Abs) AmIEqual(r Expr) bool
- func (u *Abs) AmILess(r Expr) bool
- func (u *Abs) AmISame(r Expr) bool
- func (u *Abs) Clone() Expr
- func (u *Abs) ConvertToConstantFs(cs []float64) Expr
- func (u *Abs) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (u *Abs) DerivConst(i int) Expr
- func (u *Abs) DerivVar(i int) Expr
- func (u *Abs) Eval(t float64, x, c, s []float64) float64
- func (u *Abs) ExprType() ExprType
- func (u *Abs) GetExpr(pos *int) Expr
- func (u *Abs) Javascript(dnames, snames []string, cvals []float64) string
- func (u *Abs) Latex(dnames, snames []string, cvals []float64) string
- func (u *Abs) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (u *Abs) Serial(sofar []int) []int
- func (u *Abs) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (u *Abs) Simplify(rules SimpRules) (ret Expr)
- func (u *Abs) Sort()
- func (u *Abs) StackSerial(sofar []int) []int
- func (u *Abs) String() string
- type Add
- func (n *Add) AmIAlmostSame(r Expr) bool
- func (n *Add) AmIEqual(r Expr) bool
- func (n *Add) AmILess(r Expr) bool
- func (n *Add) AmISame(r Expr) bool
- func (n *Add) Clone() Expr
- func (n *Add) ConvertToConstantFs(cs []float64) Expr
- func (n *Add) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (n *Add) DerivConst(i int) Expr
- func (n *Add) DerivVar(i int) Expr
- func (n *Add) Eval(t float64, x, c, s []float64) float64
- func (n *Add) ExprType() ExprType
- func (n *Add) GetExpr(pos *int) Expr
- func (a *Add) Insert(e Expr)
- func (n *Add) Javascript(dnames, snames []string, cvals []float64) string
- func (n *Add) Latex(dnames, snames []string, cvals []float64) string
- func (n *Add) Len() int
- func (n *Add) Less(i, j int) bool
- func (n *Add) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (n *Add) Serial(sofar []int) []int
- func (n *Add) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (n *Add) Simplify(rules SimpRules) Expr
- func (n *Add) Sort()
- func (n *Add) StackSerial(sofar []int) []int
- func (n *Add) String() string
- func (n *Add) Swap(i, j int)
- type Binary
- type Constant
- func (c *Constant) AmIAlmostSame(r Expr) bool
- func (c *Constant) AmIEqual(r Expr) bool
- func (c *Constant) AmILess(r Expr) bool
- func (c *Constant) AmISame(r Expr) bool
- func (c *Constant) Clone() Expr
- func (c *Constant) ConvertToConstantFs(cs []float64) Expr
- func (c *Constant) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (c *Constant) DerivConst(i int) Expr
- func (cnst *Constant) Eval(t float64, x, c, s []float64) float64
- func (c *Constant) ExprType() ExprType
- func (c *Constant) GetExpr(pos *int) Expr
- func (c *Constant) HasConst() bool
- func (c *Constant) HasConstI(i int) bool
- func (c *Constant) Javascript(dnames, snames []string, cvals []float64) string
- func (c *Constant) Latex(dnames, snames []string, cvals []float64) string
- func (c *Constant) NumConstants() int
- func (c *Constant) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (c *Constant) Serial(sofar []int) []int
- func (c *Constant) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (c *Constant) Simplify(rules SimpRules) Expr
- func (c *Constant) Sort()
- func (c *Constant) StackSerial(sofar []int) []int
- func (c *Constant) String() string
- type ConstantF
- func (c *ConstantF) AmIAlmostSame(r Expr) bool
- func (c *ConstantF) AmIEqual(r Expr) bool
- func (c *ConstantF) AmILess(r Expr) bool
- func (c *ConstantF) AmISame(r Expr) bool
- func (c *ConstantF) Clone() Expr
- func (c *ConstantF) ConvertToConstantFs(cs []float64) Expr
- func (c *ConstantF) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (cnst *ConstantF) Eval(t float64, x, c, s []float64) float64
- func (c *ConstantF) ExprType() ExprType
- func (c *ConstantF) GetExpr(pos *int) Expr
- func (c *ConstantF) HasConst() bool
- func (c *ConstantF) HasConstI(i int) bool
- func (c *ConstantF) Javascript(dnames, snames []string, cvals []float64) string
- func (c *ConstantF) Latex(dnames, snames []string, cvals []float64) string
- func (c *ConstantF) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (c *ConstantF) Serial(sofar []int) []int
- func (c *ConstantF) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (c *ConstantF) Simplify(rules SimpRules) Expr
- func (c *ConstantF) Sort()
- func (c *ConstantF) StackSerial(sofar []int) []int
- func (c *ConstantF) String() string
- type Cos
- func (u *Cos) AmIAlmostSame(r Expr) bool
- func (u *Cos) AmIEqual(r Expr) bool
- func (u *Cos) AmILess(r Expr) bool
- func (u *Cos) AmISame(r Expr) bool
- func (u *Cos) Clone() Expr
- func (u *Cos) ConvertToConstantFs(cs []float64) Expr
- func (u *Cos) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (u *Cos) DerivConst(i int) Expr
- func (u *Cos) DerivVar(i int) Expr
- func (u *Cos) Eval(t float64, x, c, s []float64) float64
- func (u *Cos) ExprType() ExprType
- func (u *Cos) GetExpr(pos *int) Expr
- func (u *Cos) Javascript(dnames, snames []string, cvals []float64) string
- func (u *Cos) Latex(dnames, snames []string, cvals []float64) string
- func (u *Cos) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (u *Cos) Serial(sofar []int) []int
- func (u *Cos) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (u *Cos) Simplify(rules SimpRules) (ret Expr)
- func (u *Cos) Sort()
- func (u *Cos) StackSerial(sofar []int) []int
- func (u *Cos) String() string
- type Div
- func (n *Div) AmIAlmostSame(r Expr) bool
- func (n *Div) AmIEqual(r Expr) bool
- func (n *Div) AmILess(r Expr) bool
- func (n *Div) AmISame(r Expr) bool
- func (n *Div) CalcExprStats()
- func (n *Div) Clone() Expr
- func (n *Div) ConvertToConstantFs(cs []float64) Expr
- func (n *Div) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (n *Div) DerivConst(i int) Expr
- func (n *Div) DerivVar(i int) Expr
- func (n *Div) Eval(t float64, x, c, s []float64) float64
- func (n *Div) ExprType() ExprType
- func (n *Div) GetExpr(pos *int) Expr
- func (n *Div) HasConst() bool
- func (n *Div) HasConstI(i int) bool
- func (n *Div) HasVar() bool
- func (n *Div) HasVarI(i int) bool
- func (n *Div) Javascript(dnames, snames []string, cvals []float64) string
- func (n *Div) Latex(dnames, snames []string, cvals []float64) string
- func (n *Div) NumConstants() int
- func (n *Div) NumVar() int
- func (n *Div) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (n *Div) Serial(sofar []int) []int
- func (n *Div) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (n *Div) Simplify(rules SimpRules) Expr
- func (n *Div) Sort()
- func (n *Div) StackSerial(sofar []int) []int
- func (n *Div) String() string
- type Exp
- func (u *Exp) AmIAlmostSame(r Expr) bool
- func (u *Exp) AmIEqual(r Expr) bool
- func (u *Exp) AmILess(r Expr) bool
- func (u *Exp) AmISame(r Expr) bool
- func (u *Exp) Clone() Expr
- func (u *Exp) ConvertToConstantFs(cs []float64) Expr
- func (u *Exp) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (u *Exp) DerivConst(i int) Expr
- func (u *Exp) DerivVar(i int) Expr
- func (u *Exp) Eval(t float64, x, c, s []float64) float64
- func (u *Exp) ExprType() ExprType
- func (u *Exp) GetExpr(pos *int) Expr
- func (u *Exp) Javascript(dnames, snames []string, cvals []float64) string
- func (u *Exp) Latex(dnames, snames []string, cvals []float64) string
- func (u *Exp) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (u *Exp) Serial(sofar []int) []int
- func (u *Exp) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (u *Exp) Simplify(rules SimpRules) (ret Expr)
- func (u *Exp) Sort()
- func (u *Exp) StackSerial(sofar []int) []int
- func (u *Exp) String() string
- type Expr
- type ExprArray
- type ExprParams
- type ExprStats
- type ExprType
- type Leaf
- func (t *Leaf) CalcExprStats()
- func (l *Leaf) DerivConst(i int) Expr
- func (l *Leaf) DerivVar(i int) Expr
- func (l *Leaf) HasConst() bool
- func (l *Leaf) HasConstI(i int) bool
- func (l *Leaf) HasVar() bool
- func (l *Leaf) HasVarI(i int) bool
- func (l *Leaf) NumConstants() int
- func (l *Leaf) NumVar() int
- func (l *Leaf) Simplify(rules SimpRules) Expr
- type Log
- func (u *Log) AmIAlmostSame(r Expr) bool
- func (u *Log) AmIEqual(r Expr) bool
- func (u *Log) AmILess(r Expr) bool
- func (u *Log) AmISame(r Expr) bool
- func (u *Log) Clone() Expr
- func (u *Log) ConvertToConstantFs(cs []float64) Expr
- func (u *Log) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (u *Log) DerivConst(i int) Expr
- func (u *Log) DerivVar(i int) Expr
- func (u *Log) Eval(t float64, x, c, s []float64) float64
- func (u *Log) ExprType() ExprType
- func (u *Log) GetExpr(pos *int) Expr
- func (u *Log) Javascript(dnames, snames []string, cvals []float64) string
- func (u *Log) Latex(dnames, snames []string, cvals []float64) string
- func (u *Log) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (u *Log) Serial(sofar []int) []int
- func (u *Log) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (u *Log) Simplify(rules SimpRules) (ret Expr)
- func (u *Log) Sort()
- func (u *Log) StackSerial(sofar []int) []int
- func (u *Log) String() string
- type Mul
- func (n *Mul) AmIAlmostSame(r Expr) bool
- func (n *Mul) AmIEqual(r Expr) bool
- func (n *Mul) AmILess(r Expr) bool
- func (n *Mul) AmISame(r Expr) bool
- func (n *Mul) Clone() Expr
- func (n *Mul) ConvertToConstantFs(cs []float64) Expr
- func (n *Mul) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (n *Mul) DerivConst(i int) Expr
- func (n *Mul) DerivVar(i int) Expr
- func (n *Mul) Eval(t float64, x, c, s []float64) float64
- func (n *Mul) ExprType() ExprType
- func (n *Mul) GetExpr(pos *int) Expr
- func (a *Mul) Insert(e Expr)
- func (n *Mul) Javascript(dnames, snames []string, cvals []float64) string
- func (n *Mul) Latex(dnames, snames []string, cvals []float64) string
- func (n *Mul) Len() int
- func (n *Mul) Less(i, j int) bool
- func (n *Mul) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (n *Mul) Serial(sofar []int) []int
- func (n *Mul) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (n *Mul) Simplify(rules SimpRules) Expr
- func (n *Mul) Sort()
- func (n *Mul) StackSerial(sofar []int) []int
- func (n *Mul) String() string
- func (n *Mul) Swap(i, j int)
- type N_ary
- func (n *N_ary) CalcExprStats()
- func (n *N_ary) DerivConst(i int) Expr
- func (n *N_ary) DerivVar(i int) Expr
- func (n *N_ary) HasConst() bool
- func (n *N_ary) HasConstI(i int) bool
- func (n *N_ary) HasVar() bool
- func (n *N_ary) HasVarI(i int) bool
- func (n *N_ary) NumConstants() int
- func (n *N_ary) NumVar() int
- func (n *N_ary) Simplify(rules SimpRules) Expr
- type Neg
- func (u *Neg) AmIAlmostSame(r Expr) bool
- func (u *Neg) AmIEqual(r Expr) bool
- func (u *Neg) AmILess(r Expr) bool
- func (u *Neg) AmISame(r Expr) bool
- func (u *Neg) Clone() Expr
- func (u *Neg) ConvertToConstantFs(cs []float64) Expr
- func (u *Neg) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (u *Neg) DerivConst(i int) Expr
- func (u *Neg) DerivVar(i int) Expr
- func (u *Neg) Eval(t float64, x, c, s []float64) float64
- func (u *Neg) ExprType() ExprType
- func (u *Neg) GetExpr(pos *int) Expr
- func (u *Neg) Javascript(dnames, snames []string, cvals []float64) string
- func (u *Neg) Latex(dnames, snames []string, cvals []float64) string
- func (u *Neg) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (u *Neg) Serial(sofar []int) []int
- func (u *Neg) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (u *Neg) Simplify(rules SimpRules) (ret Expr)
- func (u *Neg) Sort()
- func (u *Neg) StackSerial(sofar []int) []int
- func (u *Neg) String() string
- type Null
- func (n *Null) AmIAlmostSame(r Expr) bool
- func (n *Null) AmIEqual(r Expr) bool
- func (n *Null) AmILess(r Expr) bool
- func (n *Null) AmISame(r Expr) bool
- func (n *Null) CalcExprStats()
- func (n *Null) Clone() Expr
- func (n *Null) ConvertToConstantFs(cs []float64) Expr
- func (n *Null) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (n *Null) DerivConst(i int) Expr
- func (n *Null) DerivVar(i int) Expr
- func (n *Null) Eval(t float64, x, c, s []float64) float64
- func (n *Null) ExprType() ExprType
- func (n *Null) GetExpr(pos *int) Expr
- func (n *Null) HasConst() bool
- func (n *Null) HasConstI(i int) bool
- func (n *Null) HasVar() bool
- func (n *Null) HasVarI(i int) bool
- func (n *Null) Javascript(dnames, snames []string, cvals []float64) string
- func (n *Null) Latex(dnames, snames []string, cvals []float64) string
- func (n *Null) NumConstants() int
- func (n *Null) NumVar() int
- func (n *Null) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (n *Null) Serial(sofar []int) []int
- func (n *Null) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (n *Null) Simplify(rules SimpRules) Expr
- func (n *Null) Sort()
- func (n *Null) StackSerial(sofar []int) []int
- func (n *Null) String() string
- type PowE
- func (n *PowE) AmIAlmostSame(r Expr) bool
- func (n *PowE) AmIEqual(r Expr) bool
- func (n *PowE) AmILess(r Expr) bool
- func (n *PowE) AmISame(r Expr) bool
- func (n *PowE) CalcExprStats()
- func (n *PowE) Clone() Expr
- func (n *PowE) ConvertToConstantFs(cs []float64) Expr
- func (n *PowE) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (n *PowE) DerivConst(i int) Expr
- func (n *PowE) DerivVar(i int) Expr
- func (n *PowE) Eval(t float64, x, c, s []float64) float64
- func (n *PowE) ExprType() ExprType
- func (n *PowE) GetExpr(pos *int) Expr
- func (n *PowE) HasConst() bool
- func (n *PowE) HasConstI(i int) bool
- func (n *PowE) HasVar() bool
- func (n *PowE) HasVarI(i int) bool
- func (u *PowE) Javascript(dnames, snames []string, cvals []float64) string
- func (u *PowE) Latex(dnames, snames []string, cvals []float64) string
- func (n *PowE) NumConstants() int
- func (n *PowE) NumVar() int
- func (u *PowE) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (n *PowE) Serial(sofar []int) []int
- func (n *PowE) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (n *PowE) Simplify(rules SimpRules) Expr
- func (n *PowE) Sort()
- func (n *PowE) StackSerial(sofar []int) []int
- func (n *PowE) String() string
- type PowF
- func (u *PowF) AmIAlmostSame(r Expr) bool
- func (u *PowF) AmIEqual(r Expr) bool
- func (u *PowF) AmILess(r Expr) bool
- func (u *PowF) AmISame(r Expr) bool
- func (u *PowF) CalcExprStats()
- func (u *PowF) Clone() Expr
- func (u *PowF) ConvertToConstantFs(cs []float64) Expr
- func (u *PowF) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (u *PowF) DerivConst(i int) Expr
- func (u *PowF) DerivVar(i int) Expr
- func (u *PowF) Eval(t float64, x, c, s []float64) float64
- func (u *PowF) ExprType() ExprType
- func (u *PowF) GetExpr(pos *int) Expr
- func (u *PowF) HasConst() bool
- func (u *PowF) HasConstI(i int) bool
- func (u *PowF) HasVar() bool
- func (u *PowF) HasVarI(i int) bool
- func (u *PowF) Javascript(dnames, snames []string, cvals []float64) string
- func (u *PowF) Latex(dnames, snames []string, cvals []float64) string
- func (u *PowF) NumConstants() int
- func (u *PowF) NumVar() int
- func (u *PowF) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (u *PowF) Serial(sofar []int) []int
- func (u *PowF) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (u *PowF) Simplify(rules SimpRules) Expr
- func (u *PowF) Sort()
- func (u *PowF) StackSerial(sofar []int) []int
- func (u *PowF) String() string
- type PowI
- func (u *PowI) AmIAlmostSame(r Expr) bool
- func (u *PowI) AmIEqual(r Expr) bool
- func (u *PowI) AmILess(r Expr) bool
- func (u *PowI) AmISame(r Expr) bool
- func (u *PowI) CalcExprStats()
- func (u *PowI) Clone() Expr
- func (u *PowI) ConvertToConstantFs(cs []float64) Expr
- func (u *PowI) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (u *PowI) DerivConst(i int) Expr
- func (u *PowI) DerivVar(i int) Expr
- func (u *PowI) Eval(t float64, x, c, s []float64) float64
- func (u *PowI) ExprType() ExprType
- func (u *PowI) GetExpr(pos *int) Expr
- func (u *PowI) HasConst() bool
- func (u *PowI) HasConstI(i int) bool
- func (u *PowI) HasVar() bool
- func (u *PowI) HasVarI(i int) bool
- func (u *PowI) Javascript(dnames, snames []string, cvals []float64) string
- func (u *PowI) Latex(dnames, snames []string, cvals []float64) string
- func (u *PowI) NumConstants() int
- func (u *PowI) NumVar() int
- func (u *PowI) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (u *PowI) Serial(sofar []int) []int
- func (u *PowI) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (u *PowI) Simplify(rules SimpRules) Expr
- func (u *PowI) Sort()
- func (u *PowI) StackSerial(sofar []int) []int
- func (u *PowI) String() string
- type SimpRules
- type Sin
- func (u *Sin) AmIAlmostSame(r Expr) bool
- func (u *Sin) AmIEqual(r Expr) bool
- func (u *Sin) AmILess(r Expr) bool
- func (u *Sin) AmISame(r Expr) bool
- func (u *Sin) Clone() Expr
- func (u *Sin) ConvertToConstantFs(cs []float64) Expr
- func (u *Sin) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (u *Sin) DerivConst(i int) Expr
- func (u *Sin) DerivVar(i int) Expr
- func (u *Sin) Eval(t float64, x, c, s []float64) float64
- func (u *Sin) ExprType() ExprType
- func (u *Sin) GetExpr(pos *int) Expr
- func (u *Sin) Javascript(dnames, snames []string, cvals []float64) string
- func (u *Sin) Latex(dnames, snames []string, cvals []float64) string
- func (u *Sin) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (u *Sin) Serial(sofar []int) []int
- func (u *Sin) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (u *Sin) Simplify(rules SimpRules) (ret Expr)
- func (u *Sin) Sort()
- func (u *Sin) StackSerial(sofar []int) []int
- func (u *Sin) String() string
- type Sqrt
- func (u *Sqrt) AmIAlmostSame(r Expr) bool
- func (u *Sqrt) AmIEqual(r Expr) bool
- func (u *Sqrt) AmILess(r Expr) bool
- func (u *Sqrt) AmISame(r Expr) bool
- func (u *Sqrt) Clone() Expr
- func (u *Sqrt) ConvertToConstantFs(cs []float64) Expr
- func (u *Sqrt) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (u *Sqrt) DerivConst(i int) Expr
- func (u *Sqrt) DerivVar(i int) Expr
- func (u *Sqrt) Eval(t float64, x, c, s []float64) float64
- func (u *Sqrt) ExprType() ExprType
- func (u *Sqrt) GetExpr(pos *int) Expr
- func (u *Sqrt) Javascript(dnames, snames []string, cvals []float64) string
- func (u *Sqrt) Latex(dnames, snames []string, cvals []float64) string
- func (u *Sqrt) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (u *Sqrt) Serial(sofar []int) []int
- func (u *Sqrt) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (u *Sqrt) Simplify(rules SimpRules) (ret Expr)
- func (u *Sqrt) Sort()
- func (u *Sqrt) StackSerial(sofar []int) []int
- func (u *Sqrt) String() string
- type System
- func (s *System) AmIAlmostSame(r Expr) bool
- func (s *System) AmIEqual(r Expr) bool
- func (s *System) AmILess(r Expr) bool
- func (s *System) AmISame(r Expr) bool
- func (s *System) Clone() Expr
- func (s *System) ConvertToConstantFs(cs []float64) Expr
- func (s *System) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (sys *System) Eval(t float64, x, c, s []float64) float64
- func (s *System) ExprType() ExprType
- func (s *System) GetExpr(pos *int) Expr
- func (s *System) Javascript(dnames, snames []string, cvals []float64) string
- func (s *System) Latex(dnames, snames []string, cvals []float64) string
- func (s *System) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (s *System) Serial(sofar []int) []int
- func (s *System) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (s *System) Simplify(rules SimpRules) Expr
- func (s *System) Sort()
- func (s *System) StackSerial(sofar []int) []int
- func (s *System) String() string
- type Tan
- func (u *Tan) AmIAlmostSame(r Expr) bool
- func (u *Tan) AmIEqual(r Expr) bool
- func (u *Tan) AmILess(r Expr) bool
- func (u *Tan) AmISame(r Expr) bool
- func (u *Tan) Clone() Expr
- func (u *Tan) ConvertToConstantFs(cs []float64) Expr
- func (u *Tan) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (u *Tan) DerivVar(i int) Expr
- func (u *Tan) Eval(t float64, x, c, s []float64) float64
- func (u *Tan) ExprType() ExprType
- func (u *Tan) GetExpr(pos *int) Expr
- func (u *Tan) Javascript(dnames, snames []string, cvals []float64) string
- func (u *Tan) Latex(dnames, snames []string, cvals []float64) string
- func (u *Tan) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (u *Tan) Serial(sofar []int) []int
- func (u *Tan) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (u *Tan) Simplify(rules SimpRules) (ret Expr)
- func (u *Tan) Sort()
- func (u *Tan) StackSerial(sofar []int) []int
- func (u *Tan) String() string
- type Time
- func (n *Time) AmIAlmostSame(r Expr) bool
- func (n *Time) AmIEqual(r Expr) bool
- func (n *Time) AmILess(r Expr) bool
- func (n *Time) AmISame(r Expr) bool
- func (t *Time) Clone() Expr
- func (n *Time) ConvertToConstantFs(cs []float64) Expr
- func (n *Time) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (*Time) Eval(t float64, x, c, s []float64) float64
- func (t *Time) ExprType() ExprType
- func (n *Time) GetExpr(pos *int) Expr
- func (t *Time) Javascript(dnames, snames []string, cvals []float64) string
- func (t *Time) Latex(dnames, snames []string, cvals []float64) string
- func (t *Time) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (t *Time) Serial(sofar []int) []int
- func (n *Time) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (n *Time) Simplify(rules SimpRules) Expr
- func (n *Time) Sort()
- func (t *Time) StackSerial(sofar []int) []int
- func (n *Time) String() string
- type Unary
- func (u *Unary) CalcExprStats()
- func (u *Unary) DerivConst(i int) Expr
- func (u *Unary) DerivVar(i int) Expr
- func (u *Unary) HasConst() bool
- func (u *Unary) HasConstI(i int) bool
- func (u *Unary) HasVar() bool
- func (u *Unary) HasVarI(i int) bool
- func (u *Unary) NumConstants() int
- func (u *Unary) NumVar() int
- func (u *Unary) Simplify(rules SimpRules) Expr
- type Var
- func (v *Var) AmIAlmostSame(r Expr) bool
- func (v *Var) AmIEqual(r Expr) bool
- func (v *Var) AmILess(r Expr) bool
- func (v *Var) AmISame(r Expr) bool
- func (v *Var) Clone() Expr
- func (v *Var) ConvertToConstantFs(cs []float64) Expr
- func (v *Var) ConvertToConstants(cs []float64) ([]float64, Expr)
- func (v *Var) DerivVar(i int) Expr
- func (v *Var) Eval(t float64, x, c, s []float64) float64
- func (v *Var) ExprType() ExprType
- func (v *Var) GetExpr(pos *int) Expr
- func (v *Var) HasVar() bool
- func (v *Var) HasVarI(i int) bool
- func (v *Var) Javascript(dnames, snames []string, cvals []float64) string
- func (v *Var) Latex(dnames, snames []string, cvals []float64) string
- func (v *Var) NumVar() int
- func (v *Var) PrettyPrint(dnames, snames []string, cvals []float64) string
- func (v *Var) Serial(sofar []int) []int
- func (v *Var) SetExpr(pos *int, e Expr) (replace_me, replaced bool)
- func (v *Var) Simplify(rules SimpRules) Expr
- func (v *Var) Sort()
- func (v *Var) StackSerial(sofar []int) []int
- func (v *Var) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DumpExprTypes ¶
func DumpExprTypes()
Types ¶
type Abs ¶
type Abs struct {
Unary
}
func (*Abs) AmIAlmostSame ¶
func (*Abs) ConvertToConstantFs ¶
func (*Abs) DerivConst ¶
func (*Abs) PrettyPrint ¶
func (*Abs) StackSerial ¶
type Add ¶
type Add struct {
N_ary
}
N-ary Operators
func (*Add) AmIAlmostSame ¶
func (*Add) ConvertToConstantFs ¶
func (*Add) DerivConst ¶
func (*Add) PrettyPrint ¶
func (*Add) StackSerial ¶
type Constant ¶
func NewConstant ¶
func (*Constant) AmIAlmostSame ¶
func (*Constant) ConvertToConstantFs ¶
func (*Constant) ConvertToConstants ¶
func (*Constant) DerivConst ¶
func (*Constant) Javascript ¶
func (*Constant) NumConstants ¶
func (*Constant) PrettyPrint ¶
func (*Constant) StackSerial ¶
type ConstantF ¶
func NewConstantF ¶
func (*ConstantF) AmIAlmostSame ¶
func (*ConstantF) ConvertToConstantFs ¶
func (*ConstantF) ConvertToConstants ¶
func (*ConstantF) Javascript ¶
func (*ConstantF) PrettyPrint ¶
( we don't output the index since it is unimportant and can be altered )
func (*ConstantF) StackSerial ¶
type Cos ¶
type Cos struct {
Unary
}
func (*Cos) AmIAlmostSame ¶
func (*Cos) ConvertToConstantFs ¶
func (*Cos) DerivConst ¶
func (*Cos) PrettyPrint ¶
func (*Cos) StackSerial ¶
type Div ¶
func (*Div) AmIAlmostSame ¶
func (*Div) CalcExprStats ¶
func (n *Div) CalcExprStats()
func (*Div) ConvertToConstantFs ¶
func (*Div) DerivConst ¶
func (*Div) NumConstants ¶
func (*Div) PrettyPrint ¶
func (*Div) StackSerial ¶
type Exp ¶
type Exp struct {
Unary
}
func (*Exp) AmIAlmostSame ¶
func (*Exp) ConvertToConstantFs ¶
func (*Exp) DerivConst ¶
func (*Exp) PrettyPrint ¶
func (*Exp) StackSerial ¶
type Expr ¶
type Expr interface { // types.go (this file) ExprType() ExprType Clone() Expr // stats.go Size() int Depth() int Height() int NumChildren() int CalcExprStats() // compare.go AmILess(rhs Expr) bool AmIEqual(rhs Expr) bool AmISame(rhs Expr) bool // equality without coefficient values/index AmIAlmostSame(rhs Expr) bool // adds flexibility to mul comparison to AmISame Sort() // has.go HasVar() bool HasVarI(i int) bool NumVar() int // DFS for a floating point valued ConstantF HasConst() bool // DFS for a indexed valued Constant HasConstI(i int) bool // Counts the number of indexed Constant nodes NumConstants() int // Converts indexed Constant nodes to ConstantF nodes // using the input slice as the values for replacement ConvertToConstantFs(cs []float64) Expr // DFS converting float valued constants to indexed constants // the input should be an empty slice // the output is an appended slice the size = |ConstantF| in the tree ConvertToConstants(cs []float64) ([]float64, Expr) // getset.go // DFS retrieval of a node by index GetExpr(pos *int) Expr // DFS replacement of a node and it's subtree // replaced is used to discontinue the DFS after replacement // replace_me gets triggered when pos == 0 and informs the parent node to replace the respective child node SetExpr(pos *int, e Expr) (replace_me, replaced bool) // prints the AST String() string // creates an integer representation of the AST in ~prefix notation // The input is an empty slice, output is the representation. // The output is generally the ExprType integer value // Associative operators (+ & *) also include the number of children. // The terminal nodes include the index when appropriate. Serial([]int) []int StackSerial([]int) []int // Pretty print acts like String, but replaces the internal indexed // formatting with user specified strings and values PrettyPrint(dnames, snames []string, cvals []float64) string // Similar to PrettyPrint, but in latex format Latex(dnames, snames []string, cvals []float64) string Javascript(dnames, snames []string, cvals []float64) string // eval.go // Evaluates an expression at one point // t is a time value // x are the input Var values // c are the indexed Constant values // s are the indexed System values // the output is the result of DFS evaluation Eval(t float64, x, c, s []float64) float64 // simp.go Simplify(rules SimpRules) Expr // deriv.go // Calculate the derivative w.r.t. Var_i DerivVar(i int) Expr // Calculate the derivative w.r.t. Constant_i DerivConst(i int) Expr // contains filtered or unexported methods }
Expr is the interface to all node types for the AST of mathematical expression
type ExprParams ¶
type ExprStats ¶
type ExprStats struct {
// contains filtered or unexported fields
}
func (*ExprStats) NumChildren ¶
type ExprType ¶
type ExprType int
const ( NULL ExprType = iota STARTLEAF CONSTANT // indexed constant, useful for non-linear regression tasks CONSTANTF // floating point constant TIME // useful when looking at time series and RK4 integration SYSTEM // i use this like a variable that changes between experiments, but not with time (mass,size,etc.) VAR // a canonical variable LASTLEAF STARTFUNC NEG ABS SQRT SIN COS TAN EXP LOG LASTFUNC POWI // Expr^Integer POWF // Expr^Float POWE // Expr^Expr DIV // Expr/Expr ADD // these can have more than two child nodes MUL // this eases sorting and simplification EXPR_MAX STARTVAR // for serialization reduction of variables )
type Leaf ¶
type Leaf struct {
ExprStats
}
func (*Leaf) CalcExprStats ¶
func (t *Leaf) CalcExprStats()
func (*Leaf) DerivConst ¶
func (*Leaf) NumConstants ¶
type Log ¶
type Log struct {
Unary
}
func (*Log) AmIAlmostSame ¶
func (*Log) ConvertToConstantFs ¶
func (*Log) DerivConst ¶
func (*Log) PrettyPrint ¶
func (*Log) StackSerial ¶
type Mul ¶
type Mul struct {
N_ary
}
func (*Mul) AmIAlmostSame ¶
func (*Mul) ConvertToConstantFs ¶
func (*Mul) DerivConst ¶
func (*Mul) PrettyPrint ¶
func (*Mul) StackSerial ¶
type N_ary ¶
func (*N_ary) CalcExprStats ¶
func (n *N_ary) CalcExprStats()
func (*N_ary) DerivConst ¶
func (*N_ary) NumConstants ¶
type Neg ¶
type Neg struct {
Unary
}
Unary Operators
func (*Neg) AmIAlmostSame ¶
func (*Neg) ConvertToConstantFs ¶
func (*Neg) DerivConst ¶
func (*Neg) PrettyPrint ¶
func (*Neg) StackSerial ¶
type Null ¶
type Null struct {
ExprStats
}
Null Leaf (shouldn't really appear) This is a sample for the other node types
func (*Null) AmIAlmostSame ¶
func (*Null) CalcExprStats ¶
func (n *Null) CalcExprStats()
func (*Null) ConvertToConstantFs ¶
func (*Null) DerivConst ¶
func (*Null) Javascript ¶
func (*Null) NumConstants ¶
func (*Null) PrettyPrint ¶
func (*Null) StackSerial ¶
type PowE ¶
func (*PowE) AmIAlmostSame ¶
func (*PowE) CalcExprStats ¶
func (n *PowE) CalcExprStats()
func (*PowE) ConvertToConstantFs ¶
func (*PowE) DerivConst ¶
func (*PowE) Javascript ¶
func (*PowE) NumConstants ¶
func (*PowE) PrettyPrint ¶
func (*PowE) StackSerial ¶
type PowF ¶
func (*PowF) AmIAlmostSame ¶
func (*PowF) CalcExprStats ¶
func (u *PowF) CalcExprStats()
func (*PowF) ConvertToConstantFs ¶
func (*PowF) DerivConst ¶
func (*PowF) Javascript ¶
func (*PowF) NumConstants ¶
func (*PowF) PrettyPrint ¶
func (*PowF) StackSerial ¶
type PowI ¶
Hmmm... Operators
func (*PowI) AmIAlmostSame ¶
func (*PowI) CalcExprStats ¶
func (u *PowI) CalcExprStats()
func (*PowI) ConvertToConstantFs ¶
func (*PowI) DerivConst ¶
func (*PowI) Javascript ¶
func (*PowI) NumConstants ¶
func (*PowI) PrettyPrint ¶
func (*PowI) StackSerial ¶
type SimpRules ¶
type SimpRules struct { GroupAddTerms bool ConvertConsts bool MulToPow bool MaxPowPow int MulInCoeff int // add must be >= to size, 0 == No // state tracking InTrig bool }
func DefaultRules ¶
func DefaultRules() SimpRules
type Sin ¶
type Sin struct {
Unary
}
func (*Sin) AmIAlmostSame ¶
func (*Sin) ConvertToConstantFs ¶
func (*Sin) DerivConst ¶
func (*Sin) PrettyPrint ¶
func (*Sin) StackSerial ¶
type Sqrt ¶
type Sqrt struct {
Unary
}
func (*Sqrt) AmIAlmostSame ¶
func (*Sqrt) ConvertToConstantFs ¶
func (*Sqrt) DerivConst ¶
func (*Sqrt) Javascript ¶
func (*Sqrt) PrettyPrint ¶
func (*Sqrt) StackSerial ¶
type System ¶
func (*System) AmIAlmostSame ¶
func (*System) ConvertToConstantFs ¶
func (*System) ConvertToConstants ¶
func (*System) Javascript ¶
func (*System) PrettyPrint ¶
func (*System) StackSerial ¶
type Tan ¶
type Tan struct {
Unary
}
func (*Tan) AmIAlmostSame ¶
func (*Tan) ConvertToConstantFs ¶
func (*Tan) PrettyPrint ¶
func (*Tan) StackSerial ¶
type Time ¶
type Time struct {
Leaf
}
Leaf Nodes
func (*Time) AmIAlmostSame ¶
func (*Time) ConvertToConstantFs ¶
func (*Time) Javascript ¶
func (*Time) PrettyPrint ¶
func (*Time) StackSerial ¶
type Unary ¶
func (*Unary) CalcExprStats ¶
func (u *Unary) CalcExprStats()
func (*Unary) DerivConst ¶
func (*Unary) NumConstants ¶
type Var ¶
func (*Var) AmIAlmostSame ¶
func (*Var) ConvertToConstantFs ¶
func (*Var) PrettyPrint ¶
func (*Var) StackSerial ¶
Click to show internal directories.
Click to hide internal directories.