[Date Index]
[Thread Index]
[Author Index]
Re: Bug in interpretation of mma Series[] command?
*Subject*: [mg2268] Re: Bug in interpretation of mma Series[] command?
*From*: withoff (David Withoff)
*Date*: Thu, 19 Oct 1995 05:34:11 GMT
*Approved*: usenet@wri.com
*Distribution*: local
*Newsgroups*: wri.mathgroup
*Organization*: Wolfram Research, Inc.
*Sender*: daemon at wri.com ( )
In article <DGIy4H.I57 at wri.com> siegman at ee.stanford.edu (A. E. Siegman)
writes:
> Does the following make sense to anyone?
>
> In[6]:=
> f[y] = Exp[-a y^2] * Series[1/(1 + y^2), {y,0,5}]
>
> Out[6]=
> 2
> 2 a 4 6
> 1 + (-1 - a) y + (1 + a + --) y + O[y]
> 2
>
> This strikes me as a really counter-intuitive, perverse,
> guaranteed-to-cause-trouble "gotcha".
>
> I have to agree that
>
> In[7]:=
> f[y] = Exp[-a y^2] * Normal[Series[1/(1 + y^2), {y,0,5}]]
>
> Out[7]=
> 2 4
> 1 - y + y
> -----------
> 2
> a y
> E
>
> does what's expected; but the first case should surely
> either generate an error msg, or not be interpreted at
> all. There's no way any sensible interpretation of
> the input command (by normal users, that is) should lead
> to series expansion of the Exp[] function also.
>
The design justification for this is identical to the
justification for converting the exact number in the sum
1/4 + 5.27
to an inexact number
0.25 + 5.27
so that the two numbers can be combined. In the case
of numbers, this sort of coercion is presumably not
unexpected. It is mathematically correct, and is done
automatically by most computer languages.
The same thing is done with series, and for the same reasons.
If a function for which you effectively know all of the terms
in the series expansion
Exp[-a y^2]
(the analog of an exact number) is multiplied by a function
for which you have only a few terms in the series expansion
Series[1/(1 + y^2), {y,0,5}] ==>
SeriesData[y, 0, {1, 0, -1, 0, 1}, 0, 6, 1]
(the analog of an inexact number) the first function will
be converted to a series expansion so that the two can be
combined.
Although it is useful in some formal manipulations to avoid
these conversions (both with series expansions and with
inexact numbers) there is no mathematical reason not to do it.
Failure to do these conversions leads to a variety of
practical difficulties. For example, in current versions of
Mathematica, the input
2.7 Pi
returns unchanged. Mathematically, this expression has all
of the characteristics of an inexact number, but since the
exact number is not coerced into an inexact number, your programs
are obligated to figure that out for themselves, typically
through careful use of N. (In the next version of Mathematica,
this conversion will be done automatically.)
Leaving something like
Exp[-a y^2] * Series[1/(1 + y^2), {y,0,5}]
as a product causes the same sort of trouble, only worse.
This product has all of the mathematical characteristics
of a series expansion, but unless Exp[-a y^2] is converted
to a series expansion, it will remain a "disguised" series
expansion, and will be difficult to deal with.
I am sorry to hear that you are disappointed by this design,
but the reasons for it are quite sound. If you have a good
reason for avoiding these conversions, we would be happy to
hear from you, and will do what we can to incorporate your
suggestions into the design.
Dave Withoff
Research and Development
Wolfram Research
Prev by Date:
**TeX labels in graphs**
Next by Date:
**Re: simultaneous equations**
Previous by thread:
**Bug in interpretation of mma Series[] command?**
Next by thread:
**Re: Bug in interpretation of mma Series[] command?**
| |