I have the following input
norm = Integrate[Exp[-c*x^2 - c*y^2], {x, 0, Infinity}, {y, 0, Infinity}, Assumptions -> c > 0];
DD[c_] = ProbabilityDistribution[1/norm Exp[-c*x^2 - c*y^2], {x, 0, Infinity}, {y, 0, Infinity}, Assumptions -> c > 0];
data = RandomVariate[DD[4], 15]
The output is
Out[279]= ProbabilityDistribution[(4 c E^(-\[FormalX]1^2 c - \[FormalX]2^2 c))/\[Pi], {\[FormalX]1, 0, \[Infinity]}, {\[FormalX]2, 0, \[Infinity]}, Assumptions -> c > 0]
During evaluation of In[278]:= RandomVariate::noimp: Sampling from ProbabilityDistribution[(16 E^(-4 \[FormalX]1^2-4 \[FormalX]2^2))/\[Pi],{\[FormalX]1,0,\[Infinity]},{\[FormalX]2,0,\[Infinity]}] is not implemented. >>
Out[280]= RandomVariate[ProbabilityDistribution[(16 E^(-4 \[FormalX]1^2 - 4 \[FormalX]2^2))/\[Pi], {\[FormalX]1, 0, \[Infinity]}, {\[FormalX]2, 0, \[Infinity]}], 15]
Excuse me, how to fix the input to let mathematica generate random number according to the custom distribution?
{}
too many around the integration variables, i.e. it should just beIntegrate[<expression>, {x, ...}, {y, ...}]
. Unfortunately, however, once you solve that problem,RandomVariate
complains that sampling from such a distribution is not implemented.ProbabilityDistribution
is new-ish functionality, so maybe it is still incomplete. $\endgroup$ – MarcoB Oct 21 '15 at 20:33DD = ProductDistribution[HalfNormalDistribution[Sqrt[c π]], HalfNormalDistribution[Sqrt[c π]]]
. $\endgroup$ – J. M.'s ennui♦ Oct 21 '15 at 20:39