axiom-mail
[Top][All Lists]
Advanced

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

Re: [Axiom-mail] Type of Expression Problem


From: Martin Rubey
Subject: Re: [Axiom-mail] Type of Expression Problem
Date: 17 Nov 2005 12:20:35 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Hans Peter Würmli <address@hidden> writes:

> Hi Martin
> 
> >
> > this follows the documentation: binomial(n-1,k)/binomial(n,k) is not a
> > rational function, but normalize(e2) is:
> >
> >         n - k
> >    (3)  -----
> >           n
> >                                                      Type: Expression
> > Integer
> >
> > Note the type information: it is still EXPR INT. After retraction it
> > becomes Fraction Integer!
> 
> I chose the example, because I knew it would work. The issue I have with it
> is the dependence on a particular representation. 1/2=2/4=...=k/k*2 all
> represent the same rational number, but you wouldn't like to depend on a
> particular representation of 1/2 to operate on it. In the example above the
> coercion / retraction / conversion is no mapping from Expression Integer to
> Fraction Polynomial Integer, but from a particular Expression Integer to
> Fraction Polynomial Integer.

Yes, but this is a problem you cannot solve, I believe. For example, 
sin^2 x + cos^2 x is a polynomial, but it is quite difficult to see...

> Say, to take another example, you have a polynomial (in standard math
> notation) k in K[x], e.g. k=k0+k1 x +...+kn x^n. Would you regard h=k0+k1
> y+...+kn y^n the same or a different Polynomial? Axiom would regard these as
> different.

Well, they have different representations, but otherwise they are the same. For
example, you can say

(14) -> p: UP(x, INT) := 1+x

   (14)  x + 1
                                        Type: UnivariatePolynomial(x,Integer)
(15) -> q: UP(y, INT) := 1+y

   (15)  y + 1
                                        Type: UnivariatePolynomial(y,Integer)
(16) -> p::SUP INT - q::SUP INT

   (16)  0
                                     Type: SparseUnivariatePolynomial Integer

unfortunately p::UP(y, INT) does not work. I think it should...

> Substitution (or evaluation, if you like) in my view is very natural, so it 
> is 
> not crazy to expect Axiom to allow it to the greatest extent possible. For 
> example, let K[x] operate on, say, operators on a linear space {L:A->B} by 
> 
> k (L) :=k0 + k1 L + ... + kn L^n
> 
> which is as much as "substitute x by L".
> 
> > So what you want is eval(p,n,N) where N has to be of Type Poly. For
> > example, it could be N::POLY INT
> 
> Yes, eval wants it this way, but I had defined N to be the forward difference 
> operator.

Which belongs to EXPR? In this case, you are going to obtain an element from
EXPR, so you cannot expect eval$POLY to work. So you have to coerce your
polynomials into expressions first, and use subst (or eval) then.

By the way, I guess that the following is the reason, why the operation
eval$POLY is not called subst$POLY:

* eval means to do everything to obtain the simplest possible representation in
  the domain -- which is in most domains equivalent to substitution, not
  however in EXPR: summation, integration, simplification algorithms may be
  applied...

* subst on the contrary, does as little as possible.

(I know that this is a very weak explanation. but I tried...)

> > > my primary goal would not be to have some representation, but to be able
> > > to represent the recurrences as naturally as possibly, natural meaning as
> > > close to standard math language as possible.
> >
> > This is a different matter. I think that you should decide what you want to
> > implement: Zeilbergers algorithm or coercion of holonomic functions to
> > expressions. The latter might be more tricky, but I don't know.
> 
> The decision might be to try both -:)

great! So if you want to play also with the latter, try to contact Antoine
Hersen.

Note the following: 

* recurrences with constant coefficients   --> rational functions
  (quite easy)
 
* recurrences with polynomial coefficients --> holonomic functions
  
  I do know off the top of my head how to find out whether it is a "well known"
  function. Of course it's easy to test whether it's the sine, cosine,
  exponential, ... but I don't have a good heuristic here. If it's algebraic,
  it's easy, but again, I don't know right know how to see whether it's
  algebraic. (I probably should...)

Martin







reply via email to

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