> we should think about providing built-in expected value formulas for common types like Binomial (which has a very simple formula that should return almost immediately even for large values).
This is also a good idea. I want to say that this might almost exist already, at least for continuous variables (generally the most robust). I would need to look through the code again to be sure. On Wed, Jan 15, 2014 at 1:17 PM, Matthew Rocklin <mrock...@gmail.com> wrote: > Background - SymPy.stats has three major components for three different > kind of distributions > > Finite Random Variables - like dice, coins, and binomials -- uses Python > iterators > Continuous Random Variables - like normals, exponentials, and chi > squares -- Uses SymPy Integrals > Discrete Random Variables - like poisson -- Uses SymPy Summations > > Discrete is the newest and least mature and could presumably use work. > > 1) The Geometric and Poisson random variable types exist in the >> drv_types.py file, and I'm able to use them in code, but they aren't >> mentioned in the documentation ( >> http://docs.sympy.org/latest/modules/stats.html) as far as I can tell. I >> would be willing to add these to the docs if they should be there. >> > > Yes. They should be there. This would be a good and hopefully simple > contribution. It looks like the discrete random variables didn't make it > into docs. > > >> >> 2) The expected value calculation E() seems to take a long time for >> certain types, like Binomial. For example, >> >>> X = Binomial("x", 10000, S.Half) >> >>> E(X) >> >> takes quite a while (over 10 seconds on my computer). Not sure if this is >> some weird issue with my setup, or an inefficiency in the code. If it's an >> inefficiency, we should think about providing built-in expected value >> formulas for common types like Binomial (which has a very simple formula >> that should return almost immediately even for large values). >> > > So things like Binomials could be implemented as either Finite or > Discrete. Currently they're under finite which means that they use Python > iterators for solution. This is extremely robust but also very slow. It > would be nice if they would try discrete-like functionality > (sympy.summation) and then default to finite-like functionality (explicit > iterators). > > >> >> 3) There isn't a Negative Binomial ( >> http://en.wikipedia.org/wiki/Negative_binomial_distribution) random >> variable type. I've written code that implements it, I believe, if we want >> to include it in SymPy. >> > > Awesome. This is totally welcome. You might want to ping @raoulb on any > github work. He has some experience adding distributions in the past. > > Please also ping me @mrocklin , on any work done on this topic and please > ask more questions. > > -- 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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.