Repository: scipy/scipy

Issue:
Support for Radau5 (Trac #894)
_Original ticket http://projects.scipy.org/scipy/ticket/894 on 2009-03-20 by @nilswagner01, assigned to unknown._

It would be nice to have a wrapper for RADAU5
[http://www.unige.ch/~hairer/prog/stiff/radau5.f]

Another solver 
[http://www.unige.ch/~hairer/prog/nonstiff/dop853.f]



Discussion:

Resolving patch:
diff --git a/scipy/stats/__init__.py b/scipy/stats/__init__.py
--- a/scipy/stats/__init__.py
+++ b/scipy/stats/__init__.py
@@ -158,18 +158,19 @@
 .. autosummary::
    :toctree: generated/
 
-    binom             -- Binomial
     bernoulli         -- Bernoulli
-    nbinom            -- Negative Binomial
+    binom             -- Binomial
+    boltzmann         -- Boltzmann (Truncated Discrete Exponential)
+    dlaplace          -- Discrete Laplacian
     geom              -- Geometric
     hypergeom         -- Hypergeometric
     logser            -- Logarithmic (Log-Series, Series)
-    poisson           -- Poisson
+    nbinom            -- Negative Binomial
     planck            -- Planck (Discrete Exponential)
-    boltzmann         -- Boltzmann (Truncated Discrete Exponential)
+    poisson           -- Poisson
     randint           -- Discrete Uniform
+    skellam           -- Skellam
     zipf              -- Zipf
-    dlaplace          -- Discrete Laplacian
 
 Statistical functions
 =====================
diff --git a/scipy/stats/distributions.py b/scipy/stats/distributions.py
--- a/scipy/stats/distributions.py
+++ b/scipy/stats/distributions.py
@@ -307,8 +307,29 @@ def instancemethod(func, obj, cls):
 """
 docdict_discrete['frozennote'] = _doc_default_frozen_note
 
-docdict_discrete['example'] = _doc_default_example.replace('[0.9,]',
-                                  'Replace with reasonable value')
+_doc_default_discrete_example = \
+"""Examples
+--------
+>>> from scipy.stats import %(name)s
+>>> [ %(shapes)s ] = [<Replace with reasonable values>]
+>>> rv = %(name)s(%(shapes)s)
+
+Display frozen pmf
+
+>>> x = np.arange(0, np.minimum(rv.dist.b, 3))
+>>> h = plt.vlines(x, 0, rv.pmf(x), lw=2)
+
+Check accuracy of cdf and ppf
+
+>>> prb = %(name)s.cdf(x, %(shapes)s)
+>>> h = plt.semilogy(np.abs(x - %(name)s.ppf(prb, %(shapes)s)) + 1e-20)
+
+Random number generation
+
+>>> R = %(name)s.rvs(%(shapes)s, size=100)
+
+"""
+docdict_discrete['example'] = _doc_default_discrete_example
 
 _doc_default_before_notes = ''.join([docdict_discrete['longsummary'],
                                      docdict_discrete['allmethods'],
@@ -6640,10 +6661,39 @@ class hypergeom_gen(rv_discrete):
         pmf(k, M, n, N) = choose(n, k) * choose(M - n, N - k) / choose(M, N),
                                                for N - (M-n) <= k <= min(m,N)
 
-    %(example)s
+    Examples
+    --------
+    >>> from scipy.stats import hypergeom
 
-    """
+    Suppose we have a collection of 20 animals, of which 7 are dogs.  Then if
+    we want to know the probability of finding a given number of dogs if we
+    choose at random 12 of the 20 animals, we can initialize a frozen
+    distribution and plot the probability mass function:
 
+    >>> [M, n, N] = [20, 7, 12]
+    >>> rv = hypergeom(M, n, N)
+    >>> x = np.arange(0, n+1)
+    >>> pmf_dogs = rv.pmf(x)
+
+    >>> fig = plt.figure()
+    >>> ax = fig.add_subplot(111)
+    >>> ax.plot(x, pmf_dogs, 'bo')
+    >>> ax.vlines(x, 0, pmf_dogs, lw=2)
+    >>> ax.set_xlabel('# of dogs in our group of chosen animals')
+    >>> ax.set_ylabel('hypergeom PMF')
+    >>> plt.show()
+
+    Instead of using a frozen distribution we can also use `hypergeom`
+    methods directly.  To for example obtain the cumulative distribution
+    function, use:
+
+    >>> prb = hypergeom.cdf(x, M, n, N)
+
+    And to generate random numbers:
+
+    >>> R = hypergeom.rvs(M, n, N, size=10)
+
+    """
     def _rvs(self, M, n, N):
         return mtrand.hypergeometric(n,M-n,N,size=self._size)
     def _argcheck(self, M, n, N):


Test patch: