Re: Odd behavior (bug?) with Exp[-x^2} and Erf
- To: mathgroup at smc.vnet.net
- Subject: [mg42963] Re: Odd behavior (bug?) with Exp[-x^2} and Erf
- From: AES/newspost <siegman at stanford.edu>
- Date: Wed, 6 Aug 2003 03:16:39 -0400 (EDT)
- References: <bgnib6$1pu$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
In article <bgnib6$1pu$1 at smc.vnet.net>,
Bill Rowe <listuser at earthlink.net> wrote:
> On 8/4/03 at 12:45 AM, siegman at stanford.edu (AES/newspost) wrote:
>
> > Very reluctant to claim I've found a bug in Mathematica, but the
> > following cells certainly aren't doing what I expect them to:
>
> > f[x_] = (Exp[-5(x + 1)^2] + Exp[-5x^2] + Exp[-5(x - 1)^2])^2
> > Plot[f[x], {x, 0, 2}, PlotRange -> {{0, 2}, {0, 2}}];
> > g[y_] = Integrate[f[x], {x, 0, y}, Assumptions -> y > 0]
> > Plot[g[y], {y, 0.001, 2}, PlotRange -> {{0, 2}, {0, 1}}];
>
> What do you see that you don't expect?
f[x] as given in first line and plotted in second line is everywhere
positive.
g[y] in third line gives a complicated expression with a lot of Erf's in
it (appended below), and no error messages or warnings.
g[y] as plotted in 4th line doesn't increase monotonically --rises, then
falls, then rises again -- even though it's supposedly the integral
over an increasing range of an everywhere positive function.
I suspect some of the Erf's have been evaluated without proper care as
to whether the limits are positive or negative, but I haven't dug in to
do the grunt work of doing all the integrations carefully by hand and
checking on the Mathematica result.
g[y]\!\(\(\(1\/\(2\ \[ExponentialE]\^10\)\)\((\@\(\[Pi]\/10\)\
\((\(-2\)\ \
\[ExponentialE]\^\(15/2\)\ Erf[\@\(5\/2\)] - \[ExponentialE]\^10\
Erf[\@10] +
2\ \[ExponentialE]\^\(15/2\)\ Erf[\@\(5\/2\)\ \@\(1\/\((1 - 2\
y)\)\
\^2\)\ \((1 - 2\ y)\)\^2] + \[ExponentialE]\^10\ Erf[\@10\
\@\(1\/\((\(-1\) + \
y)\)\^2\)\ \((\(-1\) + y)\)\^2] +
2\ Erf[\@10\ y] + \[ExponentialE]\^10\ Erf[\@10\ y] + \
\[ExponentialE]\^10\ Erf[\@10\ \@\(1\/\((1 + y)\)\^2\)\ \((1 + y)\)\^2]
+
2\ \[ExponentialE]\^\(15/2\)\ Erf[\@\(5\/2\)\ \@\(1\/\((1 + 2\
y)\)\
\^2\)\ \((1 + 2\ y)\)\^2])\))\)\)\)