Function reference · Math
subst
Substitutes one expression for another inside an expression tree.
subst(expression,value,replacement) replaces matching variables or supported compound subexpressions while preserving the surrounding symbolic structure. The substitution recurses into sums, products, functions, and powers.
It can replace more than a single symbol when the requested subexpression can be matched structurally.
Examples
These examples use Nerdamer Notation.
Replace a variable throughout nested structure.
subst(cos(x+1)^x,x,u) // → cos(1+u)^u
Replace a complete subexpression.
subst(x+1,x+1,u) // → u
Interfaces
The same operation is available through the interfaces below.
Nerdamer Notation
Use this form inside input passed to nerdamer(...).
subst(arg1, arg2, arg3)
nerdamer.subst
Call the operation through the default nerdamer import.
nerdamer.subst(expression: ExpressionInput, value: ExpressionInput, withValue: ExpressionInput, includeNumeric: boolean): Expression
Parameters
| Name | Type | Description |
|---|---|---|
expression | ExpressionInput | The expression being used to perform the substitution |
value | ExpressionInput | The value currently in the expression |
withValue | ExpressionInput | The value that the substitution is being replaced with |
includeNumeric | boolean | — |
