Keywords: Dirichlet distributions.png Several images of probability densities of the Dirichlet distribution as functions on the 2-simplex Clockwise from top left α 6 2 2 3 7 5 6 2 6 2 3 4 en Image Dirichlet_distributions png en User ThG graph PD-ineligible ThG Mathematica Source code <code><pre><nowiki> matrix mapping standard basis in R 2 to two sides of equilateral triangle T M 1 CosPi/3 0 SinPi/3 ; Mi InverseM; map a point in the triangle T to the corresponding point on the standard 2-simplex S TtoSxy_ Module p1 p2 p1 p2 Mi xy; p1 p2 1 - p1 - p2 ; calculate the probability density as a function on T fxy_ a_ Module a1 a2 a3 x y z B a1 a2 a3 a; x y z TtoSxy; B Gammaa1 + a2 + a3/ Gammaa1 Gammaa2 Gammaa3 ; B x a1 - 1 y a2 - 1 z a3 - 1 ; recursively tesselate triangle x1 x2 x3 by bisecting its edges and return a list of triangles as in input suitable for Graphics3D Tesselatex1_ x2_ x3_ alpha_ Module d1 x2 - x1 d2 x3 - x2 d3 x1 - x3 m g m Max d1 d1 d2 d2 d3 d3 ; If m < 0 0002 stop when the length of every edge is below threshold EdgeForm don't display edges of triangles Polygon x11 x12 fx1 alpha x21 x22 fx2 alpha x31 x32 fx3 alpha Module m1 5 x1 + x2 m2 5 x2 + x3 m3 5 x3 + x1 Join Tesselatex1 m1 m3 alpha Tesselatem1 x2 m2 alpha Tesselatem3 m1 m2 alpha Tesselatem3 m2 x3 alpha ShowGraphics3DTesselate 0 0 1 0 CosPi/3 SinPi/3 7 2 3 alpha stupid display options Boxed -> False PlotRange -> 0 1 0 1 0 15 AxesEdge -> None None -1 -1 Axes -> True FaceGrids -> 0 -1 0 BoxRatios -> 1 1 6 </nowiki></pre></code> Dirichlet distribution Dirichlet Surface plots |