axiom-developer
[Top][All Lists]
Advanced

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

## [Axiom-developer] [Axiom-mail] A newby question about eval and Expressio

 From: Martin Rubey Subject: [Axiom-developer] [Axiom-mail] A newby question about eval and Expression Date: Sun, 13 Nov 2005 05:49:02 -0600

```Changes http://page.axiom-developer.org/zope/mathaction/AxiomMail/diff
--
Dear Doug,

there are two issues in your code:

Doug Stewart writes:

> )clear all
> digits 20
> -- n:=x^3+a1*x^2+a2*x+a3 ::Polynomial Fraction Integer
>
> Q:=(3*a2-a1^2)/9
> R:=(9*a1*a2-27*a3-2*a1^3)/54
> S:=(R+(Q^3+R^2)^(1/2))^(1/3)
> T:=(R-(Q^3+R^2)^(1/2))^(1/3)
> x1:=S+T-a1/3

note that x1 is *not* a polynomial. Not even a rational function.

> x2:=-(S+T)/2-a1/3 + %i*sqrt(3)*(S-T)/2
> x3:=-(S+T)/2-a1/3 - %i*sqrt(3)*(S-T)/2
>
> a5:=x^3+a1*x^2+a2*x+a3 ::Polynomial Fraction Integer;
> a6:=('x-x11)  ::Polynomial Fraction Integer;
>
> a7:=monicDivide(a5,a6,x) ;
>
> a77:=a7.quotient  ::Polynomial Fraction Integer;
> a78:=a7.remainder ::Polynomial Fraction Integer;
>
>
> qu1 :=eval(a77,x11,x1)
> rem1::POLY(FRAC(INT)):=eval(a78,x11,x1)
>
> this gives an error message:
>
> The form on the left hand side of an assignment must be a single
> variable ... supporting the setelt operation.

The notation "::" is a shorthand for "coerce". But then, this is bad
syntax. You can either say

rem1:POLY(FRAC(INT)):=eval(a78,x11,x1)

or

rem1:=eval(a78,x11,x1)::POLY(FRAC(INT))

However, since x1 is not a polynomial, both will fail.

The domain "Expression Integer" is the domain of all expressions you can form
with coefficients being integers. For example:

sin(x)^2+cos(x)^2-1

or

5^(n/2)

or

%pi*sum(1/i, i=1..n)

...

However, if you *can* avoid this domain (often you can't), try to do so, since
it has a major drawback:

A computer cannot test reliably whether some element of Expression Integer is
zero or not. Axiom tries, but often fails. For example, the first example above
is not zero for Axiom...

(MuPAD, Mathematica and Maple try harder, but they often fail, too)

Note that this problem does not arise for many other domains: you can test for
zero in

Integer,
Polynomial Integer,
AlgebraicNumber,
PrimeField 5
Matrix Integer,
Fraction Polynomial PrimeField 1783

and so on.

Martin

_______________________________________________
Axiom-mail mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/axiom-mail

--
forwarded from http://page.axiom-developer.org/zope/mathaction/address@hidden

```

reply via email to

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