/usr/share/genius/examples/dalemb-pulse.gel is in genius-common 1.0.23-3.
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 | # Category: Differential Equations
# Name: D'Alembers solution animation of a plucked string
#
# Solution to the wave equation u_tt = u_xx
# The initial conditions are: position at F(x) and velocity at 0
# Boundary conditions are u(0,t) = u(1,t) = 0
#
# A pulse function. Feel free to set this function to whatever you want,
# though you should have ends at 0
function F(x) = (
# This makes the functions periodic
while x < -1 do x = x + 2;
while x > 1 do x = x - 2;
if x < 0 then
-F(-x)
else if x < 0.45 or x > 0.55 then
0
else (
if x < 1/2 then
20*(x-0.45)
else
20*(0.55-x)
)
);
# A plucked string function.
#function F(x) = (
# # This makes the functions periodic
# while x < -1 do x = x + 2;
# while x > 1 do x = x - 2;
#
# if x < 0 then -F(-x)
# else if x < 0.5 then x
# else 1-x
#);
# A plucked string function in two places.
#function F(x) = (
# # This makes the functions periodic
# while x < -1 do x = x + 2;
# while x > 1 do x = x - 2;
#
# if x < 0 then -F(-x)
# else if x < 0.25 then -x
# else if x < 0.5 then x-0.5
# else if x < 0.75 then x-0.5
# else 1-x
#);
# A plucked string in two places both in positive directions.
#function F(x) = (
# # This makes the functions periodic
# while x < -1 do x = x + 2;
# while x > 1 do x = x - 2;
#
# if x < 0 then -F(-x)
# else if x < 0.25 then x
# else if x < 0.5 then 0.5-x
# else if x < 0.75 then x-0.5
# else 1-x
#);
# Examples of superposition of sin waves
#function F(x) = (1/2)*sin(2*pi*x);
#function F(x) = (1/2)*sin(2*pi*x) + (1/3)*sin(7*pi*x);
#function F(x) = (1/2)*sin(2*pi*x) + (1/3)*sin(7*pi*x) + (1/8)*sin(20*pi*x);
#t a paramater
function yy(x) = (F(x-t) + F(x+t))/2;
LinePlotDrawLegends = false;
PlotWindowPresent(); # Make sure the window is raised
for n=1 to 1000 do (
t = n*0.005;
LinePlot(yy,[0,1,-1.1,1.1])
)
|