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: Ralf Hemmecke
Subject: Re: [Axiom-math] Curious behavior of Taylor series
Date: Sun, 20 Aug 2006 23:53:06 +0200
User-agent: Thunderbird 1.5.0.5 (X11/20060719)

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




reply via email to

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