LOAD('LRATS)$ /* LRATS FASL contains two functions related to MACSYMA's RATSUBST. The first is LRATSUBST(LIST_OF_EQUATIONS,EXP) which provides the user with a RATSUBST capability for multiple substitution similar to the existing capability of SUBST. Recall that SUBST can carry out multiple substi- tutions: */ SUBST([A=B,C=D],A+C); /* LRATSUBST works in an analogous way: */ LRATSUBST([A^2=B,C^2=D],(A+E)*C*(A+C)); /* If only one substitution is desired, then a single equation may be given as first argument: */ LRATSUBST(A^2=B,A^3); /* Another function contained in LRATS FASL is FULLRATSUBST, which is equivalent to RATSUBST except that it recurses until its result stops changing. Note the difference between the two results: */ RATSUBST(B*A,A^2,A^3); FULLRATSUBST(B*A,A^2,A^3); /* FULLRATSUBST will also accept a list of equations or a single equation as first argument. */ FULLRATSUBST([A^2=B,B^2=C,C^2=A],A^3*B*C); FULLRATSUBST(A^2=B*A,A^3); /* FULLRATSUBST can be dangerous, so care must be taken to avoid infinite recursion. An example of the kind of difficulty that can arise is given below: */ /* runs out of core in DOE MACSYMA without GC */ ERRCATCH(FULLRATSUBST(B*A^2,A^2,A^3));