From 60b15edf07db134ba3058c722e1b6c37177fdbe9 Mon Sep 17 00:00:00 2001 From: Paddy Milner Date: Thu, 9 Oct 2025 12:01:20 +0100 Subject: [PATCH] Update comments and add cylinder --- cube.py | 2 +- cylinder.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 cylinder.py diff --git a/cube.py b/cube.py index 9c0f846..2b0bbc9 100644 --- a/cube.py +++ b/cube.py @@ -1,6 +1,6 @@ from math import * -## Exp W. Modes of long cyclinder (1D) ## +## Exp W. Modes of long Cube ## u = 343 #speed of sound a = 0.2 #length width and height of cube b = 0.2 diff --git a/cylinder.py b/cylinder.py new file mode 100644 index 0000000..98906ab --- /dev/null +++ b/cylinder.py @@ -0,0 +1,26 @@ +from math import * + +## Exp W. Modes of short cylinder ## +u = 343 #speed of sound +l = 0.05 +rho = 0.1 +alpha = [[0, 1.84, 3.05, 4.20], + [3.83, 5.33, 6.71, 8.02], + [7.01, 8.54, 9.97, 11.35]] +fqn = [] #frequencies and respective quantum numbers +f = [] # frequencies + +for n in range (0,4): + for m in range (0,4): + for j in range (1,4): + qn = [n,m,j] + frequency = u*sqrt((n**2/(4*l**2))+(((alpha[j-1][m])**2)/4*pi**2*rho**2)) + if frequency in f: # check for duplicatesq + continue + else: + f.append(frequency) + fqn.append([frequency,f'n={n}, m={m}, j={j}']) + +for i in range(len(fqn)): + print(sorted(fqn)[i]) +