axiom-math
[Top][All Lists]
Advanced

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

[Axiom-math] Re: Advantage of Types and different representations


From: Martin Rubey
Subject: [Axiom-math] Re: Advantage of Types and different representations
Date: 28 Mar 2007 14:05:40 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

"Ondrej Certik" <address@hidden> writes:

> > You get a normal form for free, keeping a lot of flexibility. Apart from 
> > that,
> > it is not correct that we introduce a class "Fraction Polynomial Integer". 
> > We
> > introduce a function "Fraction", a function "Polynomial" and a function
> > "Integer".
> 
> Ok, but a Fraction(a,b) is the same as Mul(a,Pow(b,-1)), and
> Polynomial is the same as Add(Pow(x,2), Mul(2,x)) etc.

Yes, but what you have is not a normal form:

x^2 - 1 = (x+1)(x-1).

> I am sorry, I have some questions regarding a terminology that you use. By
> normal form, do you mean something like a canonical form?

Something like, yes. But definitively not a hash. A normal form is a
datastructure where equality of two objects implies equality of the
corresponding datastructures.

Somewhat weaker is the existence of a zero test: you can check algorithmically
whether a given object is the zero object, or, equivalently, whether two
objects are equal.

For general expressions, one has neither.

> By ADE, do you mean this:
> 
> http://mathworld.wolfram.com/Differential-AlgebraicEquation.html
> 
> ?

Nearly, for me, F should be a (multivariate) polynomial.

> OK, but if I wanted to work with ADE - more than just multiply them together,

Ahem, how would you multiply them together? That's quite non-trivial, in
fact. Mind you: the result should have as solution the product of the solutions
of the given two equations!

> I would need to introduce a new class ADE. The same is with polynomials, like
> polynomial gcd is an algorithm, that only works for polynomials.

Another point for Axiom: in axiom, you define the gcd once. Of course, you are
free to define more efficient versions for certain domains, but you have a
default version that works for any Eucledian Domain.

> Currently, in SymPy, the input to gcd is just an expression tree and it
> checks, if it is a polynomial (and computes gcd), otherwise raises an
> exception.

And in Axiom, you do not need to check.

> How are you doing this in Axiom - are you converting from the expression tree
> to introduce a type Polynomial, or do you work with the type Polynomial right
> from the beginning?

You can do, as you wish. Sometimes it is more convenient to work with
expressions in the beginning, and coerce them to a polynomial later, sometimes
(in fact, most of the time) it is better to do all computations in the ring of
polynomials.
 
> > Another example, again: how would you multiply symmetric functions in
> > SymPy? Or Maple or Mathematica, if you prefer.
> 
> What particular property do you want to get?

In Axiom you can say:

x := powerSum 5
y := powerSum 3

x*y

or 

z := SFunction([5,3])

x*y*z

And, mind that "*" does not need to check in which domain the objects x, y and
z live. It just knows. And thus I can also use the usual determinant. I gave
the example onve already:

Many CAS's can do what is given above. To show the advantages of generic
programming using types, consider the following matrix of complete symmetric
functions, written in the basis of power sum symmetric functions:

m := matrix [[complete 1, complete 0],[complete 2, complete 1]]

        +     (1)        [] +
        |                   |
   (2)  |1       1   2      |
        |- (2) + - (1 )  (1)|
        +2       2          +
                            Type: Matrix SymmetricPolynomial Fraction Integer
(3) -> determinant m

          1       1   2
   (3)  - - (2) + - (1 )
          2       2
                                   Type: SymmetricPolynomial Fraction Integer

Note that Axiom uses the product in the ring of symmetric functions to compute
the determinant. To check, by Jacobi-Trudi the result should coincide with the
Schur function corresponding to the partition $(1,1)$:

(4) -> SFunction [1,1]

          1       1   2
   (4)  - - (2) + - (1 )
          2       2
                                   Type: SymmetricPolynomial Fraction Integer




Martin





reply via email to

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