Status: Accepted
Owner: [email protected]
Labels: Type-Enhancement Priority-Low

New issue 3061 by [email protected]: Stats sampling using numpy
http://code.google.com/p/sympy/issues/detail?id=3061

The stats module has a sampling mechanism to provide approximate solutions to statistical queries. This mechanism is relatively slow and 1000+ sample simulations of complex expressions can take several seconds.

X = Normal(0,1)
Y = Exponential(10)
Var(sin(X+Y)) # this hangs because the integral is tough
<Ctrl-C>
Var(sin(X+Y), numsamples=1000) # this takes a few seconds
0.420095049234496

NumPy also provides a sampling mechanism in its random module. If we could sample large arrays out of the underlying distributions and then push those large arrays through the sympy expressions we could compute approximate solutions much more quickly.

import numpy
xs = numpy.random.normal(0,1, 1000)
ys = numpy.random.exponential(10, 1000)
numpy.sin(xs+ys).var() # This takes 150 micro seconds
0.48987452637810897

So, can we use sympy to build up a complex statistical question and then use numpy to compute the result?

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to