axiom-math
[Top][All Lists]
Advanced

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

Re: [Axiom-math] Curious behavior of Taylor series


From: Jay Belanger
Subject: Re: [Axiom-math] Curious behavior of Taylor series
Date: Tue, 22 Aug 2006 11:17:36 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Ralf Hemmecke <address@hidden> writes:

>>> (113) -> y := taylor x
>>>    (113)  x
>>>                          Type: UnivariateTaylorSeries(Expression 
>>> Integer,x,0)
>>> (114) -> x*y
>>>    (114)  x x
>>>                          Type: UnivariateTaylorSeries(Expression 
>>> Integer,x,0)
>>> (115) -> coefficient(%,1)
>>>    (115)  x
>>>                                                      Type: Expression 
>>> Integer
...
>>>>> But Axiom coerced the two x to the same domain!!!
>>
>> Looking back, it didn't.  One of the x's is in Expression Integer, and
>> the other is UTS.
>
> In some sense you are rigth, BUT, for that to claim you would have to
> know the internal representation of
> UnivariateTaylorSeries(Expression Integer,x,0).
> What if you are a poor Axiom user who doesn't have access to the source
> code? How could you justify your statement. All you see is ONE type and
> that is UnivariateTaylorSeries(Expression Integer,x,0) and nothing else.

I was looking at the Type: part of the output in (113) and (115).

>>> Well, but how can you tell this to Axiom?
>
>> Axiom could try to coerce x to be the same type as y, or y to be the
>> same type as x.  The latter would lose structure, and should fail.
>> So x should be coerced to the same domain as y.
>
> As I said, Axiom does exactly that. 

Did you?  Well, I guess I need to be told several times before it
sinks in.   Maybe if I learned to read, I could have saved up both
some typing.  But thanks for your patience.

>>> But see, x is a symbol which should be coerce into a Taylor
>>> series. The interpreter has several choices. So assuming the ideal
>>> that the interpreter should have no mathematical knowledge itself,
>>> it can only take the available information from the library. But
>>> there are several available ways to go from x to UTS(Expression
>>> Integer,x,0). So how can the interpreter ever know that it does the
>>> wrong thing?
>>
>> The problem is that it didn't even try to go from x to UTS; x ends up
>> as an Expression Integer.  I think it should have tried coercing x
>> before multiplying x and y.
>
> 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.

> 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?

> 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.  
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.

Jay




reply via email to

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