/usr/share/genius/examples/vibrating-drumhead-modes.gel is in genius-common 1.0.21-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | # Category: Differential Equations
# Name: Vibrating circular drumhead (wave equation)
#
# Make an animation of the various modes of a vibrating circular drumhead.
# The equation is u_{tt} = \nabla^2 u in polar coordinates and the
# drum is of radius 1. The varius modes n,m are of the form
# BesselJn(n,k*r)*cos(n*theta)*sin(k*t)
# where k is the mth zero of the BesselJn(n,x)
# The superposition is a superposition of 3 different modes,
# with some shifts also applied in the theta direction for
# added complexity
the_answer = AskButtons("Which mode? n-m where n is the Bessel J_n to use",
"0-1", # 1
"0-2", # 2
"0-3", # 3
"1-1", # 4
"1-2", # 5
"1-3", # 6
"2-1", # 7
"2-2", # 8
"2-3", # 9
"Superposition" # 10
);
# the zeros of the Bessel functions
knm = [2.4048, 5.5201, 8.6537
3.8317, 7.0156, 10.1735
5.1356, 8.4172, 11.6198];
if the_answer == 1 then (
n = 0;
k = knm@(n+1,1);
) else if the_answer == 2 then (
n = 0;
k = knm@(n+1,2);
) else if the_answer == 3 then (
n = 0;
k = knm@(n+1,3);
) else if the_answer == 4 then (
n = 1;
k = knm@(n+1,1);
) else if the_answer == 5 then (
n = 1;
k = knm@(n+1,2);
) else if the_answer == 6 then (
n = 1;
k = knm@(n+1,3);
) else if the_answer == 7 then (
n = 2;
k = knm@(n+1,1);
) else if the_answer == 8 then (
n = 2;
k = knm@(n+1,2);
) else if the_answer == 9 then (
n = 2;
k = knm@(n+1,3);
) else (
# Superposition
n = -1; # signals superposition
# Two put together
coeff1 = 0.5;
shift1 = 0.0;
n1 = 1;
k1 = knm@(n1+1,2);
coeff2 = 0.3;
shift2 = 0.5;
n2 = 0;
k2 = knm@(n2+1,3);
coeff3 = 0.3;
shift3 = 2;
n3 = 2;
k3 = knm@(n3+1,1);
);
SurfacePlotDrawLegends = false; # don't draw the legend
PlotWindowPresent(); # Make sure the window is raised
#One mode
if n >= 0 then (
for t=0.0 to 10.0 by 0.01 do (
data = null;
for r=0 to 1.0 by 1/10.0 do (
for theta=0 to 2*pi by pi/15 do (
x = r*cos(theta);
y = r*sin(theta);
data = [data;[x,y,BesselJn(n,k*r)*cos(n*theta)*sin(k*t)]]
)
);
# Plot the data
SurfacePlotData(data,[-1,1,-1,1,-1,1])
)
) else (
for t=0.0 to 10.0 by 0.01 do (
data = null;
for r=0 to 1.0 by 1/10.0 do (
for theta=0 to 2*pi by pi/15 do (
x = r*cos(theta);
y = r*sin(theta);
val = coeff1*BesselJn(n1,k1*r)*cos(n1*theta+shift1)*sin(k1*t) +
coeff2*BesselJn(n2,k2*r)*cos(n2*theta+shift2)*sin(k2*t) +
coeff3*BesselJn(n3,k3*r)*cos(n3*theta+shift3)*sin(k3*t);
data = [data;[x,y,val]]
)
);
# Plot the data
SurfacePlotData(data,[-1,1,-1,1,-1,1])
)
);
|