# Vibration of a stretched string with fixed ends # Section 3.3 # In this notebook, we use Maple to investigate the string equation. # References in the notebook correspond to the book Partial Differential # Equations and Boundary Value Problems, by Nakhle Asmar, Prentice Hall, # 2000. # Example 1 (See Example 1 of Section 3.3) # # Consider a string of unit length having zero initial velocity and its # initial shape is given by # f(x) = 3*x*(1/10) if 0 < x and x < 1/3 # and # f(x) = (1/20)*(3*(1-x)) if 1/3 <= x and x <= 1 with(plots): f:= x->piecewise(02*int(f(x)*sin(n*Pi*x), x= 0.. 1); # To see the results, we make Maple assume n; is an integer and evaluate # these coefficients. assume('n',integer); eval(b(n)); # As expected, a(n)=0 and b(n)=1/n. We can now form the partial sums of # the Fourier series solution: S:=(N,x,t)->sum( b(n)*sin(n*Pi*x)*cos(n*t),n=1..N); # At t = 0; these partial sums should converge to f(x);. Let's check # this by plotting the 10th partial sum and comparing it with f(x);. plot({f(x),S(10,x,0)},x=0..1); # This is a further indication that our series solution is correct, # since only using 10 terms yields nearly the correct shape of the # string at t = 0;. Let's now make an animation of the plot for # various values of t;. The frames option controls how many "snapshots" # are used in the animation. with(plots): animate(S(10,x,t),x=0..1,t=0..20,frames=30); # So, adjusting the values of t; used represents changing the time # interval studied. Adjusting the value of frames represents changing # the frequency with which we take the "snapshots". #