 subs - Maple Help

MTM

 subs
 substitute expressions into an expression Calling Sequence subs(e) subs(e,n) subs(e,o,n) Parameters

 e - expression n - expression o - expression Description

 • The function subs(e) is equivalent to eval(e).
 • The function subs(e,n) replaces occurences of the default variable in e with the expression n.  The default variable is determined by findsym(e,1).
 • For scalar o, the function subs(e,o,n) replaces occurences of o, in the expression e, with n. If n is a vector or matrix, then the operations ^, + and * (and therefore - and /) are performed element-wise.
 • For non-scalar o, the function subs(e,o,n), replaces each element of o with the corresponding element of n. In this case, the structure and size of o and n must be the same.  The substitution of elements occurs in series. Examples

 > $\mathrm{with}\left(\mathrm{MTM}\right):$
 > $\mathrm{subs}\left(x+y,3\right)$
 ${3}{+}{y}$ (1)
 > $\mathrm{subs}\left(x+y,y,3\right)$
 ${x}{+}{3}$ (2)
 > $\mathrm{subs}\left(xy,y,\mathrm{Array}\left(\left[\left[1,2\right],\left[3,4\right]\right]\right)\right)$
 $\left[\begin{array}{cc}{x}& {2}{}{x}\\ {3}{}{x}& {4}{}{x}\end{array}\right]$ (3)
 > $\mathrm{subs}\left(xy,\left[x,y\right],\left[\mathrm{Array}\left(\left[\left[1,2\right],\left[3,4\right]\right]\right),\mathrm{Array}\left(\left[\left[1,2\right],\left[3,5\right]\right]\right)\right]\right)$
 $\left[\begin{array}{cc}{1}& {4}\\ {9}& {20}\end{array}\right]$ (4)
 > $\mathrm{subs}\left(x+y+z,\left[x,y\right],\left[y,z\right]\right)$
 ${3}{}{z}$ (5)
 > $\mathrm{subs}\left(x+y+z,\left[x,y\right],\left[z,x\right]\right)$
 ${2}{}{z}{+}{x}$ (6)