[Date Index]
[Thread Index]
[Author Index]
Re: Recursion problem in SymbolicSum
*To*: mathgroup at smc.vnet.net
*Subject*: [mg60755] Re: [mg60693] Recursion problem in SymbolicSum
*From*: Devendra Kapadia <dkapadia at wolfram.com>
*Date*: Tue, 27 Sep 2005 03:45:26 -0400 (EDT)
*References*: <200509240655.CAA13410@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
On Sat, 24 Sep 2005, D.J. Wischik wrote:
> I was surprised to get problems (recursion limit exceeded) when executing
> a symbolic sum. The terms in the sum depend on a parameter mu. When I
> leave mu unspecified and calculate the sum and then substitute a numerical
> value for mu, I get the right answer. When I specify mu in the sum, the
> symbolic sum fails. (The sum definitely exists and is finite.) I would be
> grateful if anyone could explain this behaviour.
>
> PoissonProb[mu_, k_] = Exp[-mu] mu^k / k!;
>
> Sum[PoissonProb[mu, k] (k + 1 - 9)/(k + 1), {k, 9, Infinity}] /.
> {mu -> 1.05}
>
> [returns the answer 1.82353 * 10^(-7) as expected]
>
> Sum[PoissonProb[1.05, k](k + 1 - 9)/(k + 1), {k, 9, Infinity}]
>
> [ $RecursionLimit::reclim: Recursion depth of 256 exceeded.
> $IterationLimit::itlim: Iteration limit of 4096 exceeded.
> and then it returns the following. ]
>
> \!\(0.34993774911115527`\ \((4.298654386611213`*^-6 -
> 7.999999999999789`\ \
> Hold[If[MatchQ[Numerator[SymbolicSum`InfiniteDump`expr1$214],
> SymbolicSum`a$_ \
> + SymbolicSum`b$_ /; \(!
> FreeQ[SymbolicSum`a$,
> K$94]\) && \(! FreeQ[SymbolicSum`b$, K$94]\)], \
> \((SymbolicSum`InfiniteDump`infinitesum[#1, K$94, 0] &)\) /@
> Expand[SymbolicSum`InfiniteDump`expr1$214],
> SymbolicSum`InfiniteDump`HypergeometricSeries[
> 1, SymbolicSum`InfiniteDump`expr1$214, \
> SymbolicSum`InfiniteDump`expr2$214, K$94, 0, SymbolicSum`eps$214]]])\)\)
>
> Damon.
>
Hello Damon,
Thank you reporting the problem with this symbolic sum involving the
Poisson distribution.
The function PoissonProb has a factor E^(-mu) which is independent of
the summation variable 'k'. The Sum function attempts to simplify the
evaluation by extracting this factor but the simplification runs into
problems when 'mu' is inexact, on some operating systems.
As noted by you and others there are several partial workarounds for
the problem. First, one can find the sum for a symbolic value of 'mu'
and then replace 'mu' with 1.05. One can also try using an exact value
(105/100) for the parameter or apply NSum. Finally, you could define
a new function PoissonProb1 which does not include the factor E^(-mu)
in it and then multiply the output from Sum by this factor.
All these methods are shown below.
=================================================================
In[1]:= $Version
Out[1]= 5.2 for Linux (June 27, 2005)
In[2]:= PoissonProb[mu_, k_] = Exp[-mu] mu^k / k!;
In[3]:= Sum[PoissonProb[mu, k] (k + 1 - 9)/(k + 1), {k, 9, Infinity}] /.
{mu -> 1.05}
-7
Out[3]= 1.82353 10
In[4]:= s = Sum[PoissonProb[(105/100), k]*(k + 1 - 9)/(k + 1), {k, 9,
Infinity}];
In[5]:= N[s]
-7
Out[5]= 1.82353 10
In[6]:= NSum[PoissonProb[1.05, k](k + 1 - 9)/(k + 1), {k, 9, Infinity}]
-7
Out[6]= 1.82353 10
In[7]:= PoissonProb1[mu_, k_] =mu^k / k!;
In[8]:= E^(-1.05)*Sum[PoissonProb1[1.05, k](k + 1 - 9)/(k + 1), {k, 9,
Infinity}]
-7
Out[8]= 1.82353 10
=======================================================================
Sorry for the inconvenience caused by this problem.
Sincerely,
Devendra Kapadia.
Wolfram Research, Inc.
Prev by Date:
**Re: WORD document**
Next by Date:
**Re: DigitDifferences?**
Previous by thread:
**Re: Recursion problem in SymbolicSum**
Next by thread:
**Re: Recursion problem in SymbolicSum**
| |