# [Scipy-tickets] [SciPy] #770: cdf, pdf formulas of general exponential are wrong

SciPy scipy-tickets@scipy....
Fri Oct 31 22:21:38 CDT 2008

```#770: cdf, pdf formulas of general exponential are wrong
-------------------------+--------------------------------------------------
Reporter:  josefpktd    |       Owner:  somebody
Type:  defect       |      Status:  new
Priority:  normal       |   Milestone:  0.7.0
Component:  scipy.stats  |     Version:
Severity:  normal       |    Keywords:
-------------------------+--------------------------------------------------
{{{
1653    class genexpon_gen(rv_continuous):

1656        def _cdf(self, x, a, b, c):
1657            return 1.0-exp((a-b)*x + b*(1-exp(-c*x))/c)

>>> x=np.arange(0,10,1.0);a,b,c = (1,1,1);1.0-exp((a-b)*x +
b*(1-exp(-c*x))/c)
array([ 0.        , -0.88159639, -1.37420992, -1.5862603 , -1.66894793,
-1.70002776, -1.71155223, -1.71580421, -1.7173701 , -1.71794639])
>>> x=np.arange(0,10,1.0);a,b,c = (0.1,0.1,0.5);1.0-exp((a-b)*x +
b*(1-exp(-c*x))/c)
array([ 0.        , -0.08187308, -0.13476333, -0.16809471, -0.18878639,
-0.20151469, -0.2093011 , -0.21404836, -0.21693679, -0.21869206])
}}}

I cannot figure out what is wrong with the cdf expression. It gives
negative values but it is the same definiton as in continuous.pdf and in
http://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/gexcdf.pdf

This example has a nice graph in the nist pdf
{{{
>>> stats.genexpon.cdf(np.arange(0,10,1.0),0.1,0.1,0.5)
array([ 0.        , -0.08187308, -0.13476333, -0.16809471, -0.18878639,
-0.20151469, -0.2093011 , -0.21404836, -0.21693679, -0.21869206])
}}}

--
Ticket URL: <http://scipy.org/scipy/scipy/ticket/770>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.
```