Hi
I am trying to create samples from Irwin-Hall distribution, and
following two-line code is giving me TypeError. Sampling works for other
distributions, but not for this. Am I calling the sampler in a wrong way?
My sympy version is 1.9.
Regards
Hrishikesh.
>>> U = stats.UniformSum( 'u', 20 )
>>> usample = stats.sample( U )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/sympy/stats/rv.py",
line 1150, in sample
return next(iterator)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/sympy/stats/rv.py",
line 1321, in return_generator_finite
library=library, seed=seed) # a dictionary that maps RVs to values
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/sympy/stats/crv.py",
line 478, in sample
return {self.value: self.distribution.sample(size, library=library,
seed=seed)}
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/sympy/stats/rv.py",
line 1583, in sample
samps = do_sample_scipy(self, size, rand_state)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/functools.py",
line 840, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/sympy/stats/sampling/sample_scipy.py",
line 41, in _
return scipy_rv.rvs(size=size, random_state=seed)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py",
line 1060, in rvs
vals = self._rvs(*args, size=size, random_state=random_state)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py",
line 979, in _rvs
Y = self._ppf(U, *args)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py",
line 994, in _ppf
return self._ppfvec(q, *args)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/numpy/lib/function_base.py",
line 2108, in __call__
return self._vectorize_call(func=func, args=vargs)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/numpy/lib/function_base.py",
line 2192, in _vectorize_call
outputs = ufunc(*inputs)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py",
line 1774, in _ppf_single
left, right, args=(q,)+args, xtol=self.xtol)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/optimize/zeros.py",
line 776, in brentq
r = _zeros._brentq(f, a, b, xtol, rtol, maxiter, args, full_output,
disp)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py",
line 1754, in _ppf_to_solve
return self.cdf(*(x, )+args)-q
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py",
line 1929, in cdf
place(output, cond, self._cdf(*goodargs))
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py",
line 1804, in _cdf
return self._cdfvec(x, *args)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/numpy/lib/function_base.py",
line 2108, in __call__
return self._vectorize_call(func=func, args=vargs)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/numpy/lib/function_base.py",
line 2192, in _vectorize_call
outputs = ufunc(*inputs)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/stats/_distn_infrastructure.py",
line 1801, in _cdf_single
return integrate.quad(self._pdf, _a, x, args=args)[0]
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/integrate/quadpack.py",
line 352, in quad
points)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/scipy/integrate/quadpack.py",
line 463, in _quad
return _quadpack._qagse(func,a,b,args,full_output,epsabs,epsrel,limit)
File
"/home/hrishikesh/tools/anaconda3/envs/try1/lib/python3.7/site-packages/sympy/stats/sampling/sample_scipy.py",
line 37, in _pdf
return handmade_pdf(x)
File "<lambdifygenerated-3>", line 2, in _lambdifygenerated
TypeError: 'numpy.float64' object cannot be interpreted as an integer
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/d3eb6bb2-36fa-4623-b1c5-1c80a0e043a2n%40googlegroups.com.