Differences
This shows you the differences between two versions of the page.
— | user_guide:tutorials:latest:random [2023/11/06 10:57] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Random Constructions ====== | ||
+ | |||
+ | ===== Random points on the unit sphere ===== | ||
+ | |||
+ | The easiest way to randomly construct a polytope is by sampling points on the unit sphere. The following chooses 100 points on the unit sphere in 3-space. | ||
+ | |||
+ | <code perl> | ||
+ | > $p1=rand_sphere(3, | ||
+ | > print $p1-> | ||
+ | true | ||
+ | </ | ||
+ | ===== Random points sampled from a normal distribution ===== | ||
+ | |||
+ | A second way to randomly construct a polytope is by sampling points by a standard normal distribution. The following chooses 100 points sampled from the standard normal distribution in 3-space. | ||
+ | |||
+ | <code perl> | ||
+ | > $p2 = rand_normal(3, | ||
+ | > print $p2 -> SIMPLICIAL, " | ||
+ | true | ||
+ | 24 66 44 | ||
+ | </ | ||
+ | With probability one such polytopes under either distribution are simplicial. | ||
+ | |||
+ | ===== Random polytopes with are neither simplicial nor simple ===== | ||
+ | |||
+ | <code perl> | ||
+ | > ($d,$m,$n) = (4,50,30); | ||
+ | > $p1=rand_sphere($d, | ||
+ | > $p2=polarize($p1); | ||
+ | > $p3=new Polytope(POINTS=> | ||
+ | > print $p3-> | ||
+ | false false | ||
+ | 30 162 251 119 | ||
+ | </ | ||