[Date Index]
[Thread Index]
[Author Index]
Bug in Times?! - Nonzero 0*SeriesData[..]
*To*: mathgroup at smc.vnet.net
*Subject*: [mg36354] Bug in Times?! - Nonzero 0*SeriesData[..]
*From*: Sotirios Bonanos <sbonano at mail.ariadne-t.gr>
*Date*: Mon, 2 Sep 2002 04:09:27 -0400 (EDT)
*Organization*: National Technical University of Athens, Greece
*Reply-to*: sbonano at mail.ariadne-t.gr
*Sender*: owner-wri-mathgroup at wolfram.com
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**
| |