axiom-mail
[Top][All Lists]
Advanced

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

RE: [Axiom-mail] Using eval() in compile spad code.


From: Bill Page
Subject: RE: [Axiom-mail] Using eval() in compile spad code.
Date: Sun, 12 Mar 2006 21:53:40 -0500

On March 12, 2006 5:21 PM I wrote:
> .... 
> 
> instead you must call the function
> 
>   ?/? : (%,%) -> %
> 
> This requires that the divisor must be of type Expression Integer.

Oops, I did it again... sorry. I meant to write:

This requires that the divisor must be of type 'Expression Float'.

> The Axiom interpreter automatically performs the coercion but in
> SPAD you must write:
> 
>   a := a/(2.0::Expression Float)
> ...

You might wonder why 'Expression R' has an operation like

   ?*? : (%,Float) -> %

but not

   ?/? : (%,Float) -> %

When this starts to seem "natural" you can tell that you are
starting to think like the Axiom designers... :)

The reason might be that 'Expression R' is a domain of
"expressions" containing coefficients from the domain 'R'
where "coefficient" is interpreted in the same sense as a
coefficient of a polynomial. In fact internally 'Expression R'
is represented as 'Fraction SparseMultivariatePolynomial(R,Symbol)'
so 'Expression  R' inherits the '?*? : (%,R) -> %' from
'SparseMultivariatePolynomial(R,Symbol)' but it only inherits
'?/?' from 'Fraction X' and in this case 'X' does not contain
'R', even though 'X' is a polynomial over 'R'.

This justification notwithstanding, it would certainly have
been possible for the Axiom designers to have included an
operation in 'Expression R' that implemented division by 'R'.

If this "explanation" doesn't make sense to you right now,
don't worry. It takes some time to get used to Axiom's strongly
typed object-oriented way of doing things. Sometimes this is
at odds with the commonly less formal methods in mathematics.
This is often hidden by the Axiom interpreter and is entirely
abscent in most other computer algebra systems.

Regards,
Bill Page.






reply via email to

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