#expression-parser #expression #parser #evaluator

pemel

Parsing and Evaluating of Math Expressions Library

3 unstable releases

new 0.2.1 Mar 8, 2025
0.2.0 Feb 11, 2025
0.1.0 Jan 22, 2025

#440 in Math

Download history 114/week @ 2025-01-21 2/week @ 2025-01-28 7/week @ 2025-02-04 115/week @ 2025-02-11 8/week @ 2025-02-18 7/week @ 2025-02-25 123/week @ 2025-03-04

253 downloads per month

MIT license

36KB
816 lines

PEMEL

Crates.io License

Overview

pemel is a Rust library providing a utilities for parsing and evaluating mathematical expressions.

Features

  • Basic arithmetic operations
  • Trigonometric functions
  • Exponential and logarithmic functions
  • Absolute value function
  • Evaluation with multiple variables
  • Numeric derivatives
  • Implicit evaluation during parsing
  • Substitution

Usage

Here is a simple example of how to use pemel:

use pemel::prelude::*;

fn main() {
    let input = "2 * x^2 - 5 * log(x)";
    let expr = Expr::parse(input, true).unwrap();
    let result = expr.eval_with_var("x", 10.0).unwrap();

    println!("{}", result); // Output: 195.0
}

Contributing

Untill I create a CONTRIBUTING.md file, I will not accept any pull requests.

License

This project is licensed under the MIT License. See the LICENSE file for details.

No runtime deps