[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] what is meaining of % in SPAD
From: |
William Sit |
Subject: |
Re: [Axiom-developer] what is meaining of % in SPAD |
Date: |
Thu, 21 Jul 2005 10:18:25 -0400 |
"Page, Bill" wrote:
> > In any case, it seems that as symbols %e ends up at a higher location
> > in the cache then %pi inspite of the numerical values that they (usually)
> > represent. Perhaps, if we really would like the ordering in EXPR INT
> > to be less surprizing to the novice user of Axiom, then we need to
> > tweak the above routine.
>
> I have an example of such a change here:
>
> http://page.axiom-developer.org/zope/mathaction/SandBoxKernel
>
> Adding the following lines to 'kl.spad.pamphlet'
>
> triage(k1, k2) ==
> is?(k1,pi) and is?(k2,exp) => 1
> is?(k2,pi) and is?(k1,exp) => -1
> ...
>
> does the "trick" by making sure that any exp() expression gets sorted
> before any pi() expression, but I am not really happy with this.
Yes, this is not enough because you are singling out 'exp()' and 'pi()'. The
same type of problems would occur for any symbolic constant such as those
involving trigonometric functions, or algebraic numbers.
> Ideally
> I would like triage to attempt to compare the numerical values of
> expressions if at all possible - something like this:
>
> triage(k1, k2) ==
> n1:=numericIfCan(k1::S)
> n2:=numericIfCan(k2::S)
> n1 case Float and n2 case Float => B2Z(n1<n2)
> ...
>
> except I cannot figure out how to persuade the compiler to do the
> necessary coercions and call the 'numericIfCan' function.
>
> Does anyone have some ideas about how to do this?
I tried (see SandBox) using operator(k) argument(k) instead of k::S and it
compiles. But for some unknown bug, it does not behave as expected. In the
interpreter, the simulation gives the correct answer in the test cases.
William
- [Axiom-developer] what is meaining of % in SPAD, Page, Bill, 2005/07/20
- Re: [Axiom-developer] what is meaining of % in SPAD, William Sit, 2005/07/20
- RE: [Axiom-developer] what is meaining of % in SPAD, Page, Bill, 2005/07/20
- RE: [Axiom-developer] what is meaining of % in SPAD, Page, Bill, 2005/07/20
- [Axiom-developer] what is meaining of % in SPAD, daly, 2005/07/20
- RE: [Axiom-developer] what is meaining of % in SPAD, Page, Bill, 2005/07/21
- Re: [Axiom-developer] what is meaining of % in SPAD,
William Sit <=