math_expressions library
A math library for parsing and evaluating expressions in real, interval and vector contexts. It also supports simplification and differentiation of expressions.
The libary supports the three basic data types Number, Interval and Vector. It includes a Parser to create Expressions from Strings.
Classes
- Abs
- The absolute value function.
- Acos
- The arcus cosine function.
- AlgorithmicFunction
- Asin
- The arcus sine function.
- Atan
- The arcus tangens function.
- BinaryOperator
- A binary operator takes two expressions and performs an operation on them.
- BoundVariable
- A bound variable is an anonymous variable, e.g. a variable without name, which is bound to an expression.
- Ceil
- The ceil function.
- CompositeFunction
- A composition of two given MathFunctions.
- ContextModel
- The context model keeps track of all known variables and functions.
- Cos
-
The cosine function. Expects input in
radians
. - CustomFunction
- A user-defined MathFunction with an arbitrary expression.
- DefaultFunction
- A default function is predefined in this library. It contains no expression because the appropriate evaluation method usually uses native Dart math code.
- Divide
- The divide operator performs a division.
- Exponential
- The exponential function.
- Expression
- Any Expression supports basic mathematical operations like addition, subtraction, multiplication, division, power and negate.
- Factorial
- simple factorial function might be expanded to the Gamma function to allow negative and complex numbers and deriving
- Floor
- The floor function.
- Interval
- An Interval is defined by its minimum and maximum values, where min <= max.
- IntervalLiteral
- An interval literal.
- Lexer
- The lexer creates tokens (see TokenType and Token) from an input string. The input string is expected to be in infix notation form. The lexer can convert an infix stream into a postfix stream (Reverse Polish Notation) for further processing by a Parser.
- Literal
- A literal can be a number, a constant or a variable.
- Ln
- The natural logarithm (log based e).
- Log
- The logarithm function.
- MathFunction
- A function with an arbitrary number of arguments.
- Minus
- The minus operator performs a subtraction.
- Modulo
- The modulo operator performs a Euclidean modulo operation, as Dart performs it. That is, a % b = a - floor(a / |b|) |b|. For positive integers, this is a remainder.
- Number
- A number is a constant number literal.
- Parser
- The Parser creates a mathematical Expression from a given input string.
- Plus
- The plus operator performs an addition.
- Point3
- A point in 3-dimensional space, which is a Vector3. This implementation supplies common mathematical operations on points.
- Power
- The power operator.
- Root
- The n-th root function. n needs to be a natural number.
- Sgn
- The sign function.
- Sin
-
The sine function. Expects input in
radians
. - Sqrt
- The square root function. A specialisation of Root.
- Tan
-
The tangens function. Expects input in
radians
. - Times
- The times operator performs a multiplication.
- Token
- A Token consists of text and has a TokenType.
- TokenType
- A token type. Access token types via the static fields.
- UnaryMinus
- The unary minus negates its argument.
- UnaryOperator
- A unary operator takes one argument and performs an operation on it.
- UnaryPlus
- Variable
- A variable is a named literal.
- Vector
- A vector of arbitrary size.
Enums
- EvaluationType
- Mathematical expressions must be evaluated under a certain EvaluationType.