Examples:
e1 := x^2 - x - 6 s2 := subs(x=2, e1) s4 := subs(x=4, e1) s10 := subs(x=1/7, e1) d10 := evalf(s10)
Comment: Note that the original expression e1 is not changed by the subs command. Each execution of the subs command produces its own new result.
e2 := subs(x=z+3, e1) t2 := subs(z=2, e2) t4 := subs(z=4, e2) t10 := subs(z=1/7, e2)
Comment: In the first subs command a new mathematical expression is substituted for x. In the next commands, numerical values are substituted, demonstrating that the subs command will substitute whatever you ask it to substitute.
e3 := subs(x=z^2→-z-6, e1) u3 := subs(z=3/7→, e3) evalf(u3)
e3 := subs(x=z^2→-z-6, e1)
Right-click
e3
and selectEvaluate at a point
to substitutez=3/7
, then right-click the result and name it u3. Now right-click the result and selectApproximate
with 10 digits to obtain the decimal result.Comment: The two different ways to substitute values can be intermixed and the result is the same. Example 3 performs the same tasks but with only commands