By Eduardo Stern
From Newton's fluxions to modern numerical methods
Symbolic calculus • Numerical solving • Pure C99
Free for non-commercial • $299/year commercial
#include "parser.h"
#include "ast.h"
// Simple expressions
double result = parse_expression("2 + 3 * 4");
// => 14.0
// With variables
double vals[] = {5.0, 10.0};
VarContext ctx = {.values = vals, .count = 2};
result = parse_expression_with_vars("a + b * 2", &ctx);
// => 25.0
// Symbolic differentiation
ASTNode *expr = parse_to_ast("x^2 + 3*x");
ASTNode *deriv = ast_differentiate(expr, "x");
// => 2*x + 3
// Numerical solving: sin(x) = 0.5
ASTNode *eq = parse_to_ast("sin(x) - 0.5");
NumericalSolveResult r = ast_solve_numerical(
eq, "x", 0.5, 1e-12, 100
);
// x = 0.523599 (π/6), converges in 3 iterations
Automatic differentiation and integration. Power rule, chain rule, product/quotient rules. Handles trig, exp, log functions.
Newton-Raphson method solves ANY equation. Uses symbolic differentiation for exact derivatives. Quadratic convergence.
Compile to bytecode for 2-3x faster repeated evaluation. Stack-based VM with 18 instructions.
Thread-safe with mutex + TLS. Timeout protection against DoS. Error recovery. Input validation.
64-bit floating point throughout. Errors down to 1e-12. Tolerance of 1e-12 in comparisons.
2800+ lines of documentation. 75+ automated tests. 100% feature coverage. Real-world examples.
| Library | Lines of Code | Bytecode VM | Calculus | Numerical Solver |
|---|---|---|---|---|
| This Parser | 4,500 | ✅ Yes | ✅ Both | ✅ Yes |
| muParser | 10,000 | ❌ No | ❌ No | ❌ No |
| TinyExpr | 500 | ❌ No | ❌ No | ❌ No |
| Exprtk | 30,000 | ✅ Yes | ❌ No | ❌ No |
Verdict: Only C parser with both symbolic calculus and numerical equation solving.
Physics simulations, numerical methods, data analysis
Math tutors, calculus teachers, interactive learning
Risk analysis, option pricing, portfolio optimization
Scripting, formula evaluation, AI behavior
Automatic differentiation, optimization algorithms
Formula APIs, calculation engines, SaaS backends
30-day money-back guarantee on commercial licenses