0% found this document useful (0 votes)
29 views27 pages

PDE Practical 1 - Merged

Uploaded by

wah0180904
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views27 pages

PDE Practical 1 - Merged

Uploaded by

wah0180904
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

First-Order Partial Differential Equation

The most general, first-order, partial differential equation in two independent variables x and
y is of the form

F (x, y, u, ux , uy ) = 0, (x, y) ∈ D ⊂ R2
where F is a given function of its arguments, and u = u (x, y) is an unknown function of the
independent variables x and y which lie in some given domain D in R2 , ux =∂u/∂x and uy =∂u/∂y
.Equation is often written interms of standard notation p = ux and q = uy so that takes the form

F (x, y, u, p, q) = 0,
Similarly, the most general, first-order, partial differential equation in three independent
variables x, y, z can be written as
F (x, y, z, u, ux , uy , uz ) = 0.

Second-Order Partial Differential Equation


The general linear second-order partial differential equation in one dependent variable u may
be written as
∑i,n j=1 Aij u xi x j + ∑in= j Bi u xi + F u = G,

in which we assume Aij = A ji and Aij , Bi , F , and G are real-valued functions defined in some
region of the space e ( x1 , x2 , ..., xn ).
Here we shall be concerned with second-order equations in the dependent variable u and
the independent variables x, y. Hence equation can be put in the form
Auxx + Buxy + Cuyy + Dux + Euy + Fu = G,
where the coefficients are functions of x and y and do not vanish simultaneously. We shall
assume that the function u and the coefficients are twice continuously differentiable in some
domain in R2 .

PRACTICAL 1
Solution of Cauchy problem for First-Order Partial Differential Equations :
Question1 : xux + yuy = 0
I n [ ] : = eqn1 = x * D[u[x, y], x] + y * D[u[x, y], y]  0;
sol1 = DSolve[eqn1, u[x, y], {x, y}]
O u t [ ] =
y
u[x, y]  1  
x

Question 2 : ux = 0
2 Pratical 1 pde.nb

I n [ ] : = eqn2 = D[u[x, y], x]  0;


sol2 = DSolve[eqn2, u[x, y], {x, y}]
O u t [ ] =

{{u[x, y]  1 [y]}}

Question 3 : ux + yuy = 0

I n [ ] : = eqn3 = D[u[x, y], x] + y * D[u[x, y], y]  0;


sol3 = DSolve[eqn3, u[x, y], {x, y}]
O u t [ ] =

{{u[x, y]  1 [-x y]}}

Question 4 : yuy - xux = 1

I n [ ] : = eqn4 = y * D[u[x, y], y] - x * D[u[x, y], x]  1;


sol4 = DSolve[eqn4, u[x, y], {x, y}]
O u t [ ] =

{{u[x, y]  - Log[x] + 1 [x y]}}

Question 5 : 2xyux + x 2 + y 2  uy = 0

I n [ ] : = eqn5 = 2 * x * y * D[u[x, y], x] + x2 + y2  * D[u[x, y], y]  0;


sol5 = DSolve[eqn5, u[x, y], {x, y}]
O u t [ ] =

y2
u[x, y]  1 - x + 
x

Question 6 : xux + yuy = x exp(-u)

I n [ ] : = eqn6 = x * D[u[x, y], x] + y * D[u[x, y], y]  x * (-u[x,y]) ;


sol6 = DSolve[eqn6, u[x, y], {x, y}]
O u t [ ] =
y
u[x, y]  Logx + 1  
x

Solution of Cauchy Problem for Second-Order Partial Differential Equations :


Question 1 : utt - uxx = 0 [WAVE EQUATION]
I n [ ] : = eqn1a = D[u[x, t], {t, 2}] - D[u[x, t], {x, 2}]  0;
sol1a = DSolve[eqn1a, u[x, t], {x, t}]
O u t [ ] =

{{u[x, t]  1 [t - x] + 2 [t + x]}}

Question 2 : utt - 9 uxx = 9.8 [NON HOMOGENEOUS WAVE EQUATION]


I n [ ] : = eqn2a = D[u[x, t], {t, 2}] - 9 * D[u[x, t], {x, 2}]  9.8;
sol2a = DSolve[eqn2a, u[x, t], {x, t}]
O u t [ ] =

u[x, t]  - 0.544444 x2 + 1 [t - 0.333333 x] + 2 [t + 0.333333 x]

Question 3 : utt + uxx = 9.8


I n [ ] : = eqn3a = D[u[x, t], {t, 2}] + D[u[x, t], {x, 2}]  0;
sol3a = DSolve[eqn3a, u[x, t], {x, t}]
O u t [ ] =

{{u[x, t]  1 [t +  x] + 2 [t -  x]}}
Pratical 1 pde.nb 3

Question 4 : utt - 4 uxx = 0


I n [ ] : = eqn4a = D[u[x, t], {t, 2}] - 4 * D[u[x, t], {x, 2}]  0;
sol4a = DSolve[eqn4a, u[x, t], {x, t}]
O u t [ ] =
x x
u[x, t]  1 t -  + 2 t + 
2 2
PRACTICAL 2
Plotting the integral surfaces of a given PDE with given initial data :
Question 1 : ux + uy = u2
u(x,-x) = 1
I n [ ] : = eqn1 = D[u[x, y], x] + D[u[x, y], y]  u[x, y] * u[x, y]
sol1 = DSolve[{eqn1, u[x, - x]  1}, u[x, y], {x, y}]
O u t [ ] =

u(0,1) [x, y] + u(1,0) [x, y]  u[x, y]2


O u t [ ] =
2
u[x, y]  - 
-2 + x + y

I n [ ] : = Plot3D[u[x, y] /. sol1, {x, - 10, 10}, {y, - 10, 10},


PlotLabel  "Integral surface through initial curve"]
O u t [ ] =

Question 2 : ux +2 uy = 0
2
u(0,y) = e(-y)
I n [ ] : = eqn2 = D[u[x, y], x] + 2 * D[u[x, y], y]  0
sol2 = DSolve[{eqn2, u[0, y]  Exp[- y ^ 2]}, u[x, y], {x, y}]
O u t [ ] =

2 u(0,1) [x, y] + u(1,0) [x, y]  0


O u t [ ] =
2
u[x, y]  -(-2 x+y) 
2 practil 2 pde.nb

I n [ ] : = Plot3D[u[x, y] /. sol2, {x, - 5, 5}, {y, - 4, 4},


PlotLabel  "Integral surface through initial curve"]
O u t [ ] =

Question 3 : ux + uy = 1
u(x,2x) = x 3
I n [ ] : = eqn3 = D[u[x, y], x] + D[u[x, y], y]  1
sol3 = DSolveeqn3, u[x, 2 * x]  x3 , u[x, y], {x, y}
O u t [ ] =

u(0,1) [x, y] + u(1,0) [x, y]  1


O u t [ ] =

u[x, y]  2 x - x3 - y + 3 x2 y - 3 x y2 + y3 

I n [ ] : = Plot3D[u[x, y] /. sol3, {x, - 5, 5}, {y, - 4, 4},


PlotLabel  "Integral surface through initial curve"]
O u t [ ] =

Question 4 : yu x + xu y = 0
practil 2 pde.nb 3

2
u(0,y) = e(- y) 
I n [ ] : = eqn4 = y * D[u[x, y], x] + x * D[u[x, y], y]  0
2
sol4 = DSolveeqn4, u[0, y]  -y  , u[x, y], {x, y}
O u t [ ] =

x u(0,1) [x, y] + y u(1,0) [x, y]  0


O u t [ ] =
2
-y2
u[x, y]  x 

I n [ ] : = Plot3D[u[x, y] /. sol4, {x, - 10, 10}, {y, - 10, 10},


PlotLabel  "Integral surface through initial curve"]
O u t [ ] =

Question 5 : xux + uy = 0
u(x,0) = x 2
I n [ ] : = eqn5 = x * D[u[x, y], x] + D[u[x, y], y]  0
sol5 = DSolveeqn5, u[x, 0]  x2 , u[x, y], {x, y}
O u t [ ] =

u(0,1) [x, y] + x u(1,0) [x, y]  0


O u t [ ] =

u[x, y]  -2 y x2 
4 practil 2 pde.nb

I n [ ] : = Plot3D[u[x, y] /. sol5, {x, - 10, 10}, {y, - 10, 10},


PlotLabel  "Integral surface through initial curve"]
O u t [ ] =
PRACTICAL 3
Plotting the characteristics for the first order partial differential equations :
Question 1: (a) (u - y ) ux + yuy =x+y

I n [ ] : = f0 = Plot3D[- x, {x, 0, 1}, {y, 0, 1}, PlotPoints  10]


f1 = Plot3D[5 y - x, {x, 0, 1}, {y, 0, 1}, PlotPoints  10];
f2 = Plot3D[10 y - x, {x, 0, 1}, {y, 0, 1}, PlotPoints  10];
g1 = Show[f0, f1, f1];
h0 = Plot3D[x + y, {x, 0, 1}, {y, 0, 1}, PlotPoints  10];
h1 = Plot3D[Sqrt[(x + y) ^ 2 + 5], {x, 0, 1}, {y, 0, 1}, PlotPoints  10];
h2 = Plot3D[Sqrt[(x + y) ^ 2 + 10], {x, 0, 1}, {y, 0, 1}, PlotPoints  10];
g2 = Show[h0, h1, h1];
Show[GraphicsArray[{g1, g2}]]
O u t [ ] =

O u t [ ] =

Question 1: (b) (u - y ) ux + yuy =x+y


2 PDE Practical 3.nb

I n [ ] : = f0 = Plot3D[0, {x, 0, 1}, {y, 0, 1}, PlotPoints  10]


f1 = Plot3D[5 y, {x, 0, 1}, {y, 0, 1}, PlotPoints  10];
f2 = Plot3D[10 y, {x, 0, 1}, {y, 0, 1}, PlotPoints  10];
g1 = Show[f0, f1, f1];
h0 = Plot3D[0, {x, 0, 1}, {y, 0, 1}, PlotPoints  10];
h1 = Plot3D[15 y + 5, {x, 0, 1}, {y, 0, 1}, PlotPoints  10];
h2 = Plot3D[25 y - 5, {x, 0, 1}, {y, 0, 1}, PlotPoints  10];
g2 = Show[h0, h1, h1];
Show[GraphicsArray[{g1, g2}]]
O u t [ ] =

O u t [ ] =
D’Alembert
We shall consider the following Cauchy problem of an infinite string
with the initial condition
utt - c2 uxx = 0, , xϵ ℝ, t > 0, (1)
u(x, 0) = f (x), xϵ ℝ, (2)
ut (x, 0) = g(x), xϵ ℝ. (3)
By the method of characteristics described , the characteristic equation according to equation
dx2 − c2 dt2 = 0
which reduces to
dx + c dt = 0, dx − c dt = 0
The integrals are the straight lines
x + ct = c1 , x − ct = c2
Introducing the characteristic coordinates
ξ = x + ct, η = x − ct,
we obtain
uxx = uξξ + 2 uξη + uηη , utt = c2 (uξξ − 2 uξη + uηη ).
Substitution of these in equation (1) yields
− 4 c2 uξη = 0

Since c =/ 0, we have
uξη = 0.
Integrating with respect to ξ, we obtain
uη = ψ∗(η)
where ψ∗(η) is an arbitrary function of η. Integrating again with respect to η, we obtain
u (ξ,η) = ψ∗(η) dη + ϕ(ξ).
If we set ψ (η) = *ψ∗(η) dη, we have
u (ξ,η) = φ (ξ) + ψ (η),
where φ and ψ are arbitrary functions. Transforming to the original variables x and t, we find
the general solution of the wave equation
u (x, t) = ϕ (x + ct) + ψ (x − ct), (4)
provided φ and ψ are twice differentiable functions. Now applying the initial conditions (2)
and (3), we obtain
u (x, 0) = f (x) = φ (x) + ψ (x), (5)
ut (x, 0) = g (x) = c φ′(x) − c ψ′(x) (6)
Integration of equation (6) gives
1
ϕ(x) − ψ (x) = ∫ g (τ ) dτ + K, (7)
c

where x0 and K are arbitrary constants. Solving for φ and ψ from equations(5) and (7), we
2 PDE Pratical 4.nb

obtain
1 1 K
ϕ(x) = f(x) + ∫ g (τ ) dτ + ,
2 2c 2
1 1 K
ψ(x) = f(x) - ∫ g (τ ) dτ - .
2 2c 2

The solution is thus given by


1 1 x +ct x -ct
u (x, t) = 2[f (x + ct) + f (x − ct)] + ∫ g (τ) τ - ∫x g (τ) τ
2 2 c x0 0
1 1 x +ct
= 2[f (x + ct) + f (x − ct)] + ∫x-ct g (τ) τ .
2 2c

This is called the celebrated d’Alembert solution of the Cauchy problem for the one-dimen-
sional wave equation.

PRACTICAL 4
Solution of vibrating string problem using D’Alembert formula with initial
conditions :
Question 1 : utt - c2 uxx = 0,
u(x, 0) = f (x), - π/2 ≤ x ≤π/2
ut (x, 0) = g(x), t > 0.
with initial conditions f (x) = Cos( x )3 and g(x) = 0. Take c = 1
PDE Pratical 4.nb 3

I n [ ] : = c = 1;
f[x_] = Which- Pi / 2 ≤ x ≤ Pi / 2, Cos[x]3 , True, 0
u[x_, t_] := (f[x + c * t] + f[x - c * t]) / 2
h0 = Plot[Evaluate[u[x, 0]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = 0", LabelStyle  Directive[Bold, Blue]];
h1 = Plot[Evaluate[u[x, 1]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = 0", LabelStyle  Directive[Bold, Blue]];
h2 = Plot[Evaluate[u[x, Pi / 2]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = Pi/2", LabelStyle  Directive[Bold, Blue]];
h3 = Plot[Evaluate[u[x, 3]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = 3", LabelStyle  Directive[Bold, Blue]];
h4 = Plot[Evaluate[u[x, 4]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = 4", LabelStyle  Directive[Bold, Blue]];
h5 = Plot[Evaluate[u[x, 5]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = 5", LabelStyle  Directive[Bold, Blue]];
Show[GraphicsGrid[{{h0, h1}, {h2, h3}, {h4, h5}}, Frame  All, FrameStyle  Black]]
O u t [ ] =
π π
Which- ≤x≤ , Cos[x]3 , True, 0
2 2
O u t [ ] =

Wave at t = 0 Wave at t = 0
1.0 1.0

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

-5 0 5 -5 0 5

Wave at t = Pi/2 Wave at t = 3


1.0 1.0

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

-5 0 5 -5 0 5

Wave at t = 4 Wave at t = 5
1.0 1.0

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

-5 0 5 -5 0 5
4 PDE Pratical 4.nb

I n [ ] : = Plot3D[u[x, t], {x, - Pi / 2, Pi / 2}, {t, 0, 5}, PlotPoints  100,


AxesLabel  {"Position (x)", "Time (t)", "Value (u)"},
PlotRange  {0, 1}, PlotLabel  "Surface : u = u(x,t)", LabelStyle  Bold]
O u t [ ] =

Question 2 : utt - c2 uxx = 0, , xϵ ℝ, t > 0,


u(x, 0) = f (x), xϵ ℝ,
ut (x, 0) = g(x), xϵ ℝ,
with initial conditions f (x) = Sin(x) and g(x) = x 2 . Take c = 1
I n [ ] : = c = 1;
f[x_] := 0
g[x_] := Sin[x]
u[x_, t_] := 1 / 2 * (f[x + c * t])
PDE Pratical 4.nb 5

I n [ ] : = c = 1;
f[x_] = Which[- Pi / 2 ≤ x ≤ Pi / 2, Sin[x], True, x ^ 2]
u[x_, t_] := (f[x + c * t] + f[x - c * t]) / 2
h0 = Plot[Evaluate[u[x, 0]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = 0", LabelStyle  Directive[Bold, Blue]];
h1 = Plot[Evaluate[u[x, 1]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = 0", LabelStyle  Directive[Bold, Blue]];
h2 = Plot[Evaluate[u[x, Pi / 2]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = Pi/2", LabelStyle  Directive[Bold, Blue]];
h3 = Plot[Evaluate[u[x, 3]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = 3", LabelStyle  Directive[Bold, Blue]];
h4 = Plot[Evaluate[u[x, 4]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = 4", LabelStyle  Directive[Bold, Blue]];
h5 = Plot[Evaluate[u[x, 5]], {x, - 8, 8}, PlotRange  {0, 1},
PlotLabel  "Wave at t = 5", LabelStyle  Directive[Bold, Blue]];
Show[GraphicsGrid[{{h0, h1}, {h2, h3}, {h4, h5}}, Frame  All, FrameStyle  Black]]
O u t [ ] =
π π
Which- ≤x≤ , Sin[x], True, x2 
2 2
O u t [ ] =

Wave at t = 0 Wave at t = 0
1.0 1.0

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

-5 0 5 -5 0 5

Wave at t = Pi/2 Wave at t = 3


1.0 1.0

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

-5 0 5 -5 0 5

Wave at t = 4 Wave at t = 5
1.0 1.0

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

-5 0 5 -5 0 5
6 PDE Pratical 4.nb

I n [ ] : = Plot3D[u[x, t], {x, - Pi / 2, Pi / 2}, {t, 0, 5}, PlotPoints  100,


AxesLabel  {"Position (x)", "Time (t)", "Value (u)"},
PlotRange  {0, 1}, PlotLabel  "Surface : u = u(x,t)", LabelStyle  Bold]
O u t [ ] =
Conduction of Heat in Solids
We consider a domain D∗ bounded by a closed surface B∗. Let u (x, y, z, t)be the temperature
at a point (x, y, z) at time t. If the temperature is not constant, heat flows from places of
higher temperature to places of lower temperature. Fourier’s law states that the rate of flow
is proportional to the gradient of the temperature. Thus the velocity of the heat flow in an
isotropic body is
v = −Kgradu
where K is a constant, called the thermal conductivity of the body. Let D be an arbitrary
domain bounded by a closed surface B in D∗. Then the amount of heat leaving D per unit time
is
∫ ∫B vn ds,

where vn = v · n is the component of v in the direction of the outer unit normal n of B. Thus, by
Gauss’ theorem (Divergence theorem)

∫ ∫B vn ds = ∫ ∫ ∫D div(-Kgradu) dx dy dz
= -K ∫ ∫ ∫D ∇2 u dx dy dz .

But the amount of heat in D is given by


∫ ∫ ∫D σρu dx dy dz,
where ρ is the density of the material of the body and σ is its specific heat. Assuming that
integration and differentiation are interchangeable, the rate of decrease of heat in D is
∂u
-∫ ∫ ∫D σρ dx dy dz.
∂t

Since the rate of decrease of heat in D must be equal to the amount of heat leaving D per unit
time, we have
-∫ ∫ ∫D σρut dx dy dz = -K ∫ ∫ ∫D ∇2 u dx dy dz

or
-∫ ∫ ∫D [σρut - K∇2 u] dx dy dz = 0

for an arbitrary D in D∗. We assume that the integrand is continuous. If we suppose that the
integrand is not zero at a point (x0, y0, z0) in D, then, by continuity, the integrand is not zero
in a small region surrounding the point (x0, y0, z0). Continuing in this fashion we extend the
region encompassing D. Hence the integral must be nonzero. This contradicts . Thus, the
integrand is zero everywhere, that is,
ut = k ∇2 u,
where κ = K/σρ. This is known as the HEAT EUQATION.
2 pratical 5 pde.nb

PRACTICAL 5
SOLUTION OF HEAT EQUATION utt = kuxx WITH INITIAL CONDITIONS :
Question 1 : (a) ut - uxx = 0, 0 < x < 5 t>0
u(x,0) = 0, 0<x<5
u(0,t) = sin(t), t⩾0
u(5,t) = 0, t≧0.
I n [ ] : = eqn1a = {∂t u[x, t] - ∂x,x u[x, t]  0, u[x, 0]  0, u[0, t]  Sin[t], u[5, t]  0}
O u t [ ] =

u(0,1) [x, t] - u(2,0) [x, t]  0, u[x, 0]  0, u[0, t]  Sin[t], u[5, t]  0

I n [ ] : = sol1a = u[x, t] /.
NDSolve[eqn1a, u[x, t], {x, 0, 5}, {t, 0, 10}, PrecisionGoal  3]〚1〛
O u t [ ] =

Domain: {{0., 5.}, {0., 10.}}


InterpolatingFunction [x, t]
Output: scalar

I n [ ] : = Plot3D[sol1a, {x, 0, 5}, {t, 0, 10},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =

Question 1 : (b) ut - uxx = 0, 0 < x < 20 t>0


u(x,0) = 0, 0 < x < 20
2
u(0,t) = t *sin(t), t⩾0
u(20,t) = 0, t⩾0.
I n [ ] : = eqn1b = ∂t u[x, t] - ∂x,x u[x, t]  0, u[x, 0]  0, u[0, t]  t2 * Sin[t], u[20, t]  0
O u t [ ] =

u(0,1) [x, t] - u(2,0) [x, t]  0, u[x, 0]  0, u[0, t]  t2 Sin[t], u[20, t]  0


pratical 5 pde.nb 3

I n [ ] : = sol1b = u[x, t] /.
NDSolve[eqn1b, u[x, t], {x, 0, 20}, {t, 0, 10}, PrecisionGoal  3]〚1〛
O u t [ ] =

Domain: {{0., 20.}, {0., 10.}}


InterpolatingFunction [x, t]
Output: scalar

I n [ ] : = Plot3D[sol1b, {x, 0, 20}, {t, 0, 10},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =

Question 1 : (c) ut - uxx = 0, 0 < x < 20, t>0


u(x,0) = 0, 0 < x < 20,
u(0,t) = t2 , t⩾0
u(20,t) = 0, t⩾0.
I n [ ] : = eqn1c = ∂t u[x, t] - ∂x,x u[x, t]  0, u[x, 0]  0, u[0, t]  t2 , u[20, t]  0
O u t [ ] =

u(0,1) [x, t] - u(2,0) [x, t]  0, u[x, 0]  0, u[0, t]  t2 , u[20, t]  0

I n [ ] : = sol1c = u[x, t] /.
NDSolve[eqn1c, u[x, t], {x, 0, 20}, {t, 0, 10}, PrecisionGoal  3]〚1〛
O u t [ ] =

Domain: {{0., 20.}, {0., 10.}}


InterpolatingFunction [x, t]
Output: scalar
4 pratical 5 pde.nb

I n [ ] : = Plot3D[sol1c, {x, 0, 20}, {t, 0, 10},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =

Question 2 : (a) ut - uxx = 0, 0 < x < 5, t>0


u(x,0) = Sin(x), 0 < x ≤ 5,
u(0,t) = 1, t⩾0
u(5,t) = 0, t⩾0.
I n [ ] : = eqn2a = {∂t u[x, t] - ∂x,x u[x, t]  0, u[x, 0]  Sin[x], u[0, t]  1, u[5, t]  0}
O u t [ ] =

u(0,1) [x, t] - u(2,0) [x, t]  0, u[x, 0]  Sin[x], u[0, t]  1, u[5, t]  0

I n [ ] : = sol2a = u[x, t] /.
NDSolve[eqn2a, u[x, t], {x, 0, 5}, {t, 0, 10}, PrecisionGoal  3]〚1〛
O u t [ ] =

Domain: {{0., 5.}, {0., 10.}}


InterpolatingFunction [x, t]
Output: scalar

I n [ ] : = Plot3D[sol2a, {x, 0, 5}, {t, 0, 10},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =

Question 2 : (b) ut - 4*uxx = 0, 0<x<5 t>0


u(x,0) = x 2 (1 - x ), 0<x≤5
u(0,t) = 10, t⩾0
u(1,t) = 0, t⩾0.
pratical 5 pde.nb 5

I n [ ] : = eqn2b = ∂t u[x, t] - 4 * ∂x,x u[x, t]  0, u[x, 0]  x2 * (1 - x), u[0, t]  0, u[1, t]  0


O u t [ ] =

u(0,1) [x, t] - 4 u(2,0) [x, t]  0, u[x, 0]  (1 - x) x2 , u[0, t]  0, u[1, t]  0

I n [ ] : = sol2b = u[x, t] /.
NDSolve[eqn2b, u[x, t], {x, 0, 1}, {t, 0, 10}, PrecisionGoal  3]〚1〛
O u t [ ] =

Domain: {{0., 1.}, {0., 10.}}


InterpolatingFunction [x, t]
Output: scalar

I n [ ] : = Plot3D[sol2b, {x, 0, 1}, {t, 0, 4},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =
One Dimensional Wave Equation
Let us consider a stretched string of length l fixed at the end points. The problem here is to
determine the equation of motion which characterizes the position u (x, t) of the string at time
t after an initial disturbance is given.
In order to obtain a simple equation, we make the following assumptions:
1. The string is flexible and elastic, that is the string cannot resist bending moment and thus
the tension in the string is always in the direction of the tangent to the existing profile of the
string.
2. There is no elongation of a single segment of the string and hence, by Hooke’s law, the
tension is constant.
3. The weight of the string is small compared with the tension in the string.
4. The deflection is small compared with the length of the string.
5. The slope of the displaced string at any point is small compared with unity.
6. There is only pure transverse vibration.
We consider a differential element of the string. Let T be the tension at the end points . The
forces acting on the element of the string in the vertical direction are
T sin β − T sin α.
By Newton’s second law of motion, the resultant force is equal to the mass times the accelera-
tion. Hence,
T sin β − T sin α = ρ δs utt
where ρ is the line density and δs is the smaller arc length of the string. Since the slope of the
displaced string is small, we have
δs ≃ δ x
Since the angles α and β are small
sin α ≃ tan α, sin β ≃ tan β
Thus, equation becomes
ρδx
tan β − tan α = utt .
T

But, from calculus we know that tan α and tan β are the slopes of the string at x and x + δ x :
tan α = ux (x, t)
and
tan β = ux (x + δx , t)
at time t. Equation may thus be written as
1 ρ 1 ρ
= (ux )x + δx - (ux )x ] = utt , = [ux ( x + δx ) - ux (x,t)] = utt
δx T δx T

In the limit as δX approaches zero, we find


utt = c2 uxx
where c2 = T /ρ. This is called the ONE-DIMENSIONAL WAVE EQATION.
2 practical 6pde.nb

PRACTICAL 6
Solution of one dimensional wave equation :
Question 1 : (a) utt - uxx = 0, 0 < x < a, t>0,
u(x,0) = Log(1+x^2), 0 < x ⩽ a,
ut (x,0)=2, 0 < x ⩽ a.
I n [ ] : = eqn1a = ∂t,t u[x, t] - ∂x,x u[x, t]  0, u[x, 0]  Log1 + x2 ,
Derivative[0, 1][u][x, 0]  2
O u t [ ] =

u(0,2) [x, t] - u(2,0) [x, t]  0, u[x, 0]  Log1 + x2 , u(0,1) [x, 0]  2

I n [ ] : = sol1a = u[x, t] /.
NDSolve[eqn1a, u[x, t], {x, 0, 1}, {t, 0, 4}, PrecisionGoal  3]〚1〛

NDSolve: Warning: an insufficient number of boundary conditions have been specified for the direction of independent
variable x. Artificial boundary effects may be present in the solution.
O u t [ ] =

Domain: {{0., 1.}, {0., 4.}}


InterpolatingFunction [x, t]
Output: scalar

I n [ ] : = Plot3D[sol1a, {x, 0, 1}, {t, 0, 4},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =

Question 1 : (b) utt - uxx = 0, 0 < x < a, t>0,


u(x,0) = s=SIn[x], 0 < x ⩽ a,
ut (x,0)=Cos[x], 0 < x ⩽ a.
I n [ ] : = eqn1b = {∂t,t u[x, t] - ∂x,x u[x, t]  0, u[x, 0]  Sin[x],
Derivative[0, 1][u][x, 0]  Cos[x]}
O u t [ ] =

u(0,2) [x, t] - u(2,0) [x, t]  0, u[x, 0]  Sin[x], u(0,1) [x, 0]  Cos[x]


practical 6pde.nb 3

I n [ ] : = sol1b = u[x, t] /.
NDSolve[eqn1b, u[x, t], {x, 0, 1}, {t, 0, 4}, PrecisionGoal  3]〚1〛

NDSolve: Warning: an insufficient number of boundary conditions have been specified for the direction of independent
variable x. Artificial boundary effects may be present in the solution.
O u t [ ] =

Domain: {{0., 1.}, {0., 4.}}


InterpolatingFunction [x, t]
Output: scalar

I n [ ] : = Plot3D[sol1b, {x, 0, 1}, {t, 0, 4},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =

Question 2 : (a) utt - 4 uxx =0 0 < x < a, t>0,


u(x,0) = 10 x 4 0 < x ⩽ a,
ut (x,0) = 0 0 < x ⩽ a,
u(t,0) = 0 t≥0.
I n [ ] : = eqn2a = ∂t,t u[x, t] - 4 * ∂x,x u[x, t]  0, u[x, 0]  10 * x4 ,
Derivative[0, 1][u][x, 0]  0, u[0, t]  0
O u t [ ] =

u(0,2) [x, t] - 4 u(2,0) [x, t]  0, u[x, 0]  10 x4 , u(0,1) [x, 0]  0, u[0, t]  0

I n [ ] : = sol2a = u[x, t] /.
NDSolve[eqn2a, u[x, t], {x, 0, 1}, {t, 0, 4}, PrecisionGoal  3]〚1〛
O u t [ ] =

Domain: {{0., 1.}, {0., 4.}}


InterpolatingFunction [x, t]
Output: scalar
4 practical 6pde.nb

I n [ ] : = Plot3D[sol2a, {x, 0, 1}, {t, 0, 4},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =

Question 2 : (b) utt - 4 * uxx = 0 0 < x < a, t>0,


u(x,0) = x 4 , 0 < x ⩽ a,
ut (x,0) = 0, 0 < x ⩽ a,
u(0,t) = 0. t≥0.
I n [ ] : = eqn2b = ∂t,t u[x, t] - ∂x,x u[x, t]  0, u[x, 0]  x4 ,
Derivative[0, 1][u][x, 0]  0, u[0, t]  0
O u t [ ] =

u(0,2) [x, t] - u(2,0) [x, t]  0, u[x, 0]  x4 , u(0,1) [x, 0]  0, u[0, t]  0

I n [ ] : = sol2b = u[x, t] /.
NDSolve[eqn2b, u[x, t], {x, 0, 1}, {t, 0, 4}, PrecisionGoal  3]〚1〛
O u t [ ] =

Domain: {{0., 1.}, {0., 4.}}


InterpolatingFunction [x, t]
Output: scalar
practical 6pde.nb 5

I n [ ] : = Plot3D[sol2b, {x, 0, 1}, {t, 0, 4},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =

Question 3 : (a) utt - 9 uxx = 0 0 < x < a, t>0,


u(x,0) = 0 0 < x ⩽ a,
ut (x,0) = x 3 0 < x ⩽ a,
ux (0,t) = 0 t≥0.
I n [ ] : = eqn3a = ∂t,t u[x, t] - 9 * ∂x,x u[x, t]  0, u[x, 0]  0,
Derivative[0, 1][u][x, 0]  x3 ,
Derivative[1, 0][u][0, t]  0
O u t [ ] =

u(0,2) [x, t] - 9 u(2,0) [x, t]  0, u[x, 0]  0, u(0,1) [x, 0]  x3 , u(1,0) [0, t]  0

I n [ ] : = sol3a = u[x, t] /.
NDSolve[eqn3a, u[x, t], {x, 0, 1}, {t, 0, 4}]
O u t [ ] =

Domain: {{0., 1.}, {0., 4.}}


InterpolatingFunction [x, t]
Output: scalar
6 practical 6pde.nb

I n [ ] : = Plot3D[sol3a, {x, 0, 1}, {t, 0, 4},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =

Question 3 : (b) utt - 4 uxx = 0 0 < x < a, t>0,


u(x,0) = x 4 0 < x ⩽ a,
ut (x,0) = x 3 0 < x ⩽ a,
ux (0,t) = 0 t≥0.
I n [ ] : = eqn3b = ∂t,t u[x, t] - 4 * ∂x,x u[x, t]  0, u[x, 0]  x4 ,
Derivative[0, 1][u][x, 0]  x3 ,
Derivative[1, 0][u][0, t]  0
O u t [ ] =

u(0,2) [x, t] - 4 u(2,0) [x, t]  0, u[x, 0]  x4 , u(0,1) [x, 0]  x3 , u(1,0) [0, t]  0

I n [ ] : = sol3b = u[x, t] /.
NDSolve[eqn3b, u[x, t], {x, 0, 1}, {t, 0, 4}]
O u t [ ] =

Domain: {{0., 1.}, {0., 4.}}


InterpolatingFunction [x, t]
Output: scalar
practical 6pde.nb 7

I n [ ] : = Plot3D[sol3b, {x, 0, 1}, {t, 0, 4},


AxesLabel  {"x", "t", "u"}, Ticks  {{0, 1, 2, 3, 4}, {0, 1}, {- 3, 0}}]
O u t [ ] =

You might also like