2 /* LRATS FASL contains two functions related to MACSYMA's
3 RATSUBST. The first is LRATSUBST(LIST_OF_EQUATIONS,EXP)
4 which provides the user with a RATSUBST capability for
5 multiple substitution similar to the existing capability
6 of SUBST. Recall that SUBST can carry out multiple substi-
9 /* LRATSUBST works in an analogous way: */
10 lratsubst([a^2=b,c^2=d],(a+e)*c*(a+c));
11 /* If only one substitution is desired, then a single
12 equation may be given as first argument: */
14 /* Another function contained in LRATS FASL is FULLRATSUBST,
15 which is equivalent to RATSUBST except that it recurses until
16 its result stops changing. Note the difference between the
18 ratsubst(b*a,a^2,a^3);
19 fullratsubst(b*a,a^2,a^3);
20 /* FULLRATSUBST will also accept a list of equations or a single
21 equation as first argument. */
22 fullratsubst([a^2=b,b^2=c,c^2=a],a^3*b*c);
23 fullratsubst(a^2=b*a,a^3);
24 /* FULLRATSUBST can be dangerous, so care must be taken to avoid
25 infinite recursion. An example of the kind of difficulty
26 that can arise is given below: */
27 /* runs out of core in DOE MACSYMA without GC */
28 errcatch(fullratsubst(b*a^2,a^2,a^3));