Function reference · Math

subst

Replaces a variable or a subexpression with another expression.

The replacement happens everywhere: in sums, products, powers and function arguments. You can replace a whole subexpression, not only a variable.

Notation

subst(arg1, arg2, arg3)

Write it in an expression: nerdamer('subst(cos(x+1)^x,x,u)'), or in the Playground.

nerdamer.subst

nerdamer.subst(expression: ExpressionInput, value: ExpressionInput, withValue: ExpressionInput, includeNumeric: boolean): Expression

A method on the default import. Arguments can be strings, as in Notation.

Examples

A variable, everywhere it appears.

subst(cos(x+1)^x,x,u)
// → cos(1+u)^u
Open in Playground

A whole subexpression.

subst(x+1,x+1,u)
// → u
Open in Playground

← Back to Function reference