subs - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


MTM

  

subs

  

substitute expressions into an expression

 

Calling Sequence

Parameters

Description

Examples

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

withMTM:

subsx+y,3

3+y

(1)

subsx+y,y,3

x+3

(2)

subsxy,y,Array1,2,3,4

x2x3x4x

(3)

subsxy,x,y,Array1,2,3,4,Array1,2,3,5

14920

(4)

subsx+y+z,x,y,y,z

3z

(5)

subsx+y+z,x,y,z,x

2z+x

(6)

See Also

eval

MTM[findsym]

MTM[times]