Re: Curious behavior of Taylor series

Jay Belanger <[email protected]>
Newsgroups gmane.comp.mathematics.axiom.general
Message-ID <[email protected]>
Ralf Hemmecke <[email protected]> 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
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.