`subst(a,b,c)`

:
`a`

is substituted for `b`

in `c`

. This is a powerful
function with many uses.
First, it may be used to insert numbers for variables, in the example for in der formula .

>> syms x >> a=2*sqrt(x)*exp(-x^2); >> subst(3,x,a) ans = 4.275E-4

Second, one can replace a symbolic variable by a complex term. The expression is automatically updated to the canonical format. In the following example is inserted for in .

>> syms x,z >> p=x^3+2*x^2+x+7; >> subst(z^3+2,x,p) ans = z^9+8*z^6+21*z^3+25

Finally, the term `b`

itself may be a complex expression
(in the example ). Jasymca then tries to identify this
expression in `c`

(example:
).
This is accomplished by solving the equation for
the symbolic variable in `b`

(example: ), and inserting the
solution in `c`

. This does not always succeed, or
there may be several solutions, which are returned as a vector.

>> syms x,y,z >> c=x^3*z/sqrt(z^2+1); >> d=subst(y,z^2+1,c) d = [ x^3*sqrt(y-1)/sqrt(sqrt(y-1)^2+1) -x^3*sqrt(y-1)/sqrt(sqrt(y-1)^2+1) ] >> d=trigrat(d) d = [ x^3*sqrt(y-1)/sqrt(y) -x^3*sqrt(y-1)/sqrt(y) ]

2009-03-15