Message Boards Message Boards

GROUPS:

[GIF] Dropped Call (Histogram of Dirichlet-distributed barycentric coords)

Posted 6 months ago
816 Views
|
1 Reply
|
3 Total Likes
|

Histogram of Dirichlet-distributed barycentric coordinates on the square

Dropped Call

The Dirichlet distributions are a family of distributions on the $n$-simplex $x_1 + \dots + x_{n+1} = 1$. For example, the Dirichlet$(1,\dots , 1)$ distribution gives the uniform distribution on the simplex. Of course, generalized (normalized) barycentric coordinates on any convex polytope also sum to 1, so one can get an induced distribution on a convex polytope (of course, one way to think of generalized barycentric coordinates is as defining a map from a simplex to the polytope, so equivalently we're talking about the pushforward distribution on the polytope under this map).

In any case, each frame of the animation is produced by generating generalized barycentric coordinates on the square according to the Dirichlet$(5/4,5/4,5/4,5/4)$ distribution and then creating a DensityHistogram[] of the points. Here's the code for producing a single frame:

Module[{n = 200000, verts, dirichletvars},
 verts = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
 dirichletvars = 
  Append[#, 1 - Total[#]] & /@ 
   RandomVariate[DirichletDistribution[Table[5/4, {Length[verts]}]], n];
 DensityHistogram[Table[dirichletvars[[i]].verts, {i, 1, n}], {.025}, 
  Frame -> False, ColorFunction -> GrayLevel, 
  PlotRangePadding -> None, Background -> Black, ImageSize -> 540]
 ]

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming, and consider contributing your work to the The Notebook Archive!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract