Re: Curious behavior of Taylor series

Ralf Hemmecke <[email protected]>
Newsgroups gmane.comp.mathematics.axiom.general
Message-ID <[email protected]>
On 08/20/2006 11:11 PM, Igor Khavkine wrote:
> Can someone explain the following behavior of Taylor series in Axiom?
> 
> (113) -> y := taylor x
>   (113)  x
>                          Type: UnivariateTaylorSeries(Expression 
Integer,x,0)

There are only two functions "taylor" in Axiom with one argument. I 
assume that your x is a Symbol so the return type should be Any.

"Any" basically says that you work without types, or rather Any boxes 
the value together with its type. Its like an object knowing its type.

> (114) -> x*y
>   (114)  x x
>                         Type: UnivariateTaylorSeries(Expression 
> Integer,x,0)
> (115) -> coefficient(%,1)
>   (115)  x
>                                                     Type: Expression 
> Integer

We have gone through that before. From the type

UnivariateTaylorSeries(Expression Integer,x,0)

you should read that it is actually R[[x]] where R is (basically) 
allowing anything as an element. What you see above "x x" is the 
following: The second x is from the powerseries. The first x is from the 
coefficient ring. They are not the same.

The problem is that Axiom allows to construct such confusing things.
You should NEVER put yourself "Expression Integer" into the argument of 
UnivariateTaylorSeries or UnivariatePolynomial. And if you see it, you 
should be VERY careful.

> The same behavior does not occur if the coefficient ring is changed to
> say the rationals:

> (118) -> y := (taylor x) :: UTS(FRAC INT,x,0)
>   (118)  x
>                           Type: UnivariateTaylorSeries(Fraction 
> Integer,x,0)
> (119) -> x*y
>           2
>   (119)  x
>                           Type: UnivariateTaylorSeries(Fraction 
> Integer,x,0)
> (120) -> coefficient(%,2)
>   (120)  1
>                                                       Type: Fraction 
> Integer

And that is the way to go. You have to build
UTS(R, x, 0) with an R that fits your purpose but does not allow the 
symbol x.

A quick workaround for your problem is probably to choose a name of the 
variable of your Taylor series that does not appear anywhere else. Say, 
for example,

y := taylor(myNowhereElseOccurringSymbol);

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.