aboutsummaryrefslogtreecommitdiff
path: root/multiplicity_stats.py
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-08-08 20:13:41 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2023-08-08 20:13:41 +0200
commit1c2df2e866091377fa6454a21341727abc098517 (patch)
treea35cfc381882b3fd57c511c051717e508405c36a /multiplicity_stats.py
parent50f8e9bf1997a1bd3f076046a1bae16ad610dd41 (diff)
downloadarithmeticbilliard-master.tar.gz
arithmeticbilliard-master.zip
Added multiplicity statsHEADmaster
Diffstat (limited to 'multiplicity_stats.py')
-rw-r--r--multiplicity_stats.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/multiplicity_stats.py b/multiplicity_stats.py
new file mode 100644
index 0000000..438a2fa
--- /dev/null
+++ b/multiplicity_stats.py
@@ -0,0 +1,46 @@
1import billiard3d
2import sys
3
4def get_stats(i, j, k, mult):
5 for r1 in range(i+1):
6 for r2 in range(j+1):
7 for r3 in range(k+1):
8 d = billiard3d.get_multiplicities(3, [i, j, k], [r1, r2, r3])
9 for key in d:
10 mult[d[key]] += 1
11
12def print_stats(N):
13 mult = [0] * 10
14 for i in range(1, N+1):
15 for j in range(i, N+1):
16 for k in range(j, N+1):
17 get_stats(i, j, k, mult)
18
19 print("Statistics for paths with 0 < a <= b <= c <= {0}".format(N))
20 print("Considering all paths starting from any possible point")
21 for i in range(1, 10):
22 if mult[i] != 0:
23 print("Multiplicity {0}: {1} points".format(i, mult[i]))
24 print("There are no points of positive multiplicity different from those listed above")
25
26def print_stats_single(a, b, c):
27 mult = [0] * 10
28 get_stats(a, b, c, mult)
29
30 print("Statistics for paths with a={0}, b={1} and c={2}".format(a, b, c))
31 print("Considering all paths starting from any possible point")
32 for i in range(1, 10):
33 if mult[i] != 0:
34 print("Multiplicity {0}: {1} points".format(i, mult[i]))
35 print("There are no points of positive multiplicity different from those listed above")
36
37if len(sys.argv) == 2:
38 N = int(sys.argv[1])
39 print_stats(N)
40elif len(sys.argv) == 4:
41 a, b, c = int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3])
42 print_stats_single(a, b, c)
43else:
44 print("Use one of the following options:")
45 print("\tpython multiplicity_stats.py N\t\t # For all possible sizes up to N")
46 print("\tpython multiplicity_stats.py a b c\t # For all starting points for the single 3d box (a,b,c)")

Generated with cgit - Back to sebastiano.tronto.net