Re: Curious behavior of Taylor series

Ralf Hemmecke <[email protected]>
Newsgroups gmane.comp.mathematics.axiom.general
Message-ID <[email protected]>
>> Let's abbreviate U := UnivariateTaylorSeries(Expression Integer,x,0) and
>> E := Expression(Integer).
>>
>> That's what Axiom does. It tries to coerce to U, there is no such coerce
>> function. 
> 
> But x::U works just fine.

Try the same thing in a .spad file and the compiler will complain. 
(Better use a .as file and compile with Aldor. I cannot say much about 
SPAD, since I don't know for sure.)

x::U on a command line is given to the interpreter. The interpreter 
tries to be smart and tries hard to find a way to achieve what it 
believes you meant.

>> Then maybe after checking some other coerce functions that
>> fail, it finds a coercion to Expression(Integer), furthermore there is
>> function *: (E, U) -> U. So Axiom does a minimal thing: it interprets

>> x*y as (x::E)*y

>> note that the coercion to U would go like

>> (x::E::U) * y

> So x::U is equivalent to x::E::U?

I cannot say for sure. Some other Axiom gurus know how to ask axiom what 
exact function call the interpreter actually finds. I don't. Keep 
waiting or write to the axiom-developer mailing list. I am sure someone 
is listening.

>> and would then be more costly. You surely also consider that
>> unreasonable to go the long way if there is a shorter path. No?

> I'm just wondering why it doesn't try x::U right off.

Maybe it does. But as I said. There is no function coerce: Symbol->U.
So it fails and has to look for something else.

> I'm getting the (probably wrong) impression that it looks at x::U,
> decides that that's too long, then goes for x::E.  I would think that
> deciding x::U is too long would be too long.

Try to write an interpreter then you (maybe) appreciate what it 
currently does and have some mercy with it. ;-)

Ralf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.