MathGroup Archive 1990

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

Search the Archive

mathematica bug

  • To: mathgroup-adm at yoda.ncsa.uiuc.edu
  • Subject: mathematica bug
  • From: wsgbfs at win.tue.nl (F. Simons)
  • Date: Tue, 6 Nov 90 10:33:34 +0100

While preparing a demonstration with Mathematica, I discovered a
bug in version 1.2 that did not occur in version 1.1. I wrote to
WRI twice, but did not get any reaction.

The bug has to do with SeriesData. Multiplication works fine, but
the power function produces results of too low degree, as shown
by the following example.

Mathematica (MS-DOS 386/7) 1.2 (September 27, 1989) [With pre-lo-
aded data]
by S. Wolfram, D. Grayson, R. Maeder, H. Cejtin,
   S. Omohundro, D. Ballman and J. Keiper
with I. Rivin, D. Withoff and T. Sherlock
Copyright 1988,1989 Wolfram Research Inc.

In[1]:= a = x^2 + x^3 + O[x]^4

         2    3       4
Out[1]= x  + x  + O[x]

In[2]:= a^3

            4
Out[2]= O[x]

In[3]:= a*a*a

         6      7       8
Out[3]= x  + 3 x  + O[x]

The following definitions in the file debug.m help:

     Unprotect[ SeriesData ]

     SeriesData /: Power[ SeriesData[ a_, b_, c_, d_, e_, f_ ],
       n_Integer?Positive ] := Times[ Power[ SeriesData[ a, b, c,
       d, e, f ], n-1 ], SeriesData[ a, b, c, d, e, f ] ] /;
       OddQ[ n ] && (n > 1)
     
     SeriesData /: Power[ SeriesData[ a_, b_, c_, d_, e_, f_ ],
       n_Integer?Positive ] := Times[ Power[ SeriesData[ a, b, c,
       d, e, f ], n/2 ], Power[ SeriesData[ a, b, c, d, e, f ],
       n/2 ] ] /; EvenQ[ n]

Loading this file results in two error messages, probably
due to the fact that SeriesData is not a Mathematica function.
But it fixes the bug:

In[4]:= <<debug.m

SeriesData::bsd:
   SeriesData encountered arguments SeriesData[a_, b_, c_, d_, e_,
f_].

SeriesData::bsd:
   SeriesData encountered arguments SeriesData[a_, b_, c_, d_, e_,
f_].

In[5]:= a^3

         6      7       8
Out[5]= x  + 3 x  + O[x]

Though I have not seen it mentioned somewhere, I suppose this bug
must be known for a long time. Is there a better way to fix it?
Any comments are welcome.


Fred Simons
Eindhoven University of Technology
Department of Mathematics and Computing Science
P.O.Box 513
NL - 5600 MB Eindhoven
wsgbfs at win.tue.nl




  • Prev by Date: mathematica question
  • Next by Date: Integrate?
  • Previous by thread: mathematica bug
  • Next by thread: mathematica question