parse

parse(expr)

parse(expr, options)

parse([expr1, expr2, expr3, ...])

parse([expr1, expr2, expr3, ...], options)

Try it yourself:

See also:

parse(): turn expression text into a calculation

parse(text) reads mathematical text and produces an expression that can be evaluated or transformed. It is the bridge between calculator input and structured mathematics.

Example

Parsing 2 * (x + 1) preserves its operators and grouping. It is safer than trying to manipulate a formula with ordinary text replacement.

Workflow

Use evaluate() to calculate a parsed expression, simplify() to transform it, and numeric() for an approximation. parser() supports a reusable evaluation context.

Caveat

Treat untrusted expression text carefully. Validate expected variables and syntax before evaluating it in a wider application.

All functions