axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] Re: How to expand a fraction


From: Waldek Hebisch
Subject: [Axiom-developer] Re: How to expand a fraction
Date: Sat, 27 Jan 2007 01:59:10 +0100 (CET)

Wiesner Thomas wrote:

> How can i do the following (from Maple) in Axiom:
>
>     expand(((-r1*r2*uoff)+((r2+r1)*r3+r1*r2)*ue)/(r2*r3));
>
>                          r1 uoff        ue r1   ue r1
>                        - ------- + ue + ----- + -----
>                            r3            r2      r3

Modulo term order:

(14) -> x := ((-r1*r2*uoff)+((r2+r1)*r3+r1*r2)*ue)/(r2*r3)

         - r1 r2 uoff + ((r2 + r1)r3 + r1 r2)ue
   (14)  --------------------------------------
                          r2 r3
                                            Type: Fraction Polynomial Integer
(15) -> reduce(+, [box(k/denom(x)) for k in monomials(numer(x))])

              r1 ue   r1 ue     r1 uoff
   (15)  ue + ----- + ----- + - -------
                r2      r3         r3
                                                     Type: Expression Integer

How does it work: we split fraction into numerator and denominator, then
split numerator into separate terms (using 'monomials' function).  
We divide each of the terms by the denominator and put an invisible box
around the resulting quotient.  Then we add everything back together.

Some remarks:

1) box operator prevents simplification, so careful when you use it,
   otherwise you may get unexpected results.

2) AFAIK expand command in Maple is really a cheaper version of
   simplify (it is enoungh to simplify polynomials).  More precisely,
   Maple is doing very little (no??) simplification by default,
   so you may have a complicated expression which is really 0.
   Expand gives you "canonical" form for polynomials -- if two
   polynomials are mathematically equal then the expanded forms
   are equal.  This is not needed in Axiom, Axiom normally keeps
   polynomials (and rational functions) in "canonical" form.
   If for some reasons other forms are preferable Axiom offers
   some extra domains (like Factored).

3) AFAIU what you really want is a way to control how results are
   printed.  IIRC Axiom gives only very limited control over
   formatting the output.

4) In general each systems has hardcoded ideas what looks best, and
   it can be frustrating trying (with no effect) to match output of
   the other system.
 
5) IMHO your Maple solution, the command I gave and Bill Page DMP
   trick are really abuses: all of the commands perform some
   computation and the change in printed output is a byproduct
   (possibly unintended).  I wrote above about Maple expand.
   Axiom DMP was implemented to allow efficient computation of
   Groebner bases (and some similar computation).  I know very
   little about box operator, but I suspect that it main intended
   use was _not_ to control printing.
   

-- 
                              Waldek Hebisch
address@hidden 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]