Previous Up Next

6.12.18  Substituting a variable by a value: subst

The subst command replaces specified variables in an expression by specified values. Unlike the | operator, the subst command evaluates the expression before replacing the variables. Since subst does not quote its argument, in a normal evaluation process the substitution variable should be purged (see Section 5.4.8), otherwise it will be replaced by its assigned value before substitution is done.

The subst command can specify the values of variables in two different ways.

The first way:


Examples.

The second way:


Examples.

subst may also be used to make a change of variable in an integral. In this case the integrate command (see Section 6.20.1) should be quoted (see Section 6.12.4, otherwise, the integral would be computed before substitution) or the inert form Int should be used. In both cases, the name of the integration variable must be given as an argument of Int or integrate even you are integrating with respect to x.


Examples.


Previous Up Next