tesserahub/sympy — comment on commit dd86ef42b3fb283084d41da4cf7b608c6ecb3eed
File: sympy/stats/crv.py line 166
By mrocklin:

Question
* What were the cases that were failing that lead you to this improvement? What works better as a result of this fix?

Comment
* I started writing stats using the solve method as you use here. Its actually easy to generalize it to many variables. We're effectively doing this
http://en.wikipedia.org/wiki/Random_variable#Functions_of_random_variables
I then found that DiracDelta did most of this work but with a few flaws. I decided to use it rather than re-implement much of the code. At one point I started writing a newer, better Dirac integration function but stopped. If we chose to do the full solution using solve we may want to put this code inside deltaintegrate. DiracDeltas serve as a nice abstraction.

Answers
* Transformations on Intervals. This only works if f is monotonic. Consider abs(Interval(-1,1)). The code you have above gives the interval [1,1]. One could think about minimizing f over the interval however. This could be done by considering all relative minima of f over the interval. I.e. something like min(solve(diff(f, x)))
* Symbols valid on intervals. It agree that it would actually be nice if x carried the interval around with it. This is a substantial bit to add to the core though. You could bring it up on the listhost. People might have ideas on how it could be done or if there is some issue with it. I like this much more than the is_positive/is_bounded stuff. If the first bullet point worked then these bounds would make a powerful assumptions system.
* Adding a "real" keyword to solve wouldn't be hard. You should start an issue for this at code.google.com/p/sympy/issues .
* The simplest way of doing this is f = lambdify(*Density(expr)) ; f(g)