Function reference · Math
parens
Wraps an expression in explicit parentheses for output.
parens creates a grouping node whose main purpose is preserving visible parentheses in formatted output. It does not change the mathematical value of the wrapped expression.
Examples
These examples use Nerdamer Notation.
Preserve explicit grouping around a sum.
parens(x+1)
// → (1+x)Keep the grouped sum visible when it is multiplied.
2*parens(x+1)
// → 2*(1+x)Preserve the grouped base of a power.
parens(a+b)^2
// → (a+b)^2Interfaces
The same operation is available through the interfaces below.
Nerdamer Notation
Use this form inside input passed to nerdamer(...).
parens(arg1)
nerdamer.parens
Call the operation through the default nerdamer import.
nerdamer.parens(x: ExpressionInput): Expression
Parameters
| Name | Type | Description |
|---|---|---|
x | ExpressionInput | The expression to wrap. |
Returns
Expression — A parenthesised form of x.
