It seems like a good idea to me. There are some identities that hold for variance and covariance independent of the probability distribution and it would be cool to be able to apply those identities symbolically.
Aaron Meurer > On Dec 15, 2015, at 11:05 AM, Francesco Bonazzi <franz.bona...@gmail.com> > wrote: > > I started recently some work on a symbolic expression for variance and > covariance in sympy.stats module: > > https://github.com/sympy/sympy/pull/10247 > > The current stats module defines functions such as P (probability), E > (expectation), variance, covariance, moment, and so on, to perform the > integral given random variables or conditions on random variables. > > I think it's convenient to also have the possibility to operate at a higher > level of abstraction, by keeping unevaluated symbolic expressions and > operating with their properties on them. > > The idea is to define a class with the same name of the function, with > capital first letter: > Expectation( ) vs expectation( ) > Probability( ) vs probability( ) > Variance( ) vs variance( ) > ... and so on ... > The latter ones are the existing functions, whereas the first ones are > classes that create the unevaluated expression. > > > > The method .doit() calls the corresponding function to perform the integral. > > > > A similar relationship already exists in SymPy: > > Integral( ) vs integrate( ) > Derivative( ) vs diff( ) > Sum( ) vs sum( ) > .doit() calls the function. > > > > I'd like to have some feedback before going on. Do you think this is a good > idea? Would you merge this once it's finished? > > -- > 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 https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/d0dff984-3457-4e53-89ea-bb2b120beb1c%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CF242E27-9108-4E7A-B8D6-A30BFE5B6790%40gmail.com. For more options, visit https://groups.google.com/d/optout.