MATH529

SP.24: Homework 3

Instructions

This homework assignment continues the study of separation of variables to solve linear partial differential equations.

As the course progresses through the homework assignments additional aspects arise:
(1) More detail on how to present an analytical answer is introduced. This is a fundamental course objective, and homework credit will be awarded based upon following the requirements stated in Model solutions below.
(2) Additional, higher-level Mathematica constructs are introduced to complement analytical solutions in Exercises and Problems. These Mathematica constructs are not part of the syllabus and do not have to be included in answers. They are however useful to applying course material to future projects in your careers, hence you are encouraged to study these, time permitting.
(3) Project questions do require Mathematica implementations that are however are restricted to basic usage of the software system.

Exercises

From p.732: 2-6, p.738:2-10

Model solution:  13.4.1 (p.732)

Statement

Solve the wave equation problem:
(Subscript[u, t t])= (a^2) (Subscript[u, x x]) for 0<x<L, t>0
u(x,t=0)=(1/4) x(L-x) for 0<=x<= L, (Subscript[u, t])(x,t=0)=0
u(x=0,t)=0 for t>0
u(x=L,t)=0 for

Solution

Separation of variables u(x,t)=X(x)T(t) leads to ODEs ((T'')/((a^2) T))=((X")/X)=-(α^2)
where only constant -(α^2)<0 leads to physical solutions (avoiding, exponential growth or decay in time for t>0).

The homogeneous Dirichlet conditions lead to eigenvalues (Subscript[α, n]) that satisfy sin((Subscript[α, n]) L)=0⇒(Subscript[α, n])=n π/L,n∈ℕ\{0}.

The null initial velocity condition leads to (Subscript[T, n])(t)=(Subscript[B, n]) cos((Subscript[α, n]) a t) .

Superposition  of separated ODE solutions yields
u(x,t)=(∑_(n=1)^∞)(Subscript[A, n]) sin(n π x/L) cos(n π a t/L) 

The initial displacement condition u(x,0)=(1/4)x (L-x) determines (Subscript[A, n])
(Subscript[A, n])=(2/L)(∫_0^L)(1/4)x(L-x) sin(n π x/L) dx=2 (L^2)/(n^3) (π^3) for n odd, zero otherwise.

Compute (Subscript[A, n]) in Mathematica

Assuming[n∈Integers,(1/(2L))Integrate[x(L-x)Sin[n π x/L],{x,0,L}]]

Solution with additional notes

Notes:
(1) This exercise was also solved in class, going through all possible cases. A more concise solution was presented above, as a model for homework and test answers. 
(2) Pay special attention to the explanation of the steps being carried out. When drafting answers, always follow this model and explain the calculations you are carrying out. Remember: it is incumbent on the student to demonstrate mastery of the subject, not on the instructor to divine intent. 
(3) Credit will not be awarded if calculations are presented without motivation. Conversely, small computational errors that might arise in a calculation which is well motivated have no adverse effect, and such an answer will receive full credit.
(4) Credit is awarded for correct presentation of the analytical solution. 
(5) Mathematica instructions are included to demonstrate how to check your analytical solution.

Separation of variables u(x,t)=X(x)T(t) leads to ODEs
((T'')/((a^2) T))=((X")/X)=-(α^2)
where only constant -(α^2) leads to physical solutions (avoiding, exponential growth or decay in time for t>0).

The homogeneous Dirichlet conditions lead to eigenvalues (Subscript[α, n]) that satisfy sin((Subscript[α, n]) L)=0⇒(Subscript[α, n])=n π/L,n∈ℕ\{0}.

The null initial velocity condition leads to (Subscript[T, n])(t)=(Subscript[B, n]) cos((Subscript[α, n]) a t) .

Superposition  of separated ODE solutions yields
u(x,t)=(∑_(n=1)^∞)(Subscript[A, n]) sin(n π x/L) cos(n π a t/L) 

The initial displacement condition u(x,0)=(1/4)x (L-x) determines (Subscript[A, n])
(Subscript[A, n])=(2/L)(∫_0^L)(1/4)x(L-x) sin(n π x/L) dx=2 (L^2)/(n^3) (π^3) for n odd, zero otherwise.

Compute (Subscript[A, n]) in Mathematica (Note: hand computation of the Fourier series integrals is not required).

Assuming[n∈Integers,(1/(2L))Integrate[x(L-x)Sin[n π x/L],{x,0,L}]]

Note: All that follows is informational, and not a required part of solutions you submit.

Verify solution in Mathematica. In this verification, the capability of DSolve to find solutions to partial differential equations is used. Verification of the individual ordinary differential equations was shown in lesson07.nb. The expression evaluation order shown below allows definition of a function with the general solution for arbitrary a,L and number of terms in the series. While not a course requirement, understanding the syntax below might prove useful when applying this material to specific problems encountered later in your careers.

Define the initial boundary value problem.

Clear["Global`*"];
PDE = (∂_(t,t))u[x,t]==(a^2) (∂_(x,x))u[x,t];
ICu = u[x,0]==(1/4)x (L-x);
ICv = Evaluate[(∂_t)u[x,t]  /. t->0 ]== 0;
BC0 = u[0,t]==0;
BCL = u[L,t]==0;
IBVP = {PDE,ICu,ICv,BC0,BCL}

Solve the IBVP

sol=Assuming[a>0,DSolve[IBVP,u[x,t],{x,t}]][[1,1]]

The solution contains an infinite series that is tagged as Inactive to avoid an endless loop

FullForm[sol]

The general term in the series can be extracted

v[x_,t_]=FullForm[u[x,t] /. sol][[1,1]] /. K[1]->n

Define a function to give a truncation of the infinite series

u[a_,L_,nt_] := u[x,t]/. sol /. {∞->nt,K[1]->n, Inactive[Sum]->Sum}

Invoke the function with a specified number of series terms

u[a,L,3]

Define a function with additional arguments

u[X_,T_,A_,l_,nt_] := u[a,L,nt] /. {x->X,t->T, a->A, L->l}

Test the function with a specified number of terms

u[x,t,a,L,3]

Test that a numeric value is returned when all arguments are numeric

u[0.1,0.1,1,1,3]

Use the function to plot solution at various times

Plot[Table[u[x,t,1,1,11],{t,0,1,0.1}],{x,0,1},Frame->True,FrameLabel->{"x","u(x,t)"},GridLines->Automatic,PlotLabel->"Solution to wave equation"]

Problems

From p.732:7-10, 15-17, pp.738-739: 12-17

Model solution:  13.5.11 (p. 738)

Statement

Solve the BVP: 
(Subscript[u, x x])+ (Subscript[u, y y])=0, for 0<x<π, y>0
u(x,y=0)=f(x) for 0<=x<= π
u(x=0,t)=0 for t>0
u(x=L,t)=0 for

Solution

This Laplace BVP is defined in a semi-infinite domain. Physical constraints impose u(x,y) finite as y→∞. In the separation of variables u(x,y)=X(x) Y(y) result

((X'')/X)=-((Y'')/Y)=-λ=-(α^2), Y(y)=(Subscript[c, 1])(e^(-α y))+(Subscript[c, 2])(e^(α y)),

only the λ=(α^2), α>0 positive choice leads to a solution satisfying the boundedness constraint, with (Subscript[c, 2])=0.

After applying the homogeneous Dirichlet conditions along x,
X(x)=(Subscript[c, 1]) cos(α x)+(Subscript[c, 2]) sin(α x), 
X(0)=0⇒(Subscript[c, 1])=0, X(π)=0⇒α=n∈ℕ\{0},

superposition of solutions gives

u(x,t) = (∑_(n=1)^∞)(Subscript[A, n]) sin (n x)(e^(-n y)),

with coefficients (Subscript[A, n]) given by the sine series of the  condition,

(Subscript[A, n])=(2/π)(∫_0^π) f(x)sin(n x) dx.

Solution study

Though not a homework requirement solution verification and visualization is informative, and aids in mastery of course concepts.

Solution verification:

Clear["Global`*"];
un[n_,x_,y_] =  Sin[ n x]Exp[-n y]

PDE = (∂_(x,x))un[n,x,y]+ (∂_(y,y))un[n,x,y] == 0

Define a function that returns the solution for boundary condition u(x,0)=f(x). This introduces the Mathematica Module construct used to define more complex functions. Note that in the following a function name is passed as an argument

u[x_,y_,nt_,f_]:= Module[{},
A[n_]=Assuming[n∈Integers,Integrate[Sin[n x] f[x],{x,0,π}]];
Return[Sum[A[n] un[n,x,y],{n,1,nt}]]
]

Define a parabolic boundary condition at y=0

p[x_]=x(π-x);

u[x,y,11,p]

ContourPlot[Evaluate[u[x,y,5,p]],{x,0,π},{y,0,10},FrameLabel->{"x","y"},PlotLabel->"Laplace equation solution",PlotLegends->Automatic]

The above can be now used to solve the problem for different y=0 condition

f[x_]=Sin[7x] x (π-x);
Plot[f[x],{x,0,π},PlotLabel->"Boundary condition at y=0"]

When evaluating u(x,y,nt,f) the sine series integrals are computed automatically.

ContourPlot[Evaluate[u[x,y,5,f]],{x,0,π},{y,0,1},FrameLabel->{"x","y"},PlotLabel->"Laplace equation solution",PlotLegends->Automatic,PlotRange->All]

The above corresponds to excitation of one edge of an electrostatic or acoustic field by an oscillatory pulse that dies down as y->∞. Such solutions are encountered in practice in radar and sonar applications.

Plot3D[Evaluate[u[x,y,5,f]],{x,0,π},{y,0,1},PlotLabel->{"x","y","u"},PlotLabel->"Laplace equation solution",PlotLegends->Automatic,PlotRange->All]

Project

p.734:25, p.739: 19