MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

Bug in Times?! - Nonzero 0*SeriesData[..]


The following behavior seems to have gone undetected through several
revisions of Mathematica:
When a SeriesData object is multiplied by 0, Mathematica (versions 3.0,
4.02, 4.1 for Mac, and 4.0 for Windows) does not give 0. For example,

0*Series[f[x], {x,0,3}]
gives O[x]^4, even though 0*x_SeriesData gives 0!

Because of this, the following incorrect result is obtained in version
4:

DiagonalMatrix[{a,b}].{{x^2 + O[x]^3, O[x]^2}, {O[x]^2, x^2 + O[x]^3}}
gives {{O[x]^2, O[x]^2}, {O[x]^2, O[x]^2}} !!

In this example version 3 gives the correct result, even though,

a*(x^2 + O[x]^3) + 0*O[x]^2
gives O[x]^2 - same as in version 4. (Apparently, Dot in version 3 does
not include in the sum terms multiplied by 0).

The easiest way to correct this bug, without altering Times, is to use
UpSet:
Unprotect[SeriesData]; Times[0,x_SeriesData]^= 0; Protect[SeriesData];
(ignore the UpSet::"write" message)

I wonder how many people have obtained incorrect results because of this
bug...

Sotirios Bonanos
http://www.inp.demokritos.gr/~sbonano/SB.html






  • Prev by Date: Re: L2 inner product. Integrate and Conjugate?
  • Next by Date: Re: L2 inner product. Integrate and Conjugate?
  • Previous by thread: Re: L2 inner product. Integrate and Conjugate?
  • Next by thread: Re: Mathematica 4.2 & Strange Plot results