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