math_parser library Null safety

Parse and evaluate mathematical expressions

A simple library done for tasks like function evaluation

Example for parsing a string and calculating it with x = 20. Look at MathNodeExpression's fromString method for more info about how parsing works.

import 'package:math_parser/math_parser.dart';

void main() {
  final expression = MathNodeExpression.fromString(
    '(2x)^(e^3 + 4)',
  );
  print(expression.calc(20));
}

Classes

MathComparison
A parent class for comparisons
MathComparisonEquation
Equation
MathComparisonGreater
If Greater Comparison
MathComparisonGreaterOrEquals
If Greater or Equals Comparison
MathComparisonLess
If Less Comparison
MathComparisonLessOrEquals
If Less or Equals Comparison
MathCustomFunctions
Set of custom functions
MathCustomFunctionsImplemented
Set of custom implemented functions
MathDefinitionFunctionFreeform
Create a new freeform function
MathDefinitionFunctionFreeformImplemented
Create a new freeform function with implementation
MathExpression
Any Math-related object
MathFunction
Mathematical function
MathFunctionAcos
The acos Function
MathFunctionAcot
The acot Function
MathFunctionAsin
The asin Function
MathFunctionAtan
The atan Function
MathFunctionCos
The cos Function
MathFunctionCot
The cot Function
MathFunctionE
The Exponent in power constant
MathFunctionFreeform
Freeform function
MathFunctionLn
The ln Function
MathFunctionLog
The log Function
MathFunctionNegative
Negative value
MathFunctionSin
The sin Function
MathFunctionTan
The tan Function
MathFunctionWithTwoArguments
Mathematical function with two arguments
MathNode
Basic math expression unit
MathOperator
Mathematical operator
MathOperatorAddition
Addition operator (+)
MathOperatorDivision
Division operator (/)
MathOperatorMultiplication
Multiplication operator (*)
MathOperatorPower
The power operation
MathOperatorSubtraction
Subtraction operator (-)
MathValue
Constant value
MathValuePi
The Pi constant
MathVariable
A math variable
MathVariableValues
Variables dictionary

Extensions

MathNodeExpression
Math Expression Parser Extension

Exceptions / Errors

BracketsNotClosedException
Brackets Not Closed Exception
CantProcessExpressionException
Cant Process Expression Exception
DuplicateDeclarationException
Duplicate Declaration Exception
InvalidFunctionArgumentsDeclaration
Invalid Function Arguments Declaration
InvalidFunctionNameException
Invalid Function Name Exception
InvalidVariableNameException
Invalid Variable Name Exception
MathException
Math parsing error
MathParseException
Math Parse Exception
MissingOperatorOperandException
Missing Operator Operand Exception
OutOfRangeFunctionArgumentListException
Out Of Range Function Argument List Exception
ParsingFailedException
Parsing Failed Exception
UndefinedFunctionException
Undefined Function Exception
UndefinedVariableException
Undefined Variable Exception
UnexpectedClosingBracketException
Unexpected Closing Bracket Exception
UnknownOperationException
Unknown Operation Exception