Example 24.3

A string of length L = Pi has its ends fixed at x = 0 , and x = Pi on an x -axis. The string is under tension, so that when it is given the initial shape f(x) = x*(Pi-x)/10 , as shown in Figure 24.8 (below), and released, it oscillates. We solve for the motion of the string at any time t*`>`*0 .

The associated BVP that models the motion of this string is

u[tt](x,t) = c^2*u[xx](x,t) , t > 0

u(0,t) = 0

u(pi,t) = 0

u(x,0) = f(x) = x*(Pi-x)/10

u[t](x,0) = 0

The solution, given by

u(x,t) = Sum(b[n]*sin(n*Pi*x/L)*cos(c*n*Pi*t/L),n =...

and

b[n] = 2/L Int(f(x)*sin(n*Pi*x/L),x = 0 .. L)

is implemented in Maple as follows. The initial shape function is

> f := x*(Pi-x)/10;

f := 1/10*x*(Pi-x)

>

and Figure 24.8 (which shows its graph) is

> plot(f,x=0..Pi,color=black, scaling=constrained, xtickmarks=3, ytickmarks=2, labels=[x,u], labelfont=[TIMES,ITALIC,12]);

[Maple Plot]

>

The Fourier coefficients are given by the integral

> q := (2/Pi)*Int(f*sin(n*x),x=0..Pi);

q := 2*Int(1/10*x*(Pi-x)*sin(n*x),x = 0 .. Pi)/Pi

>

whose value is

> b := simplify(value(q));

b := -2/5*((-1)^n-1)/(Pi*n^3)

>

A peek at the first ten coefficients

> seq(subs(n=k,b),k=1..10);

4/5*1/Pi, 0, 4/135*1/Pi, 0, 4/625*1/Pi, 0, 4/1715*1...

>

reveals that the odd-indexed terms "survive," the even-indexed terms are zero. Moreover, the coefficients rapidly converge to zero for this function. In fact, they go to zero as 1/(n^3) , a rapid decrease, as the following conversion to floating point numbers shows.

> seq(evalf(subs(n=k,b)),k=1..10);

.2546479089, 0., .9431404033e-2, 0., .2037183271e-2...
.2546479089, 0., .9431404033e-2, 0., .2037183271e-2...

>

Hence, a very few terms will be needed to get a good approximation to u(x,t) . We can test this by examining how many terms it takes to get the Fourier series of f(x) to approximate f(x) well. The first two distinct partial sums in the Fourier series for f(x) are

> p1 := sum(b*sin(n*x),n=1..1);
p3 := sum(b*sin(n*x),n=1..3);

p1 := 4/5*sin(x)/Pi

p3 := 4/5*sin(x)/Pi+4/135*sin(3*x)/Pi

>

with f(x) (thin black) and p[1] (thick red) shown in Figure 24.9, below.

> plot([f,p1],x=0..Pi,color=[black,red], thickness=[1,3], scaling=constrained, xtickmarks=3, ytickmarks=2, labels=[x,u], labelfont=[TIMES,ITALIC,12]);

[Maple Plot]

>

This experiment suggests that two terms of the series for u(x,t) might yield a reasonably good approximation, so write

U = sum(b[n]*sin(n*x)*cos(c*n*t),n = 1 .. 3) = 4/135/Pi ``(27*sin(x)*cos(c*t)+sin(3*x)*cos(3*c*t))

that is,

> U := sum(b*sin(n*x)*cos(c*n*t),n=1..3);

U := 4/5*sin(x)*cos(c*t)/Pi+4/135*sin(3*x)*cos(3*c*...

>

as an approximation to the solution. Set c = 1 , that is,

> U1 := subs(c=1,U);

U1 := 4/5*sin(x)*cos(t)/Pi+4/135*sin(3*x)*cos(3*t)/...

>

to obtain the graph of the solution surface seen in Figure 24.10, below.

> plot3d(U1, x=0..Pi, t=0..4*Pi, axes=frame, labels=[x,`t `,`u `], labelfont=[TIMES,ITALIC,12], style=hidden, color=red, tickmarks=[3,6,3], orientation=[-45,60]);

[Maple Plot]

>

The plane sections t = t[k] are snapshots in time, freezing the physical motion of the string for each value of t[k] . Exhibiting these shapshots in succession forms a movie, or animation, of the physical motion of the string. This animation is given by the following Maple command.

> animate(U1,x=0..Pi,t=0..2*Pi, frames=60, color=black, scaling=constrained, xtickmarks=3, ytickmarks=2, labels=[x,`u `], labelfont=[TIMES,ITALIC,12]);

[Maple Plot]

>

As the string moves in space-time, its history generates a surface, a small part of which we now animate.

>

> F := z -> plot3d(U1, x=0..Pi, t=0..z):
display3d([seq(F(Pi/10*k),k=1..30)],insequence=true, axes=boxed, labels=[x,t,u], labelfont=[TIMES,ITALIC,12], style=hidden, color=red, tickmarks=[3,5,3]);

[Maple Plot]

>