-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_mean_singularity.m2
35 lines (31 loc) · 1.24 KB
/
test_mean_singularity.m2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
load "rand_toric_surf.m2"
--sequence of number starting at a, with step s less than or equal to b
seq := (a,s,b) -> (x:=a;while x<=b list x do x=x+s)
--a version that doesn't actually create the variety
randomCompleteRays := (h,p) -> (
rayList := randomRays(h,p);
sortedRays := circularSortRays rayList;
if rayListIsComplete sortedRays
then sortedRays
else null)
--a version of mean singularities that uses a list
raysMeanSingularity := rayList -> (
coneList := circularPairList rayList;
singList := apply(coneList, abs @@ det @@ matrix);
toRR mean singList
)
--Now the part that runs as a script
if #scriptCommandLine>0
then (if #scriptCommandLine<5
then print "Too few arguments"
else (
maxH := value(scriptCommandLine#1);
hstep := value(scriptCommandLine#2);
pstep := value(scriptCommandLine#3);
count := value(scriptCommandLine#4);
for h in seq(10,hstep,maxH) do (
for p in seq(pstep,pstep,1.0) do (
<< (h,p) << " : " << (mean (for i from 1 to count list (
surf := randomCompleteRays(h,p);
if surf===null then continue else raysMeanSingularity surf))) << endl << flush))
))