symexpr

package module
v0.0.0-...-1f0833b Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2014 License: BSD-3-Clause Imports: 7 Imported by: 4

README

Symbolic Expressions (just math for now)

  • represetation: as an AST tree
  • manipulation: add,rm, simplify, derivative
  • evaluation: explicit, RK4 integration, non-linear regression via levmar->MINPACK
  • printing: String() print, prettyprint, serialization
type exprType int

const (
	NULL      exprType = iota
	CONSTANT           // indexed constant, useful for 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

	NEG
	ABS
	SQRT
	SIN
	COS
	TAN
	EXP
	LOG
	POWI // Expr^Integer
	POWF // Expr^Float

	POWE // Expr^Expr
	DIV

	ADD // these can have more than two child nodes
	MUL // this eases simplification

	EXPR_MAX
	STARTVAR // for serialization reduction of variables
)

// Expr is the interface to all node types for the AST of mathematical expression
// 

type Expr interface {

	// types.go (this file)
	ExprType() exprType
	Clone() Expr

	// stats.go
	Size() int
	Depth() int
	Height() int
	NumChildren() int
	CalcExprStats(currDepth int) (mySize int)

	// 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

	// convert.go

	// 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)
	//   IndexConstants( ci int ) int

	// 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)

	// print.go

	// 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

	// Pretty print acts like String, but replaces the internal indexed
	// formatting with user specified strings and values
	PrettyPrint(dnames, snames []string, cvals []float64) string
	// 	WriteString( buf *bytes.Buffer )

	// 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
}

Tony Worm Sept, 2012

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpExprTypes

func DumpExprTypes()

func PRK4

func PRK4(xn int, eqn Expr, ti, tj float64, x_in, x_out, x_tmp, c, s []float64) float64

func PrintPRK4

func PrintPRK4(xn int, eqn Expr, ti, to float64, x_in, x_out, x_tmp, c, s []float64) float64

func RK4

func RK4(eqn []Expr, ti, tj float64, x_in, x_tmp, c, s []float64) (x_out []float64)

Types

type Abs

type Abs struct {
	Unary
}

func NewAbs

func NewAbs(e Expr) *Abs

func (*Abs) AmIAlmostSame

func (u *Abs) AmIAlmostSame(r Expr) bool

func (*Abs) AmIEqual

func (u *Abs) AmIEqual(r Expr) bool

func (*Abs) AmILess

func (u *Abs) AmILess(r Expr) bool

func (*Abs) AmISame

func (u *Abs) AmISame(r Expr) bool

func (*Abs) Clone

func (u *Abs) Clone() Expr

func (*Abs) ConvertToConstantFs

func (u *Abs) ConvertToConstantFs(cs []float64) Expr

func (*Abs) ConvertToConstants

func (u *Abs) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Abs) DerivConst

func (u *Abs) DerivConst(i int) Expr

func (*Abs) DerivVar

func (u *Abs) DerivVar(i int) Expr

func (*Abs) Eval

func (u *Abs) Eval(t float64, x, c, s []float64) float64

func (*Abs) ExprType

func (u *Abs) ExprType() ExprType

func (*Abs) GetExpr

func (u *Abs) GetExpr(pos *int) Expr

func (*Abs) Javascript

func (u *Abs) Javascript(dnames, snames []string, cvals []float64) string

func (*Abs) Latex

func (u *Abs) Latex(dnames, snames []string, cvals []float64) string

func (*Abs) PrettyPrint

func (u *Abs) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Abs) Serial

func (u *Abs) Serial(sofar []int) []int

func (*Abs) SetExpr

func (u *Abs) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Abs) Simplify

func (u *Abs) Simplify(rules SimpRules) (ret Expr)

func (*Abs) Sort

func (u *Abs) Sort()

func (*Abs) StackSerial

func (u *Abs) StackSerial(sofar []int) []int

func (*Abs) String

func (u *Abs) String() string

type Add

type Add struct {
	N_ary
}

N-ary Operators

func NewAdd

func NewAdd() *Add

func (*Add) AmIAlmostSame

func (n *Add) AmIAlmostSame(r Expr) bool

func (*Add) AmIEqual

func (n *Add) AmIEqual(r Expr) bool

func (*Add) AmILess

func (n *Add) AmILess(r Expr) bool

func (*Add) AmISame

func (n *Add) AmISame(r Expr) bool

func (*Add) Clone

func (n *Add) Clone() Expr

func (*Add) ConvertToConstantFs

func (n *Add) ConvertToConstantFs(cs []float64) Expr

func (*Add) ConvertToConstants

func (n *Add) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Add) DerivConst

func (n *Add) DerivConst(i int) Expr

func (*Add) DerivVar

func (n *Add) DerivVar(i int) Expr

func (*Add) Eval

func (n *Add) Eval(t float64, x, c, s []float64) float64

func (*Add) ExprType

func (n *Add) ExprType() ExprType

func (*Add) GetExpr

func (n *Add) GetExpr(pos *int) Expr

func (*Add) Insert

func (a *Add) Insert(e Expr)

func (*Add) Javascript

func (n *Add) Javascript(dnames, snames []string, cvals []float64) string

func (*Add) Latex

func (n *Add) Latex(dnames, snames []string, cvals []float64) string

func (*Add) Len

func (n *Add) Len() int

func (*Add) Less

func (n *Add) Less(i, j int) bool

func (*Add) PrettyPrint

func (n *Add) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Add) Serial

func (n *Add) Serial(sofar []int) []int

func (*Add) SetExpr

func (n *Add) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Add) Simplify

func (n *Add) Simplify(rules SimpRules) Expr

func (*Add) Sort

func (n *Add) Sort()

func (*Add) StackSerial

func (n *Add) StackSerial(sofar []int) []int

func (*Add) String

func (n *Add) String() string

func (*Add) Swap

func (n *Add) Swap(i, j int)

type Binary

type Binary struct {
	ExprStats
	C1, C2 Expr
}

type Constant

type Constant struct {
	Leaf
	P int
}

func NewConstant

func NewConstant(i int) *Constant

func (*Constant) AmIAlmostSame

func (c *Constant) AmIAlmostSame(r Expr) bool

func (*Constant) AmIEqual

func (c *Constant) AmIEqual(r Expr) bool

func (*Constant) AmILess

func (c *Constant) AmILess(r Expr) bool

func (*Constant) AmISame

func (c *Constant) AmISame(r Expr) bool

func (*Constant) Clone

func (c *Constant) Clone() Expr

func (*Constant) ConvertToConstantFs

func (c *Constant) ConvertToConstantFs(cs []float64) Expr

func (*Constant) ConvertToConstants

func (c *Constant) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Constant) DerivConst

func (c *Constant) DerivConst(i int) Expr

func (*Constant) Eval

func (cnst *Constant) Eval(t float64, x, c, s []float64) float64

func (*Constant) ExprType

func (c *Constant) ExprType() ExprType

func (*Constant) GetExpr

func (c *Constant) GetExpr(pos *int) Expr

func (*Constant) HasConst

func (c *Constant) HasConst() bool

func (*Constant) HasConstI

func (c *Constant) HasConstI(i int) bool

func (*Constant) Javascript

func (c *Constant) Javascript(dnames, snames []string, cvals []float64) string

func (*Constant) Latex

func (c *Constant) Latex(dnames, snames []string, cvals []float64) string

func (*Constant) NumConstants

func (c *Constant) NumConstants() int

func (*Constant) PrettyPrint

func (c *Constant) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Constant) Serial

func (c *Constant) Serial(sofar []int) []int

func (*Constant) SetExpr

func (c *Constant) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Constant) Simplify

func (c *Constant) Simplify(rules SimpRules) Expr

func (*Constant) Sort

func (c *Constant) Sort()

func (*Constant) StackSerial

func (c *Constant) StackSerial(sofar []int) []int

func (*Constant) String

func (c *Constant) String() string

type ConstantF

type ConstantF struct {
	Leaf
	F float64
}

func NewConstantF

func NewConstantF(f float64) *ConstantF

func (*ConstantF) AmIAlmostSame

func (c *ConstantF) AmIAlmostSame(r Expr) bool

func (*ConstantF) AmIEqual

func (c *ConstantF) AmIEqual(r Expr) bool

func (*ConstantF) AmILess

func (c *ConstantF) AmILess(r Expr) bool

func (*ConstantF) AmISame

func (c *ConstantF) AmISame(r Expr) bool

func (*ConstantF) Clone

func (c *ConstantF) Clone() Expr

func (*ConstantF) ConvertToConstantFs

func (c *ConstantF) ConvertToConstantFs(cs []float64) Expr

func (*ConstantF) ConvertToConstants

func (c *ConstantF) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*ConstantF) Eval

func (cnst *ConstantF) Eval(t float64, x, c, s []float64) float64

func (*ConstantF) ExprType

func (c *ConstantF) ExprType() ExprType

func (*ConstantF) GetExpr

func (c *ConstantF) GetExpr(pos *int) Expr

func (*ConstantF) HasConst

func (c *ConstantF) HasConst() bool

func (*ConstantF) HasConstI

func (c *ConstantF) HasConstI(i int) bool

func (*ConstantF) Javascript

func (c *ConstantF) Javascript(dnames, snames []string, cvals []float64) string

func (*ConstantF) Latex

func (c *ConstantF) Latex(dnames, snames []string, cvals []float64) string

func (*ConstantF) PrettyPrint

func (c *ConstantF) PrettyPrint(dnames, snames []string, cvals []float64) string

( we don't output the index since it is unimportant and can be altered )

func (*ConstantF) Serial

func (c *ConstantF) Serial(sofar []int) []int

func (*ConstantF) SetExpr

func (c *ConstantF) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*ConstantF) Simplify

func (c *ConstantF) Simplify(rules SimpRules) Expr

func (*ConstantF) Sort

func (c *ConstantF) Sort()

func (*ConstantF) StackSerial

func (c *ConstantF) StackSerial(sofar []int) []int

func (*ConstantF) String

func (c *ConstantF) String() string

type Cos

type Cos struct {
	Unary
}

func NewCos

func NewCos(e Expr) *Cos

func (*Cos) AmIAlmostSame

func (u *Cos) AmIAlmostSame(r Expr) bool

func (*Cos) AmIEqual

func (u *Cos) AmIEqual(r Expr) bool

func (*Cos) AmILess

func (u *Cos) AmILess(r Expr) bool

func (*Cos) AmISame

func (u *Cos) AmISame(r Expr) bool

func (*Cos) Clone

func (u *Cos) Clone() Expr

func (*Cos) ConvertToConstantFs

func (u *Cos) ConvertToConstantFs(cs []float64) Expr

func (*Cos) ConvertToConstants

func (u *Cos) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Cos) DerivConst

func (u *Cos) DerivConst(i int) Expr

func (*Cos) DerivVar

func (u *Cos) DerivVar(i int) Expr

func (*Cos) Eval

func (u *Cos) Eval(t float64, x, c, s []float64) float64

func (*Cos) ExprType

func (u *Cos) ExprType() ExprType

func (*Cos) GetExpr

func (u *Cos) GetExpr(pos *int) Expr

func (*Cos) Javascript

func (u *Cos) Javascript(dnames, snames []string, cvals []float64) string

func (*Cos) Latex

func (u *Cos) Latex(dnames, snames []string, cvals []float64) string

func (*Cos) PrettyPrint

func (u *Cos) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Cos) Serial

func (u *Cos) Serial(sofar []int) []int

func (*Cos) SetExpr

func (u *Cos) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Cos) Simplify

func (u *Cos) Simplify(rules SimpRules) (ret Expr)

func (*Cos) Sort

func (u *Cos) Sort()

func (*Cos) StackSerial

func (u *Cos) StackSerial(sofar []int) []int

func (*Cos) String

func (u *Cos) String() string

type Div

type Div struct {
	ExprStats
	Numer Expr
	Denom Expr
}

func NewDiv

func NewDiv(n, d Expr) *Div

func (*Div) AmIAlmostSame

func (n *Div) AmIAlmostSame(r Expr) bool

func (*Div) AmIEqual

func (n *Div) AmIEqual(r Expr) bool

func (*Div) AmILess

func (n *Div) AmILess(r Expr) bool

func (*Div) AmISame

func (n *Div) AmISame(r Expr) bool

func (*Div) CalcExprStats

func (n *Div) CalcExprStats()

func (*Div) Clone

func (n *Div) Clone() Expr

func (*Div) ConvertToConstantFs

func (n *Div) ConvertToConstantFs(cs []float64) Expr

func (*Div) ConvertToConstants

func (n *Div) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Div) DerivConst

func (n *Div) DerivConst(i int) Expr

func (*Div) DerivVar

func (n *Div) DerivVar(i int) Expr

func (*Div) Eval

func (n *Div) Eval(t float64, x, c, s []float64) float64

func (*Div) ExprType

func (n *Div) ExprType() ExprType

func (*Div) GetExpr

func (n *Div) GetExpr(pos *int) Expr

func (*Div) HasConst

func (n *Div) HasConst() bool

func (*Div) HasConstI

func (n *Div) HasConstI(i int) bool

func (*Div) HasVar

func (n *Div) HasVar() bool

func (*Div) HasVarI

func (n *Div) HasVarI(i int) bool

func (*Div) Javascript

func (n *Div) Javascript(dnames, snames []string, cvals []float64) string

func (*Div) Latex

func (n *Div) Latex(dnames, snames []string, cvals []float64) string

func (*Div) NumConstants

func (n *Div) NumConstants() int

func (*Div) NumVar

func (n *Div) NumVar() int

func (*Div) PrettyPrint

func (n *Div) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Div) Serial

func (n *Div) Serial(sofar []int) []int

func (*Div) SetExpr

func (n *Div) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Div) Simplify

func (n *Div) Simplify(rules SimpRules) Expr

func (*Div) Sort

func (n *Div) Sort()

func (*Div) StackSerial

func (n *Div) StackSerial(sofar []int) []int

func (*Div) String

func (n *Div) String() string

type Exp

type Exp struct {
	Unary
}

func NewExp

func NewExp(e Expr) *Exp

func (*Exp) AmIAlmostSame

func (u *Exp) AmIAlmostSame(r Expr) bool

func (*Exp) AmIEqual

func (u *Exp) AmIEqual(r Expr) bool

func (*Exp) AmILess

func (u *Exp) AmILess(r Expr) bool

func (*Exp) AmISame

func (u *Exp) AmISame(r Expr) bool

func (*Exp) Clone

func (u *Exp) Clone() Expr

func (*Exp) ConvertToConstantFs

func (u *Exp) ConvertToConstantFs(cs []float64) Expr

func (*Exp) ConvertToConstants

func (u *Exp) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Exp) DerivConst

func (u *Exp) DerivConst(i int) Expr

func (*Exp) DerivVar

func (u *Exp) DerivVar(i int) Expr

func (*Exp) Eval

func (u *Exp) Eval(t float64, x, c, s []float64) float64

func (*Exp) ExprType

func (u *Exp) ExprType() ExprType

func (*Exp) GetExpr

func (u *Exp) GetExpr(pos *int) Expr

func (*Exp) Javascript

func (u *Exp) Javascript(dnames, snames []string, cvals []float64) string

func (*Exp) Latex

func (u *Exp) Latex(dnames, snames []string, cvals []float64) string

func (*Exp) PrettyPrint

func (u *Exp) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Exp) Serial

func (u *Exp) Serial(sofar []int) []int

func (*Exp) SetExpr

func (u *Exp) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Exp) Simplify

func (u *Exp) Simplify(rules SimpRules) (ret Expr)

func (*Exp) Sort

func (u *Exp) Sort()

func (*Exp) StackSerial

func (u *Exp) StackSerial(sofar []int) []int

func (*Exp) String

func (u *Exp) String() string

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

func ParseFunc

func ParseFunc(text string, varNames []string) Expr

func SwapExpr

func SwapExpr(orig, newt Expr, pos int) (ret Expr)

type ExprArray

type ExprArray []Expr

func (ExprArray) Len

func (p ExprArray) Len() int

func (ExprArray) Less

func (p ExprArray) Less(i, j int) bool

func (ExprArray) Swap

func (p ExprArray) Swap(i, j int)

type ExprParams

type ExprParams struct {

	// bounds on tree
	MaxS, MaxD,
	MinS, MinD int

	// bounds on some operators
	NumDim, NumSys, NumCoeff int

	// usable terms at each location
	Roots, Nodes, Leafs, NonTrig []Expr
}

type ExprStats

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

func (*ExprStats) Depth

func (es *ExprStats) Depth() int

func (*ExprStats) Height

func (es *ExprStats) Height() int

func (*ExprStats) NumChildren

func (es *ExprStats) NumChildren() int

func (*ExprStats) Pos

func (es *ExprStats) Pos() int

func (*ExprStats) Size

func (es *ExprStats) Size() int

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
)

func (ExprType) String

func (e ExprType) String() string

type Leaf

type Leaf struct {
	ExprStats
}

func (*Leaf) CalcExprStats

func (t *Leaf) CalcExprStats()

func (*Leaf) DerivConst

func (l *Leaf) DerivConst(i int) Expr

func (*Leaf) DerivVar

func (l *Leaf) DerivVar(i int) Expr

func (*Leaf) HasConst

func (l *Leaf) HasConst() bool

func (*Leaf) HasConstI

func (l *Leaf) HasConstI(i int) bool

func (*Leaf) HasVar

func (l *Leaf) HasVar() bool

func (*Leaf) HasVarI

func (l *Leaf) HasVarI(i int) bool

func (*Leaf) NumConstants

func (l *Leaf) NumConstants() int

func (*Leaf) NumVar

func (l *Leaf) NumVar() int

func (*Leaf) Simplify

func (l *Leaf) Simplify(rules SimpRules) Expr

type Log

type Log struct {
	Unary
}

func NewLog

func NewLog(e Expr) *Log

func (*Log) AmIAlmostSame

func (u *Log) AmIAlmostSame(r Expr) bool

func (*Log) AmIEqual

func (u *Log) AmIEqual(r Expr) bool

func (*Log) AmILess

func (u *Log) AmILess(r Expr) bool

func (*Log) AmISame

func (u *Log) AmISame(r Expr) bool

func (*Log) Clone

func (u *Log) Clone() Expr

func (*Log) ConvertToConstantFs

func (u *Log) ConvertToConstantFs(cs []float64) Expr

func (*Log) ConvertToConstants

func (u *Log) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Log) DerivConst

func (u *Log) DerivConst(i int) Expr

func (*Log) DerivVar

func (u *Log) DerivVar(i int) Expr

func (*Log) Eval

func (u *Log) Eval(t float64, x, c, s []float64) float64

func (*Log) ExprType

func (u *Log) ExprType() ExprType

func (*Log) GetExpr

func (u *Log) GetExpr(pos *int) Expr

func (*Log) Javascript

func (u *Log) Javascript(dnames, snames []string, cvals []float64) string

func (*Log) Latex

func (u *Log) Latex(dnames, snames []string, cvals []float64) string

func (*Log) PrettyPrint

func (u *Log) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Log) Serial

func (u *Log) Serial(sofar []int) []int

func (*Log) SetExpr

func (u *Log) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Log) Simplify

func (u *Log) Simplify(rules SimpRules) (ret Expr)

func (*Log) Sort

func (u *Log) Sort()

func (*Log) StackSerial

func (u *Log) StackSerial(sofar []int) []int

func (*Log) String

func (u *Log) String() string

type Mul

type Mul struct {
	N_ary
}

func NewMul

func NewMul() *Mul

func (*Mul) AmIAlmostSame

func (n *Mul) AmIAlmostSame(r Expr) bool

func (*Mul) AmIEqual

func (n *Mul) AmIEqual(r Expr) bool

func (*Mul) AmILess

func (n *Mul) AmILess(r Expr) bool

func (*Mul) AmISame

func (n *Mul) AmISame(r Expr) bool

func (*Mul) Clone

func (n *Mul) Clone() Expr

func (*Mul) ConvertToConstantFs

func (n *Mul) ConvertToConstantFs(cs []float64) Expr

func (*Mul) ConvertToConstants

func (n *Mul) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Mul) DerivConst

func (n *Mul) DerivConst(i int) Expr

func (*Mul) DerivVar

func (n *Mul) DerivVar(i int) Expr

func (*Mul) Eval

func (n *Mul) Eval(t float64, x, c, s []float64) float64

func (*Mul) ExprType

func (n *Mul) ExprType() ExprType

func (*Mul) GetExpr

func (n *Mul) GetExpr(pos *int) Expr

func (*Mul) Insert

func (a *Mul) Insert(e Expr)

func (*Mul) Javascript

func (n *Mul) Javascript(dnames, snames []string, cvals []float64) string

func (*Mul) Latex

func (n *Mul) Latex(dnames, snames []string, cvals []float64) string

func (*Mul) Len

func (n *Mul) Len() int

func (*Mul) Less

func (n *Mul) Less(i, j int) bool

func (*Mul) PrettyPrint

func (n *Mul) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Mul) Serial

func (n *Mul) Serial(sofar []int) []int

func (*Mul) SetExpr

func (n *Mul) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Mul) Simplify

func (n *Mul) Simplify(rules SimpRules) Expr

func (*Mul) Sort

func (n *Mul) Sort()

func (*Mul) StackSerial

func (n *Mul) StackSerial(sofar []int) []int

func (*Mul) String

func (n *Mul) String() string

func (*Mul) Swap

func (n *Mul) Swap(i, j int)

type N_ary

type N_ary struct {
	ExprStats
	CS []Expr
}

func (*N_ary) CalcExprStats

func (n *N_ary) CalcExprStats()

func (*N_ary) DerivConst

func (n *N_ary) DerivConst(i int) Expr

func (*N_ary) DerivVar

func (n *N_ary) DerivVar(i int) Expr

func (*N_ary) HasConst

func (n *N_ary) HasConst() bool

func (*N_ary) HasConstI

func (n *N_ary) HasConstI(i int) bool

func (*N_ary) HasVar

func (n *N_ary) HasVar() bool

func (*N_ary) HasVarI

func (n *N_ary) HasVarI(i int) bool

func (*N_ary) NumConstants

func (n *N_ary) NumConstants() int

func (*N_ary) NumVar

func (n *N_ary) NumVar() int

func (*N_ary) Simplify

func (n *N_ary) Simplify(rules SimpRules) Expr

type Neg

type Neg struct {
	Unary
}

Unary Operators

func NewNeg

func NewNeg(e Expr) *Neg

func (*Neg) AmIAlmostSame

func (u *Neg) AmIAlmostSame(r Expr) bool

func (*Neg) AmIEqual

func (u *Neg) AmIEqual(r Expr) bool

func (*Neg) AmILess

func (u *Neg) AmILess(r Expr) bool

func (*Neg) AmISame

func (u *Neg) AmISame(r Expr) bool

func (*Neg) Clone

func (u *Neg) Clone() Expr

func (*Neg) ConvertToConstantFs

func (u *Neg) ConvertToConstantFs(cs []float64) Expr

func (*Neg) ConvertToConstants

func (u *Neg) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Neg) DerivConst

func (u *Neg) DerivConst(i int) Expr

func (*Neg) DerivVar

func (u *Neg) DerivVar(i int) Expr

func (*Neg) Eval

func (u *Neg) Eval(t float64, x, c, s []float64) float64

func (*Neg) ExprType

func (u *Neg) ExprType() ExprType

func (*Neg) GetExpr

func (u *Neg) GetExpr(pos *int) Expr

func (*Neg) Javascript

func (u *Neg) Javascript(dnames, snames []string, cvals []float64) string

func (*Neg) Latex

func (u *Neg) Latex(dnames, snames []string, cvals []float64) string

func (*Neg) PrettyPrint

func (u *Neg) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Neg) Serial

func (u *Neg) Serial(sofar []int) []int

func (*Neg) SetExpr

func (u *Neg) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Neg) Simplify

func (u *Neg) Simplify(rules SimpRules) (ret Expr)

func (*Neg) Sort

func (u *Neg) Sort()

func (*Neg) StackSerial

func (u *Neg) StackSerial(sofar []int) []int

func (*Neg) String

func (u *Neg) String() string

type Null

type Null struct {
	ExprStats
}

Null Leaf (shouldn't really appear) This is a sample for the other node types

func NewNull

func NewNull() *Null

func (*Null) AmIAlmostSame

func (n *Null) AmIAlmostSame(r Expr) bool

func (*Null) AmIEqual

func (n *Null) AmIEqual(r Expr) bool

func (*Null) AmILess

func (n *Null) AmILess(r Expr) bool

func (*Null) AmISame

func (n *Null) AmISame(r Expr) bool

func (*Null) CalcExprStats

func (n *Null) CalcExprStats()

func (*Null) Clone

func (n *Null) Clone() Expr

func (*Null) ConvertToConstantFs

func (n *Null) ConvertToConstantFs(cs []float64) Expr

func (*Null) ConvertToConstants

func (n *Null) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Null) DerivConst

func (n *Null) DerivConst(i int) Expr

func (*Null) DerivVar

func (n *Null) DerivVar(i int) Expr

func (*Null) Eval

func (n *Null) Eval(t float64, x, c, s []float64) float64

func (*Null) ExprType

func (n *Null) ExprType() ExprType

func (*Null) GetExpr

func (n *Null) GetExpr(pos *int) Expr

func (*Null) HasConst

func (n *Null) HasConst() bool

func (*Null) HasConstI

func (n *Null) HasConstI(i int) bool

func (*Null) HasVar

func (n *Null) HasVar() bool

func (*Null) HasVarI

func (n *Null) HasVarI(i int) bool

func (*Null) Javascript

func (n *Null) Javascript(dnames, snames []string, cvals []float64) string

func (*Null) Latex

func (n *Null) Latex(dnames, snames []string, cvals []float64) string

func (*Null) NumConstants

func (n *Null) NumConstants() int

func (*Null) NumVar

func (n *Null) NumVar() int

func (*Null) PrettyPrint

func (n *Null) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Null) Serial

func (n *Null) Serial(sofar []int) []int

func (*Null) SetExpr

func (n *Null) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Null) Simplify

func (n *Null) Simplify(rules SimpRules) Expr

func (*Null) Sort

func (n *Null) Sort()

func (*Null) StackSerial

func (n *Null) StackSerial(sofar []int) []int

func (*Null) String

func (n *Null) String() string

type PowE

type PowE struct {
	ExprStats
	Base  Expr
	Power Expr
}

func NewPowE

func NewPowE(b, p Expr) *PowE

func (*PowE) AmIAlmostSame

func (n *PowE) AmIAlmostSame(r Expr) bool

func (*PowE) AmIEqual

func (n *PowE) AmIEqual(r Expr) bool

func (*PowE) AmILess

func (n *PowE) AmILess(r Expr) bool

func (*PowE) AmISame

func (n *PowE) AmISame(r Expr) bool

func (*PowE) CalcExprStats

func (n *PowE) CalcExprStats()

func (*PowE) Clone

func (n *PowE) Clone() Expr

func (*PowE) ConvertToConstantFs

func (n *PowE) ConvertToConstantFs(cs []float64) Expr

func (*PowE) ConvertToConstants

func (n *PowE) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*PowE) DerivConst

func (n *PowE) DerivConst(i int) Expr

func (*PowE) DerivVar

func (n *PowE) DerivVar(i int) Expr

TODO TODO TODO fix me and the next one

func (*PowE) Eval

func (n *PowE) Eval(t float64, x, c, s []float64) float64

func (*PowE) ExprType

func (n *PowE) ExprType() ExprType

func (*PowE) GetExpr

func (n *PowE) GetExpr(pos *int) Expr

func (*PowE) HasConst

func (n *PowE) HasConst() bool

func (*PowE) HasConstI

func (n *PowE) HasConstI(i int) bool

func (*PowE) HasVar

func (n *PowE) HasVar() bool

func (*PowE) HasVarI

func (n *PowE) HasVarI(i int) bool

func (*PowE) Javascript

func (u *PowE) Javascript(dnames, snames []string, cvals []float64) string

func (*PowE) Latex

func (u *PowE) Latex(dnames, snames []string, cvals []float64) string

func (*PowE) NumConstants

func (n *PowE) NumConstants() int

func (*PowE) NumVar

func (n *PowE) NumVar() int

func (*PowE) PrettyPrint

func (u *PowE) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*PowE) Serial

func (n *PowE) Serial(sofar []int) []int

func (*PowE) SetExpr

func (n *PowE) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*PowE) Simplify

func (n *PowE) Simplify(rules SimpRules) Expr

func (*PowE) Sort

func (n *PowE) Sort()

func (*PowE) StackSerial

func (n *PowE) StackSerial(sofar []int) []int

func (*PowE) String

func (n *PowE) String() string

type PowF

type PowF struct {
	ExprStats
	Base  Expr
	Power float64
}

func NewPowF

func NewPowF(b Expr, f float64) *PowF

func (*PowF) AmIAlmostSame

func (u *PowF) AmIAlmostSame(r Expr) bool

func (*PowF) AmIEqual

func (u *PowF) AmIEqual(r Expr) bool

func (*PowF) AmILess

func (u *PowF) AmILess(r Expr) bool

func (*PowF) AmISame

func (u *PowF) AmISame(r Expr) bool

func (*PowF) CalcExprStats

func (u *PowF) CalcExprStats()

func (*PowF) Clone

func (u *PowF) Clone() Expr

func (*PowF) ConvertToConstantFs

func (u *PowF) ConvertToConstantFs(cs []float64) Expr

func (*PowF) ConvertToConstants

func (u *PowF) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*PowF) DerivConst

func (u *PowF) DerivConst(i int) Expr

func (*PowF) DerivVar

func (u *PowF) DerivVar(i int) Expr

func (*PowF) Eval

func (u *PowF) Eval(t float64, x, c, s []float64) float64

func (*PowF) ExprType

func (u *PowF) ExprType() ExprType

func (*PowF) GetExpr

func (u *PowF) GetExpr(pos *int) Expr

func (*PowF) HasConst

func (u *PowF) HasConst() bool

func (*PowF) HasConstI

func (u *PowF) HasConstI(i int) bool

func (*PowF) HasVar

func (u *PowF) HasVar() bool

func (*PowF) HasVarI

func (u *PowF) HasVarI(i int) bool

func (*PowF) Javascript

func (u *PowF) Javascript(dnames, snames []string, cvals []float64) string

func (*PowF) Latex

func (u *PowF) Latex(dnames, snames []string, cvals []float64) string

func (*PowF) NumConstants

func (u *PowF) NumConstants() int

func (*PowF) NumVar

func (u *PowF) NumVar() int

func (*PowF) PrettyPrint

func (u *PowF) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*PowF) Serial

func (u *PowF) Serial(sofar []int) []int

func (*PowF) SetExpr

func (u *PowF) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*PowF) Simplify

func (u *PowF) Simplify(rules SimpRules) Expr

func (*PowF) Sort

func (u *PowF) Sort()

func (*PowF) StackSerial

func (u *PowF) StackSerial(sofar []int) []int

func (*PowF) String

func (u *PowF) String() string

type PowI

type PowI struct {
	ExprStats
	Base  Expr
	Power int
}

Hmmm... Operators

func NewPowI

func NewPowI(e Expr, i int) *PowI

func (*PowI) AmIAlmostSame

func (u *PowI) AmIAlmostSame(r Expr) bool

func (*PowI) AmIEqual

func (u *PowI) AmIEqual(r Expr) bool

func (*PowI) AmILess

func (u *PowI) AmILess(r Expr) bool

func (*PowI) AmISame

func (u *PowI) AmISame(r Expr) bool

func (*PowI) CalcExprStats

func (u *PowI) CalcExprStats()

func (*PowI) Clone

func (u *PowI) Clone() Expr

func (*PowI) ConvertToConstantFs

func (u *PowI) ConvertToConstantFs(cs []float64) Expr

func (*PowI) ConvertToConstants

func (u *PowI) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*PowI) DerivConst

func (u *PowI) DerivConst(i int) Expr

func (*PowI) DerivVar

func (u *PowI) DerivVar(i int) Expr

func (*PowI) Eval

func (u *PowI) Eval(t float64, x, c, s []float64) float64

func (*PowI) ExprType

func (u *PowI) ExprType() ExprType

func (*PowI) GetExpr

func (u *PowI) GetExpr(pos *int) Expr

func (*PowI) HasConst

func (u *PowI) HasConst() bool

func (*PowI) HasConstI

func (u *PowI) HasConstI(i int) bool

func (*PowI) HasVar

func (u *PowI) HasVar() bool

func (*PowI) HasVarI

func (u *PowI) HasVarI(i int) bool

func (*PowI) Javascript

func (u *PowI) Javascript(dnames, snames []string, cvals []float64) string

func (*PowI) Latex

func (u *PowI) Latex(dnames, snames []string, cvals []float64) string

func (*PowI) NumConstants

func (u *PowI) NumConstants() int

func (*PowI) NumVar

func (u *PowI) NumVar() int

func (*PowI) PrettyPrint

func (u *PowI) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*PowI) Serial

func (u *PowI) Serial(sofar []int) []int

func (*PowI) SetExpr

func (u *PowI) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*PowI) Simplify

func (u *PowI) Simplify(rules SimpRules) Expr

func (*PowI) Sort

func (u *PowI) Sort()

func (*PowI) StackSerial

func (u *PowI) StackSerial(sofar []int) []int

func (*PowI) String

func (u *PowI) String() string

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 NewSin

func NewSin(e Expr) *Sin

func (*Sin) AmIAlmostSame

func (u *Sin) AmIAlmostSame(r Expr) bool

func (*Sin) AmIEqual

func (u *Sin) AmIEqual(r Expr) bool

func (*Sin) AmILess

func (u *Sin) AmILess(r Expr) bool

func (*Sin) AmISame

func (u *Sin) AmISame(r Expr) bool

func (*Sin) Clone

func (u *Sin) Clone() Expr

func (*Sin) ConvertToConstantFs

func (u *Sin) ConvertToConstantFs(cs []float64) Expr

func (*Sin) ConvertToConstants

func (u *Sin) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Sin) DerivConst

func (u *Sin) DerivConst(i int) Expr

func (*Sin) DerivVar

func (u *Sin) DerivVar(i int) Expr

func (*Sin) Eval

func (u *Sin) Eval(t float64, x, c, s []float64) float64

func (*Sin) ExprType

func (u *Sin) ExprType() ExprType

func (*Sin) GetExpr

func (u *Sin) GetExpr(pos *int) Expr

func (*Sin) Javascript

func (u *Sin) Javascript(dnames, snames []string, cvals []float64) string

func (*Sin) Latex

func (u *Sin) Latex(dnames, snames []string, cvals []float64) string

func (*Sin) PrettyPrint

func (u *Sin) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Sin) Serial

func (u *Sin) Serial(sofar []int) []int

func (*Sin) SetExpr

func (u *Sin) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Sin) Simplify

func (u *Sin) Simplify(rules SimpRules) (ret Expr)

func (*Sin) Sort

func (u *Sin) Sort()

func (*Sin) StackSerial

func (u *Sin) StackSerial(sofar []int) []int

func (*Sin) String

func (u *Sin) String() string

type Sqrt

type Sqrt struct {
	Unary
}

func NewSqrt

func NewSqrt(e Expr) *Sqrt

func (*Sqrt) AmIAlmostSame

func (u *Sqrt) AmIAlmostSame(r Expr) bool

func (*Sqrt) AmIEqual

func (u *Sqrt) AmIEqual(r Expr) bool

func (*Sqrt) AmILess

func (u *Sqrt) AmILess(r Expr) bool

func (*Sqrt) AmISame

func (u *Sqrt) AmISame(r Expr) bool

func (*Sqrt) Clone

func (u *Sqrt) Clone() Expr

func (*Sqrt) ConvertToConstantFs

func (u *Sqrt) ConvertToConstantFs(cs []float64) Expr

func (*Sqrt) ConvertToConstants

func (u *Sqrt) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Sqrt) DerivConst

func (u *Sqrt) DerivConst(i int) Expr

func (*Sqrt) DerivVar

func (u *Sqrt) DerivVar(i int) Expr

func (*Sqrt) Eval

func (u *Sqrt) Eval(t float64, x, c, s []float64) float64

func (*Sqrt) ExprType

func (u *Sqrt) ExprType() ExprType

func (*Sqrt) GetExpr

func (u *Sqrt) GetExpr(pos *int) Expr

func (*Sqrt) Javascript

func (u *Sqrt) Javascript(dnames, snames []string, cvals []float64) string

func (*Sqrt) Latex

func (u *Sqrt) Latex(dnames, snames []string, cvals []float64) string

func (*Sqrt) PrettyPrint

func (u *Sqrt) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Sqrt) Serial

func (u *Sqrt) Serial(sofar []int) []int

func (*Sqrt) SetExpr

func (u *Sqrt) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Sqrt) Simplify

func (u *Sqrt) Simplify(rules SimpRules) (ret Expr)

func (*Sqrt) Sort

func (u *Sqrt) Sort()

func (*Sqrt) StackSerial

func (u *Sqrt) StackSerial(sofar []int) []int

func (*Sqrt) String

func (u *Sqrt) String() string

type System

type System struct {
	Leaf
	P int
}

func NewSystem

func NewSystem(i int) *System

func (*System) AmIAlmostSame

func (s *System) AmIAlmostSame(r Expr) bool

func (*System) AmIEqual

func (s *System) AmIEqual(r Expr) bool

func (*System) AmILess

func (s *System) AmILess(r Expr) bool

func (*System) AmISame

func (s *System) AmISame(r Expr) bool

func (*System) Clone

func (s *System) Clone() Expr

func (*System) ConvertToConstantFs

func (s *System) ConvertToConstantFs(cs []float64) Expr

func (*System) ConvertToConstants

func (s *System) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*System) Eval

func (sys *System) Eval(t float64, x, c, s []float64) float64

func (*System) ExprType

func (s *System) ExprType() ExprType

func (*System) GetExpr

func (s *System) GetExpr(pos *int) Expr

func (*System) Javascript

func (s *System) Javascript(dnames, snames []string, cvals []float64) string

func (*System) Latex

func (s *System) Latex(dnames, snames []string, cvals []float64) string

func (*System) PrettyPrint

func (s *System) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*System) Serial

func (s *System) Serial(sofar []int) []int

func (*System) SetExpr

func (s *System) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*System) Simplify

func (s *System) Simplify(rules SimpRules) Expr

func (*System) Sort

func (s *System) Sort()

func (*System) StackSerial

func (s *System) StackSerial(sofar []int) []int

func (*System) String

func (s *System) String() string

type Tan

type Tan struct {
	Unary
}

func NewTan

func NewTan(e Expr) *Tan

func (*Tan) AmIAlmostSame

func (u *Tan) AmIAlmostSame(r Expr) bool

func (*Tan) AmIEqual

func (u *Tan) AmIEqual(r Expr) bool

func (*Tan) AmILess

func (u *Tan) AmILess(r Expr) bool

func (*Tan) AmISame

func (u *Tan) AmISame(r Expr) bool

func (*Tan) Clone

func (u *Tan) Clone() Expr

func (*Tan) ConvertToConstantFs

func (u *Tan) ConvertToConstantFs(cs []float64) Expr

func (*Tan) ConvertToConstants

func (u *Tan) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Tan) DerivVar

func (u *Tan) DerivVar(i int) Expr

func (*Tan) Eval

func (u *Tan) Eval(t float64, x, c, s []float64) float64

func (*Tan) ExprType

func (u *Tan) ExprType() ExprType

func (*Tan) GetExpr

func (u *Tan) GetExpr(pos *int) Expr

func (*Tan) Javascript

func (u *Tan) Javascript(dnames, snames []string, cvals []float64) string

func (*Tan) Latex

func (u *Tan) Latex(dnames, snames []string, cvals []float64) string

func (*Tan) PrettyPrint

func (u *Tan) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Tan) Serial

func (u *Tan) Serial(sofar []int) []int

func (*Tan) SetExpr

func (u *Tan) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Tan) Simplify

func (u *Tan) Simplify(rules SimpRules) (ret Expr)

func (*Tan) Sort

func (u *Tan) Sort()

func (*Tan) StackSerial

func (u *Tan) StackSerial(sofar []int) []int

func (*Tan) String

func (u *Tan) String() string

type Time

type Time struct {
	Leaf
}

Leaf Nodes

func NewTime

func NewTime() *Time

func (*Time) AmIAlmostSame

func (n *Time) AmIAlmostSame(r Expr) bool

func (*Time) AmIEqual

func (n *Time) AmIEqual(r Expr) bool

func (*Time) AmILess

func (n *Time) AmILess(r Expr) bool

func (*Time) AmISame

func (n *Time) AmISame(r Expr) bool

func (*Time) Clone

func (t *Time) Clone() Expr

func (*Time) ConvertToConstantFs

func (n *Time) ConvertToConstantFs(cs []float64) Expr

func (*Time) ConvertToConstants

func (n *Time) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Time) Eval

func (*Time) Eval(t float64, x, c, s []float64) float64

func (*Time) ExprType

func (t *Time) ExprType() ExprType

func (*Time) GetExpr

func (n *Time) GetExpr(pos *int) Expr

func (*Time) Javascript

func (t *Time) Javascript(dnames, snames []string, cvals []float64) string

func (*Time) Latex

func (t *Time) Latex(dnames, snames []string, cvals []float64) string

func (*Time) PrettyPrint

func (t *Time) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Time) Serial

func (t *Time) Serial(sofar []int) []int

func (*Time) SetExpr

func (n *Time) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Time) Simplify

func (n *Time) Simplify(rules SimpRules) Expr

func (*Time) Sort

func (n *Time) Sort()

func (*Time) StackSerial

func (t *Time) StackSerial(sofar []int) []int

func (*Time) String

func (n *Time) String() string

type Unary

type Unary struct {
	ExprStats
	C Expr
}

func (*Unary) CalcExprStats

func (u *Unary) CalcExprStats()

func (*Unary) DerivConst

func (u *Unary) DerivConst(i int) Expr

func (*Unary) DerivVar

func (u *Unary) DerivVar(i int) Expr

func (*Unary) HasConst

func (u *Unary) HasConst() bool

func (*Unary) HasConstI

func (u *Unary) HasConstI(i int) bool

func (*Unary) HasVar

func (u *Unary) HasVar() bool

func (*Unary) HasVarI

func (u *Unary) HasVarI(i int) bool

func (*Unary) NumConstants

func (u *Unary) NumConstants() int

func (*Unary) NumVar

func (u *Unary) NumVar() int

func (*Unary) Simplify

func (u *Unary) Simplify(rules SimpRules) Expr

type Var

type Var struct {
	Leaf
	P int
}

func NewVar

func NewVar(i int) *Var

func (*Var) AmIAlmostSame

func (v *Var) AmIAlmostSame(r Expr) bool

func (*Var) AmIEqual

func (v *Var) AmIEqual(r Expr) bool

func (*Var) AmILess

func (v *Var) AmILess(r Expr) bool

func (*Var) AmISame

func (v *Var) AmISame(r Expr) bool

func (*Var) Clone

func (v *Var) Clone() Expr

func (*Var) ConvertToConstantFs

func (v *Var) ConvertToConstantFs(cs []float64) Expr

func (*Var) ConvertToConstants

func (v *Var) ConvertToConstants(cs []float64) ([]float64, Expr)

func (*Var) DerivVar

func (v *Var) DerivVar(i int) Expr

func (*Var) Eval

func (v *Var) Eval(t float64, x, c, s []float64) float64

func (*Var) ExprType

func (v *Var) ExprType() ExprType

func (*Var) GetExpr

func (v *Var) GetExpr(pos *int) Expr

func (*Var) HasVar

func (v *Var) HasVar() bool

func (*Var) HasVarI

func (v *Var) HasVarI(i int) bool

func (*Var) Javascript

func (v *Var) Javascript(dnames, snames []string, cvals []float64) string

func (*Var) Latex

func (v *Var) Latex(dnames, snames []string, cvals []float64) string

func (*Var) NumVar

func (v *Var) NumVar() int

func (*Var) PrettyPrint

func (v *Var) PrettyPrint(dnames, snames []string, cvals []float64) string

func (*Var) Serial

func (v *Var) Serial(sofar []int) []int

func (*Var) SetExpr

func (v *Var) SetExpr(pos *int, e Expr) (replace_me, replaced bool)

func (*Var) Simplify

func (v *Var) Simplify(rules SimpRules) Expr

func (*Var) Sort

func (v *Var) Sort()

func (*Var) StackSerial

func (v *Var) StackSerial(sofar []int) []int

func (*Var) String

func (v *Var) String() string

Jump to

Keyboard shortcuts

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