Laplace, Wave, and Heat

[Graphics:Images/HeatandWave_gr_1.gif]

Solutions for PDE handout #9

by Mohammad Ghomi
April 11, 1998

Problem 1

First,  let us recall the formula:

[Graphics:Images/HeatandWave_gr_2.gif]

For any function f on the interval [-Pi, Pi], the sum of the first N terms of the Fourier series is given by:

[Graphics:Images/HeatandWave_gr_3.gif]

1.a

Let

[Graphics:Images/HeatandWave_gr_4.gif]

and

[Graphics:Images/HeatandWave_gr_5.gif]

Let us graph these functions to see what they look like

[Graphics:Images/HeatandWave_gr_6.gif]

[Graphics:Images/HeatandWave_gr_7.gif]

[Graphics:Images/HeatandWave_gr_8.gif]
[Graphics:Images/HeatandWave_gr_9.gif]

[Graphics:Images/HeatandWave_gr_10.gif]

[Graphics:Images/HeatandWave_gr_11.gif]

Now, using the above formulas, we can compute the fourier series for these two functions, for any value of N. For instance:

[Graphics:Images/HeatandWave_gr_12.gif]
[Graphics:Images/HeatandWave_gr_13.gif]

You can find higher oreder series by replacing "5" by a bigger number (if you do this on Macintosh, you should be prepared to wait). We can also compute the series for g(x):

[Graphics:Images/HeatandWave_gr_14.gif]
[Graphics:Images/HeatandWave_gr_15.gif]

Since the above is zero let us try a bigger number.

[Graphics:Images/HeatandWave_gr_16.gif]
[Graphics:Images/HeatandWave_gr_17.gif]

Note that if you replace "10" by any higher number, then you will get the exact same thing. This is due to the tignometric identitiy: cosA sinB=1/2[sin(A+B)-sin(A-B)].

1.b

[Graphics:Images/HeatandWave_gr_18.gif]

If you have a fast machine, you may execute the following command to gerate all four required graphs

[Graphics:Images/HeatandWave_gr_19.gif]

Here I will generate only the first two.

[Graphics:Images/HeatandWave_gr_20.gif]

[Graphics:Images/HeatandWave_gr_21.gif]

[Graphics:Images/HeatandWave_gr_22.gif]

Similarly, we can generate the graphs for g:

[Graphics:Images/HeatandWave_gr_23.gif]

The first two are going to be zero, and the next two coincide exactly with the graph of g. See the comment at the end of 1.a.

1.c

Here is how you can find the errors. Let

[Graphics:Images/HeatandWave_gr_24.gif]
[Graphics:Images/HeatandWave_gr_25.gif]

[Graphics:Images/HeatandWave_gr_26.gif]

[Graphics:Images/HeatandWave_gr_27.gif]

So the value of the error is large for the first series of f. However, as you can check for yourselves, the error goes down sharply as gets larger.

Similarly, you can set

[Graphics:Images/HeatandWave_gr_28.gif]

and plot it to see the maximium for the erroe. Of course, once N gets larger than 9, the error for g will be zero. See the comments at the end of 1.a.

1.d

The reason that they are both sine series is that both functions f and g are odd.

1.e

Both series converge uniformly because f and g are smooth and periodic.

Problem 2

Here we can use the formulas from the previous handout (Solving the Laplace's equation):

[Graphics:Images/HeatandWave_gr_29.gif]

where

[Graphics:Images/HeatandWave_gr_30.gif]
[Graphics:Images/HeatandWave_gr_31.gif]
[Graphics:Images/HeatandWave_gr_32.gif]
[Graphics:Images/HeatandWave_gr_33.gif]

and the coefficients A1,..., A4 are :

[Graphics:Images/HeatandWave_gr_34.gif]
[Graphics:Images/HeatandWave_gr_35.gif]
[Graphics:Images/HeatandWave_gr_36.gif]
[Graphics:Images/HeatandWave_gr_37.gif]

2.a

[Graphics:Images/HeatandWave_gr_38.gif]
[Graphics:Images/HeatandWave_gr_39.gif]
[Graphics:Images/HeatandWave_gr_40.gif]
[Graphics:Images/HeatandWave_gr_41.gif]

[Graphics:Images/HeatandWave_gr_42.gif]

[Graphics:Images/HeatandWave_gr_43.gif]

2.b

[Graphics:Images/HeatandWave_gr_44.gif]
[Graphics:Images/HeatandWave_gr_45.gif]
[Graphics:Images/HeatandWave_gr_46.gif]

[Graphics:Images/HeatandWave_gr_47.gif]

[Graphics:Images/HeatandWave_gr_48.gif]

2.c

By the maximum principle, the oscilation of the function cannot be greater than the oscillation on the boundary. Hence, it is enough to control the error over the boundary.

2.d

As you can see from "SetOptions" in part 2.a, I have set "PlotRange->All". Hence, our graphs
are not going to get clipped. Hence, by looking at the pictures, we can tell what the range is. Without looking at the graphs, it is still easy to figure out what the range should be. All we need is to calculate  the maximium and minimums of f and g over the interval [-Pi, Pi]. By looking at the graphs for f and g (in section 1.a) it is clear what the approximate answer is.

2.e

As you can see, the chosen grid size works fine for both pictures above. The value I have chosen is 40x40, see the "SetOptions" in 2.a.

2.f

In order to see how many points we need, to keep the error less than 0.1, first we need to figure out the size of the increment dx such that |f(x+dx)-f(x)| <= 0.1, for all points x in the interval
[-Pi, Pi]. Suppose we know what dx has tobe. Then all we have to do is to devide [-Pi,Pi] into n segments such that the length of each segment is the same (or smaller) than dx. The length of each segments is 2Pi/n. So we have dx=2Pi/n; or, equivalently,

                                                                     n=2Pi/dx.

All it remains is to figure out dx. By Taylaors theorem,  f(x+dx)-f(x) <= max(f')dx, where maximum is taken over the interval [-Pi,Pi]. So let us set

                                                                 dx < 0.1/max(f').

By combining these two formulas we obtain the desired value for n:

                                                             n>2Pi max(f')/0.1.
                                                                 
All is left, is to figure out max(f') which is easily done, since the given functions ( f and g) are both elementary. I leave the rest to you.

2.g

[Graphics:Images/HeatandWave_gr_49.gif]
[Graphics:Images/HeatandWave_gr_50.gif]
[Graphics:Images/HeatandWave_gr_51.gif]

[Graphics:Images/HeatandWave_gr_52.gif]

[Graphics:Images/HeatandWave_gr_53.gif]

Due to the large difference between the scale of the graphs for f an g, the wiggles on the side of the above graph are barely visible. To get a closer look, change the domain:

[Graphics:Images/HeatandWave_gr_54.gif]

[Graphics:Images/HeatandWave_gr_55.gif]

[Graphics:Images/HeatandWave_gr_56.gif]

Problem 3

The solution to the heat equation u_{xx}=u_t on [0,Pi] x R^+, subject to the boundary conditions u(0,t)=0=u(Pi,t), and u(x,0)=f(x) is given by

[Graphics:Images/HeatandWave_gr_57.gif]

where

[Graphics:Images/HeatandWave_gr_58.gif]

and (in the interest of time) let us set

[Graphics:Images/HeatandWave_gr_59.gif]

The appropraite value for M, i.e. the one which keeps the error under 0.1, may be calculated using the formula for error, see 1.c. For the appropriate size for the grid, see 2.f. Recall also that we do not have to worry about the range since we have set "PlotRange->All".

3.a

[Graphics:Images/HeatandWave_gr_60.gif]

[Graphics:Images/HeatandWave_gr_61.gif]

[Graphics:Images/HeatandWave_gr_62.gif]

Since the above graph decays so fast, let us reduce the time interval to get a better look:

[Graphics:Images/HeatandWave_gr_63.gif]

[Graphics:Images/HeatandWave_gr_64.gif]

[Graphics:Images/HeatandWave_gr_65.gif]

3.b

[Graphics:Images/HeatandWave_gr_66.gif]

[Graphics:Images/HeatandWave_gr_67.gif]

[Graphics:Images/HeatandWave_gr_68.gif]

Again, let us zoom in to get a better look, and a smoother graph:

[Graphics:Images/HeatandWave_gr_69.gif]

[Graphics:Images/HeatandWave_gr_70.gif]

[Graphics:Images/HeatandWave_gr_71.gif]

Problem 4

4.a

The solution to the wave equation h_{xx}=h_{tt} on [0,Pi]xR^{+}, subject to the boundary conditions h(x,0)=f, h_t(x,0)=g, and h(0,t)=h(Pi,t)=0, is given by

[Graphics:Images/HeatandWave_gr_72.gif]

where

[Graphics:Images/HeatandWave_gr_73.gif]

and

[Graphics:Images/HeatandWave_gr_74.gif]

4.b

[Graphics:Images/HeatandWave_gr_75.gif]

[Graphics:Images/HeatandWave_gr_76.gif]

[Graphics:Images/HeatandWave_gr_77.gif]

As you can see the above picture is not too informative. You can remedy this situation somewhat by increasing the value for "PlotPoints". A n even more helpful option, however, is to flaten the graph. This can be achieved by cnanging the proportions of the box:

[Graphics:Images/HeatandWave_gr_78.gif]

[Graphics:Images/HeatandWave_gr_79.gif]

[Graphics:Images/HeatandWave_gr_80.gif]

Still, you can obtain the best picture by drawing the contour graph
(I got this idea from Boz Wing):

[Graphics:Images/HeatandWave_gr_81.gif]

[Graphics:Images/HeatandWave_gr_82.gif]

[Graphics:Images/HeatandWave_gr_83.gif]

4.c

Another way to generate the above graphs is by solving the wave equation using the characteristic method:

[Graphics:Images/HeatandWave_gr_84.gif]

You can check for yourselves that this way we will obtain the same graphs, and we can generate them much more quickly.


Converted by Mathematica      July 3, 2000