You're not reading the latest revision of this page, which is here.

Substitute

Creates a new function that is the composition of two other functions.

1
\substitute[<action>]{<variable>}{<expression>}{<free_variable>}{<substitute>}
  • action, variable and expression are identical to the input of a \function command.
  • free_variable defines the free variable in the given expression.
  • substitute must be an earlier defined variable. The free_variable will be replaced with the substitute variable.
  • $$h = f \circ g$$ is the output of
1
\substitute{h}{f}{x}{g}
  • This command can also be used to determine the value of a given function at a specific point $$x_0$$ (using a constant function variable). For example, $$6^4 - 5 \cdot 6^3 + 4 \cdot 6^2 + 3 \cdot 6 + 7$$ could be the output of
1
2
3
\function{f}{x^4 - 5x^3 + 4x^2 + 3x + 7}    % defines a function named f  
\randint{x0}{2}{9}                          % point where f is to be evaluated
\substitute{fx0}{f}{x}{x0}                  % this is the function f at point x_0
You can also normalize, expand, sort and calculate the \derivative and \substitute command. They take the same option *action* as a normal \function. In fact, you would often want to normalize a derivative, compare the following output with the earlier example shown for derivative. $$f_1 = 4x^3 + 6x^2$$ is the output of \derivative[normalize]{f_1}{x^4 + 2*x^3}{x}