user_guide:tutorials:latest:random

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

user_guide:tutorials:latest:random [2020/01/22 09:02] (current)
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 units sphere in 3-space.
 +
 +<code perl>
 +> $p1=rand_sphere(3,​100);​
 +> print $p1->​SIMPLICIAL;​
 +true
 +</​code>​
 +With probability one such polytopes are simplicial.
 +
 +===== Random polytopes with are neither simplicial nor simple =====
 +
 +<code perl>
 +> ($d,$m,$n) = (4,50,30);
 +> $p1=rand_sphere($d,​$m);​
 +> $p2=polarize($p1);​
 +> $p3=new Polytope(POINTS=>​rand_vert($p2->​VERTICES,​$n));​
 +> print $p3->​SIMPLICIAL,​ " ", $p3->​SIMPLE,​ "​\n",​ $p3->​F_VECTOR;​
 +false false
 +30 163 256 123
 +</​code>​
  
  • user_guide/tutorials/latest/random.txt
  • Last modified: 2020/01/22 09:02
  • (external edit)