Skip to content Skip to sidebar Skip to footer

Plotting A Mixture Distribution In Sympy.stats

( gist of this Q here ) I'd like create a mixture of two Gamma distributions and plot the result, evaluated over a given range. It would appear that sympy.stats is capable of this

Solution 1:

It looks like this was fixed. I can reproduce your error in SymPy 0.7.3 but it works just fine in 0.7.4.1, the latest version.

First off, you don't need the fanagling with the .args. The expressions returned by density are callable. Just call D1(i).evalf() to get the numerical value of D1 at i, like

D1 = density(G1); D2 = density(G2); D3 = density(G3)v1 = [D1(i).evalf() for i in u]
v2 = [D2(i).evalf() for i in u]
v3 = [D3(i).evalf() for i in u]

I've uploaded a working version to http://nbviewer.ipython.org/gist/asmeurer/8486176.

Post a Comment for "Plotting A Mixture Distribution In Sympy.stats"