[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-math] Re: expand
Re: [Axiom-math] Re: expand
Thu, 20 Nov 2003 10:23:02 +0000
I don't have Tim's new "literately programmed" Axiom, but the
documentation for Polynomial in my (NAG) version says that "This type is
the basic representation of sparse recursive multivariate polynomials
whose variables are arbitrary symbols. The ordering is alphabetic
determined by the Symbol type.". In actual fact the Polynomial domain
is just a wrapper for an instance of the SparseMultivariatePolynomial
and is using the ordering defined on Symbol. To be honest I always
disliked having an ordering on Symbol because it means that you get
(1) -> x < y
which is a source of confusion and occasional bugs in user code. If you
defined a new Symbol domain with a reverse lexicographic ordering you
could construct an instance of SparseMultivariatePolynomial where your
example would be represented as a polynomial in x. It could be argued
that this is more natural from a mathematical point of view, although I
think Reduce's ordering: x > y > z > t > a > b > ... is probably better.
Polynomial is one of those domains really only meant to be used in the
interpreter - in compiled code you would almost always be more specific
about the exact types. It allows you to manipulate sets of polynomials
in different variables without doing type coercion.
I hope that this helps.
On Wed, Nov 19, 2003 at 09:41:12PM +0100, Richard B. Kreckel wrote:
> Dear Tim,
> On Mon, 17 Nov 2003, root wrote:
> > (1) -> a:=(x+y+z)^2-x^2-y^2-z^2
> > (1) (2y + 2x)z + 2x y
> > Type: Polynomial
> > Integer
> > (2) -> c:DMP([x,y,z],FRAC(INT)):=a
> > (2) 2x y + 2x z + 2y z
> > Type: DistributedMultivariatePolynomial([x,y,z],Fraction
> > Integer)
> > The issue is the type chosen. The result (1) is a polynomial in z of the
> > form a * z + b where a == (2y + 2x) and b == 2xy
> > If you want x and y to also be variables you need the second form where
> > you explicitly request that x, y, and z are variable.
> > The display of an equation is intimately bound to its type.
> Sorry, Tim, but how on earth does it occur to Axiom that the original
> polynomial was in z? Why not in x? Or y? It simply says "Polynomial
> Integer"! How does it deduce the type? Where can I read about this?!?
> I know about the power of types and the pain of proper coercion and all
> that. But this is not intuitive. This is daunting. Sorry. How can it
> be improved?
> Richard B. Kreckel
> Axiom-math mailing list
> This e-mail has been scanned for all viruses by Star Internet. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit: