PackageTrack
Sign in Get early access

math_expressions

A library for parsing and evaluating mathematical expressions, supporting real numbers, vectors, and basic interval arithmetic.

3.2.0 104K downloads/mo #1106 most downloaded on pub.dev fkleon/math-expressions

What this package is like to depend on

Last release 26 days ago

29 Jul 2026

Ships fairly regularly

a new release about every 5 months

Nearly every release is documented

notes for 33 of 33 stable releases

Nothing withdrawn

no release was ever pulled

13 years old

37 releases · first in 2013

1 release in the last 12 months

see the full history below

Release timeline

37 releases · Oct 2013 to Jul 2026
2014 2016 2018 2020 2022 2024 2026
Release Pre-release

Releases

latest 37
  1. 3.2.0 29 Jul 2026
    Release notes

    Added

    • Add support for implicit multiplication to GrammarParser.
    • Add useTraditionalMathDefinitions option to RealEvaluator to return double.nan for mathematically undefined operations (e.g. division by zero, 0^0, tan(pi/2)) instead of following Dart's default floating-point behavior.
    Open source →
  2. 3.1.0 29 Jun 2025
    Release notes

    Changed

    • Require Dart 3.8.
    • Update petitparser dependency to 7.x.
    Open source →
  3. 3.0.0 13 Jun 2025
    Release notes

    Added

    • Add support for listing all variables in an Expression with the VariableCollector visitor. #73

    • Add support for evaluating an Expression with the visitor interface: RealEvaluator (as real number), IntervalEvaluator (as interval), VectorEvalutor (as vector). This offers a strongly typed interface and replaces Expression.evaluate():

      // Old
      dynamic result = expression.evaluate(EvaluationType.REAL, context);
      
      // New
      var evaluator = RealEvaluator(context);
      int result = evaluator.evaluate(expression);
      

    Changed

    • The Rootfunction now accepts an Expression as degree.
    • Handler functions passed to AlgorithmicFunction can no longer be dynamically typed.

    Deprecated

    • The Expression.evaluate() method. Use RealEvaluator instead.
    Open source →
  4. 2.7.0 05 Feb 2025
    Release notes

    Added

    • Rewrite of the expression parser, available as GrammarParser.
      • Add support for constants: e, pi, ln10, ln2, log10e, log2e, sqrt1_2 and sqrt2.
      • Custom constant symbols are supported via ParserOptions.
      • Identifier naming is more restrictive. Names must start with a letter or $, followed by any number of word characters (letter or digit).
      • This library now depends on petitparser.

    Deprecated

    • The old expression parser is now deprecated. It is still exposed under the type alias Parser to maintain backwards compatibility.

    Fixed

    • Exception when define variable Number with character "e" #82
    • Suppress conversion into e function #61
    • Variables should resolve before keywords. #31
    Open source →
  5. 2.7.0-rc.3 03 Feb 2025 pre-release
    Release notes

    Added

    • Add support for additional constants to GrammarParser: ln10, ln2, log10e, log2e, sqrt1_2 and sqrt2.
    • Add ability to specify custom constants through ParserOptions: This enables parsing of constant symbols that do not match the allowed variable identifier naming schema.
    Open source →
  6. 2.7.0-rc.2 02 Feb 2025 pre-release
    Release notes

    Added

    • Add support for n-th root function to GrammarParser.

    Fixed

    • Tighten dependency constraints to fix issue with lower bounds dependencies.
    Open source →
  7. 2.7.0-rc.1 01 Feb 2025 pre-release
    Release notes

    Added

    • Add a modern grammar-based expression parser. This is opt-in at this stage, and can be used by instantiating a GrammarParser instead of the legacy Parser. The new parser fixes some long-standing issues with expression parsing, but is still missing a few features that were previously supported by the legacy parser:
      • Implicit multiplication is not supported yet.
      • Parsing of the n-th root function is not supported yet.
      • Identifier naming is more restrictive, names must start with a letter or $, followed by any number of word characters (letter or digit). This is mostly relevant for user-provided identifiers (algorithmic functions and variables).
    • Add support for parsing constants, with initial support for piand e (Euler's constant). #26

    Deprecated

    • Renamed the existing expression parser to ShuntingYardParser. This parser is now in maintenance mode and will not receive any new features. Parser remains as a deprecated type alias to this legacy implementation to maintain backwards compatibility.

    Fixed

    • Exception when define variable Number with character "e" #82
    • Suppress conversion into e function #61
    • Variables should resolve before keywords. #31
    Open source →
  8. 2.6.0 31 Jul 2024
    Release notes

    Added

    • Add parser support for implicit multiplication (thanks juca1331)

    Changed

    • Drop support for Dart SDK versions below 3.1.0
    Open source →
  9. 2.5.0 15 Apr 2024
    Release notes

    Added

    Changed

    • Drop support for Dart SDK versions below 3.0.0
    • Refactor unit test suites and improve test coverage
    • Switch from pedantic to the official Dart lint rules
    Open source →
  10. 2.4.0 05 Apr 2023
    Release notes

    Added

    • Add UnaryPlus operator (thanks jpnurmi)

    Changed

    • Improve evaluation of unary minus as an exponent of a power (thanks edhom)
    • Use markdown LaTeX instead of images in README (thanks dvirberlo)
    Open source →
  11. 2.3.1 30 May 2022
    Release notes

    Changed

    • Evaluate roots written as powers correctly for negative bases (thanks edhom)
    Open source →
  12. 2.3.0 20 Dec 2021
    Release notes

    Added

    Changed

    Open source →
  13. 2.2.0 04 Aug 2021
    Release notes
    • Add algorithmic function that is bound to a Dart handler function, including parser support (thanks kamimark)
    Open source →
  14. 2.1.1 02 May 2021
    Release notes
    • Fix inaccuracies in sin/cos/tan when using math.pi (machine pi) (thanks mbullington)
    Open source →
  15. 2.1.0 16 Mar 2021
    Release notes
    • Bumped to stable release.
    Open source →
  16. 2.1.0-nullsafety.0 12 Mar 2021 pre-release
    Release notes
    • Drop support for Dart SDK versions below 2.12.0
    • Migrate to null safety (thanks albertodev01)
    Open source →
  17. 2.0.2 08 Jan 2021
    Release notes
    • Lower precedence of unary minus below power operator to match common mathematics conventions so that -x^y is parsed as -(x^y) instead of (-x)^y
    Open source →
  18. 2.0.1 07 Sep 2020
    Release notes
    • Add ability to unbind variable names (by wdavies973)
    • Fix parsing of ceil function (by pepsin)
    Open source →
  19. 2.0.0 08 Mar 2020
    Release notes
    • Drop support for Dart SDK versions below 2.1.1
    • Enable unnecessary_new lint rule
    • Parser throws FormatException instead of StateError or ArgumentError for invalid input string
    • Remove underscore syntax previously supported for unary minus
    • Fix toString() parser compatibility for the following expressions:
      • Logarithm function: Change string representation from log_b(x) to log(b, x)
      • N-th root function: Change string representation from nrt_n(x) to nrt(n, x)
      • Exponential function: Change string representation from exp(x) to e(x)
    Open source →
  20. 1.1.1 16 Apr 2019
    Release notes
    • Package health and maintenance cleanups
    Open source →
  21. 1.1.0 16 Apr 2019
    Release notes
    • Drop support for Dart SDK versions below 2.0.0
    • Add arcsin, arccos, arctan functions
    • Fix floor and ceil functions
    • Update examples and documentation
    • Switch to pedantic analysis options
    Open source →
  22. 1.0.0 10 Aug 2018
    Release notes
    • Add support for Dart 2.0
    • Drop support for Dart SDK versions below 1.24.0
    • Depend on vector_math 2.0.0 or newer
    Open source →
  23. 0.4.0 10 Aug 2018
    Release notes
    • Last release to only support Dart 1.x
    • Prepare for Dart 2.0
    • Enable strong mode
    • Analyzer and linter fixes
    • Drop support for Dart SDK versions below 1.21.0
    Open source →
  24. 0.3.0 09 Jul 2016
    Release notes
    • Rename Point3D to Point3
    • Point3 now is a subtype of Vector3
    • Add mod (%) operator and ceil, floor functions
    • Fixing a few missed chain rules in derive
    Open source →
  25. 0.2.0 19 Nov 2015
    Release notes
    • Add support for basic vector operations
    • Switch to using test instead of unittest package
    • Warning: Depends on git version of vector_math as latest pub release is severely outdated
    Open source →
  26. 0.2.0+1 30 Dec 2015
    Release notes
    • Depend on vector_math 1.4.4 or greater
    Open source →
  27. 0.1.0 19 Jul 2014
    Release notes
    • Add absolute value function (by markhats)
    • Add sign function
    • Improve test coverage
    • Adapt string representation of unary minus to standard syntax
    Open source →
  28. 0.0.9 30 Mar 2014
    Release notes
    • To create exponentials, use e(x) or e^x. Consequently, removed support for exp(x).
    • Improve test coverage
    • Update dependencies
    Open source →
  29. 0.0.8 10 Dec 2013
    Release notes
    • Bring back standard syntax for unary minus: -5 works now. (by markhats)
    • Add parser support for e^x additional to exp(x). (by markhats)
    Open source →
  30. 0.0.7 09 Nov 2013
    Release notes
    • Introduce nested context/naming scopes
    • Improve vector evaluation
    • Add some missing methods
    • Improve test coverage (custom and composite functions)
    • Remove boilerplate code
    Open source →
  31. 0.0.6 07 Nov 2013
    Release notes
    • Add compose operator for functions: Use & to conveniently create a CompositeFunction from two existing functions: expr = f & g;
    • Improve documentation and dartdoc generation
    Open source →
  32. 0.0.5 07 Nov 2013
    Release notes
    • Minor code cleanup
    • Prepare for Dart 1.0
    Open source →
  33. 0.0.4 11 Oct 2013
    Release notes
    • Fix handling of operator associativity
    • Add support for default functions to parser
    • Add support for unary minus to parser: Input with underscore. Instead of 2*-5 use 2*_5.
    Open source →
  34. 0.0.3 09 Oct 2013
    Release notes
    • Add cli evaluator to examples
    • Improve test coverage
    • Fix bug in differentiation of Sin and Cos
    • Remove support of unary minus in Parser
    Open source →
  35. 0.0.2 07 Oct 2013
    Release notes
    • Improve test coverage
    • Improve documentation
    • Fix bug in simplification of Minus
    • Fix bug in simplification of Times
    • Implement evaluation of nth root
    Open source →
  36. 0.0.1 04 Oct 2013
    Release notes
    • Initial release of standalone version
    Open source →
  37. 0.0.1+1 06 Oct 2013
    Release notes
    • Improve documentation and examples
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive