~ubuntu-branches/debian/squeeze/maxima/squeeze

« back to all changes in this revision

Viewing changes to share/simplification/lrats.dem

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2006-10-18 14:52:42 UTC
  • mto: (1.1.5 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20061018145242-vzyrm5hmxr8kiosf
ImportĀ upstreamĀ versionĀ 5.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
LOAD('LRATS)$
 
1
load('lrats)$
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-
7
7
        tutions: */
8
 
SUBST([A=B,C=D],A+C);
 
8
subst([a=b,c=d],a+c);
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: */
13
 
LRATSUBST(A^2=B,A^3);
 
13
lratsubst(a^2=b,a^3);
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
17
17
        two results: */
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));