Let us try to define 2D distribution through PDF:
f[x_, y_] := 1/((0.05 + (-0.79 + x)^2) (0.05 + (-0.89 + y)^2)) + 1/((0.05 + (-0.40 + x)^2) (0.05 + (-0.88 + y)^2)) + 1/((0.05 + (-0.66 + x)^2) (0.05 + (-0.43 + y)^2))
The plot of PDF looks good:
Plot3D[f[x, y], {x, 0, 1}, {y, 0, 1}, PlotRange -> Full, ImageSize -> 400]
Now define a distribution (with "Normalize"
method, as f(x,y) is not a normalized PDF)
ProDis = ProbabilityDistribution[f[x, y], {x, 0, 1}, {y, 0, 1}, Method -> "Normalize"]
and try to generate a sample
RandomVariate[ProDis, 10]
Mathematica returns the error:
RandomVariate::noimp: Sampling from ProbabilityDistribution[0.00387923 (1/((0.05 +Plus[<<2>>]^2) (0.05 +Plus[<<2>>]^2))+1/((0.05 +Plus[<<2>>]^2) (0.05 +Plus[<<2>>]^2))+1/((0.05 +Plus[<<2>>]^2) (0.05 +Plus[<<2>>]^2))),{[FormalX]1,0,1},{[FormalX]2,0,1}] is not implemented.
How can I generate samples from my distribution?
RandomVariate[]
has poor support for arbitraryProbabilityDistribution[]
objects. $\endgroup$