Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultVars = Vars{ "e": complex(math.E, 0), "pi": complex(math.Pi, 0), "phi": complex(math.Phi, 0), }
View Source
var ErrNoOperand = fmt.Errorf("no operand")
View Source
var MinusOneNode = &Number{val: -1 + 0i}
View Source
var OneNode = &Number{val: 1 + 0i}
View Source
var OpPrec = map[Operator]int{
FuncOp: 1,
MultiplyOp: 2,
DivideOp: 2,
PowerOp: 3,
MinusOp: 4,
}
View Source
var TwoNode = &Number{val: 2 + 0i}
View Source
var ZeroNode = &Number{val: 0 + 0i}
Functions ¶
This section is empty.
Types ¶
type Expr ¶
type Expr struct {
// contains filtered or unexported fields
}
func (*Expr) Calc ¶
func (n *Expr) Calc(x complex128, vars Vars) (complex128, error)
func (*Expr) Derivative ¶
type Func ¶
type Func struct {
// contains filtered or unexported fields
}
func (*Func) Calc ¶
func (n *Func) Calc(x complex128, vars Vars) (complex128, error)
func (*Func) Derivative ¶
type Function ¶
type Function struct { Vars // contains filtered or unexported fields }
func (*Function) Calc ¶
func (f *Function) Calc(x complex128) (complex128, error)
func (*Function) Derivative ¶
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer is the state for the lexer.
func (*Lexer) Err ¶
Err returns the error encountered during lexing, this is often io.EOF but also other errors can be returned.
type Node ¶
type Node interface { String() string LaTeX() string Equal(Node) bool Derivative() Node Calc(complex128, Vars) (complex128, error) }
type Number ¶
type Number struct {
// contains filtered or unexported fields
}
func (*Number) Calc ¶
func (n *Number) Calc(x complex128, vars Vars) (complex128, error)
func (*Number) Derivative ¶
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
func ParseErrorf ¶
func ParseErrorf(pos int, format string, args ...interface{}) ParseError
func (ParseError) Error ¶
func (pe ParseError) Error() string
func (ParseError) Pos ¶
func (pe ParseError) Pos() int
type TokenType ¶
type TokenType uint32
TokenType determines the type of token, eg. a number or a semicolon.
type UnaryExpr ¶
type UnaryExpr struct {
// contains filtered or unexported fields
}
func (*UnaryExpr) Calc ¶
func (n *UnaryExpr) Calc(x complex128, vars Vars) (complex128, error)
func (*UnaryExpr) Derivative ¶
type Variable ¶
type Variable struct {
// contains filtered or unexported fields
}
func (*Variable) Calc ¶
func (n *Variable) Calc(x complex128, vars Vars) (complex128, error)
func (*Variable) Derivative ¶
Click to show internal directories.
Click to hide internal directories.