Docsity

Solving Initial Value Problems and Wave Equations with MATLAB - Prof. Mike, Summaries of Mathematics

Toggle sidebar
bg1
Assignment 04 Solution
Pawan Khanal
Solution of Question Number 1
We are asked to solve the following initial value problem:
4∂tu(x, t) + a· ∇u(x, t)=0,(x, t)∈R2×(0,∞),
u(y, 0) = (2−(y2
1+y2
2),if y2
1+y2
2≤2,
0,otherwise,
where a= (1,1) ∈R2and B={y∈R2:y2
1+y2
2≤2}.
We begin with the PDE:
4∂u
∂t +a· ∇u(x, t)=0,
where a= (1,1), and ∇u(x, t) is the gradient of uwith respect to the spatial
variables x1and x2.
Expanding the dot product:
4∂u
∂t +∂u
∂x1
+∂u
∂x2
= 0.
This is a first-order linear PDE.
Apply a Linear Transformation
We apply a linear transformation to simplify the equation. Define:
T(x1, x2, t) = (ζ1, ζ2) = (x1+x2, t).
This transformation combines the two spatial variables x1and x2into one
variable ζ1, while keeping ζ2=t.
Thus, the function u(x1, x2, t) transforms into a new function ˆu(ζ1, ζ2):
u(x1, x2, t) = ˆu(ζ1, ζ2).
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Solving Initial Value Problems and Wave Equations with MATLAB - Prof. Mike and more Summaries Mathematics in PDF only on Docsity!

Assignment 04 Solution

Pawan Khanal

Solution of Question Number 1

We are asked to solve the following initial value problem:

4 ∂tu(x, t) + a · ∇u(x, t) = 0, (x, t) ∈ R^2 × (0, ∞),

u(y, 0) =

2 − (y^21 + y^22 ), if y^21 + y^22 ≤ 2 , 0 , otherwise,

where a = (1, 1) ∈ R^2 and B = {y ∈ R^2 : y^21 + y^22 ≤ 2 }.

We begin with the PDE:

∂u ∂t

  • a · ∇u(x, t) = 0,

where a = (1, 1), and ∇u(x, t) is the gradient of u with respect to the spatial

variables x 1 and x 2. Expanding the dot product:

∂u ∂t

∂u ∂x 1

∂u ∂x 2

This is a first-order linear PDE.

Apply a Linear Transformation

We apply a linear transformation to simplify the equation. Define:

T (x 1 , x 2 , t) = (ζ 1 , ζ 2 ) = (x 1 + x 2 , t).

This transformation combines the two spatial variables x 1 and x 2 into one

variable ζ 1 , while keeping ζ 2 = t. Thus, the function u(x 1 , x 2 , t) transforms into a new function ˆu(ζ 1 , ζ 2 ):

u(x 1 , x 2 , t) = ˆu(ζ 1 , ζ 2 ).

Now, we express the derivatives in terms of the new variables ζ 1 and ζ 2 :

ˆ The time derivative becomes:

∂u ∂t

∂ uˆ ∂ζ 2

ˆ The spatial derivatives become:

∂u ∂x 1

∂ uˆ ∂ζ 1

∂u ∂x 2

∂ uˆ ∂ζ 1

Substituting these into the original PDE:

∂ uˆ ∂ζ 2

∂ ˆu ∂ζ 1

∂ uˆ ∂ζ 1

Simplifying:

∂ ˆu ∂ζ 2

∂ ˆu ∂ζ 1

This equation can be solved using the method of characteristics. To solve the PDE, we need to find the characteristic curves along which the solution is constant. The characteristic equations are:

dζ 1 ds

dζ 2 ds

where s is a parameter along the characteristics.

Solve the Characteristic Equations

Solve the characteristic equations:

ζ 1 = 2s + C 1 , ζ 2 = 4s + C 2.

Eliminate the parameter s:

s =

ζ 2 − C 2 4

Substitute into the equation for ζ 1 :

ζ 1 = 2

ζ 2 − C 2 4

+ C 1 =

ζ 2 − C 2 2

+ C 1.

f (ζ 1 − 2 ζ 2 ) =

2 − (ζ^1 −^2 ζ^2 )

2 2 ,^ if (ζ^1 −^2 ζ^2 )

0 , otherwise.

Substituting back the original variables ζ 1 = x 1 + x 2 and ζ 2 = t, we get the

final solution:

u(x 1 , x 2 , t) =

2 − (x^1 +x^2 −^2 t)

2 2 ,^ if (x^1 +^ x^2 −^2 t)

0 , otherwise.

Plotting u(s, s, 4)

To plot u(s, s, 4), we will evaluate the function using the expression:

u(s, s, 4) =

2 − (2s−8)

2 2 ,^ if (2s^ −^ 8)

0 , otherwise.

We will calculate this for s in the range [0, 10]. Specifically, we will check if the condition (2s − 8)^2 ≤ 2 holds for each s value. If it does, we will compute u(s, s, 4); if not, we will set u(s, s, 4) = 0. After calculating the values, we will plot u(s, s, 4) against s, showing how the solution behaves at time t = 4.

Figure 1: Plot for u(s,s,4) from matlab.

Figure 3: Plot for u(s,s,16) from matlab.

Figure 4: surface Plot for u(s,s,16) from matlab.

Solution of Question Number 02

Given the wave equation defined as:  



∂^2 t u(x, t) − α^2 ∂ x^2 u(x, t) = 0, (x, t) ∈ R × (0, ∞), u(s, 0) = ϕ(s), s ∈ R, ∂tu(s, 0) = ψ(s), s ∈ R, where α ∈ R, ϕ : R → R, ψ : R → R. Define

w(x, t) := ∂tu(x, t) − α∂xu(x, t).

Proving that w is Governed by a First Order PDE

To prove that w is governed by a first order PDE, we start by differentiating the expression for w:

∂tw(x, t) = ∂t (∂tu(x, t) − α∂xu(x, t)) = ∂^2 t u(x, t) − α∂t∂xu(x, t).

From the wave equation (2.1), we have:

∂ t^2 u(x, t) = α^2 ∂^2 xu(x, t). Substituting this into our expression for ∂tw:

∂tw(x, t) = α^2 ∂ x^2 u(x, t) − α∂t∂xu(x, t). Next, we differentiate w with respect to x:

∂xw(x, t) = ∂x (∂tu(x, t) − α∂xu(x, t)) = ∂x∂tu(x, t) − α∂ x^2 u(x, t).

Now we set the expressions equal:

∂tw(x, t)+α∂xw(x, t) = α^2 ∂ x^2 u(x, t)−α∂t∂xu(x, t)+α∂x∂tu(x, t)−α^2 ∂ x^2 u(x, t) = 0.

Thus, we have:

∂tw(x, t) + α∂xw(x, t) = 0. This is the first-order PDE that governs w.

Solve the PDE to Get w

The PDE

∂tw + α∂xw = 0 is a first-order linear homogeneous equation. The general solution can be expressed as:

w(x, t) = f (x − αt), where f is an arbitrary function determined by the initial conditions. To find f , we use the initial condition from the definition of w:

w(x, 0) = ∂tu(x, 0) = ψ(x). Thus,

f (x) = ψ(x). So the expression for w becomes:

w(x, t) = ψ(x − αt).

Substitute w into Equation (2.2) to Solve for u

Now substituting w(x, t) into the equation for u:

w(x, t) = ∂tu(x, t) − α∂xu(x, t). This leads to:

∂tu(x, t) = w(x, t) + α∂xu(x, t). Substituting w(x, t):

∂tu(x, t) = ψ(x − αt) + α∂xu(x, t). Rearranging gives:

∂tu − α∂xu = ψ(x − αt). This is another first-order linear PDE.

Solution of Question Number 3

Consider the following second-order ODE:

−u′′(x) + μ(x)u(x) = f (x), x ∈ R,

where:

μ(x) =

1 if x ∈ (−∞, −1), −π^2 if x ∈ [− 1 , 1], 1 if x ∈ (1, ∞),

and

f (x) =

2 ex^ if x ∈ (−∞, −1), 0 if x ∈ [− 1 , 1], 2 e−x^ if x ∈ (1, ∞). We are tasked with constructing a unique solution u : R → R, such that: Z (^) ∞

−∞

|u(x)|^2 dx < ∞,

Z ∞

−∞

|u′(x)|^2 dx < ∞,

Z ∞

−∞

|u′′(x)|^2 dx < ∞.

Solve for u(x) in Each Region

Since μ(x) and f (x) are piecewise functions, we will solve the ODE separately for each region: (−∞, −1), [− 1 , 1], and (1, ∞).

Region 1: x ∈ (−∞, −1)

For x ∈ (−∞, −1), the ODE becomes:

−u′′(x) + u(x) = 2ex.

This is a non-homogeneous second-order ODE. The general solution consists of the homogeneous solution and the particular solution. Homogeneous Solution: The homogeneous equation is:

−u′′(x) + u(x) = 0.

The characteristic equation is:

m^2 = 1 =⇒ m = ± 1.

Thus, the homogeneous solution is:

uh(x) = C 1 ex^ + C 2 e−x.

Particular Solution: To find the particular solution, assume:

up(x) = Aex.

Substituting into the non-homogeneous equation:

−(Aex)′′^ + Aex^ = 2ex^ =⇒ Aex^ = 2ex^ =⇒ A = 2.

Thus, the particular solution is:

up(x) = 2ex.

General Solution in Region 1: The general solution in (−∞, −1) is:

u(x) = C 1 ex^ + C 2 e−x^ + 2ex^ = (C 1 + 2)ex^ + C 2 e−x.

Region 2: x ∈ [− 1 , 1]

For x ∈ [− 1 , 1], the ODE becomes:

−u′′(x) − π^2 u(x) = 0.

The characteristic equation is:

m^2 = −π^2 =⇒ m = ±iπ.

Thus, the general solution is:

u(x) = C 3 cos(πx) + C 4 sin(πx).

Region 3: x ∈ (1, ∞)

For x ∈ (1, ∞), the ODE is:

−u′′(x) + u(x) = 2e−x.

Homogeneous Solution: The homogeneous solution is the same as in Region 1: uh(x) = C 5 ex^ + C 6 e−x. Particular Solution: Assume:

up(x) = Ae−x.

Substituting into the non-homogeneous equation:

−(Ae−x)′′^ + Ae−x^ = 2e−x^ =⇒ Ae−x^ = 2e−x^ =⇒ A = 2.

Thus, the particular solution is:

up(x) = 2e−x.

General Solution in Region 3: The general solution in (1, ∞) is:

u(x) = C 5 ex^ + (C 6 + 2)e−x.

At the Interface x = 1

From Region 2: x ∈ [− 1 , 1]: The general solution is:

u(x) = C 3 cos(πx) + C 4 sin(πx).

At x = 1: u(1) = C 3 cos(π) + C 4 sin(π) = −C 3.

Taking the derivative:

u′(1) = −πC 3 sin(π) + πC 4 cos(π) = −πC 4.

From Region 3: x ∈ (1, ∞): The general solution is:

u(x) = C 5 ex^ + (C 6 + 2)e−x.

At x = 1: u(1) = C 5 e^1 + (C 6 + 2)e−^1.

The derivative in this region is:

u′(1) = C 5 e^1 − (C 6 + 2)e−^1.

Explanation of Continuity at x = 1: Just as with the interface at x = −1, we are ensuring that both the value of the function and its rate of change are equal as we approach x = 1 from both regions. This guarantees that our solution is smooth and behaves predictably across the interfaces.

Finding Constants by Solving the System of Equa-

tions

After establishing the continuity conditions at the interfaces x = −1 and x = 1, we derived four equations involving the constants C 1 , C 2 , C 3 , C 4 , C 5 , C 6.

Recap of the Continuity Conditions

At x = − 1

(C 1 + 2)e−^1 + C 2 e^1 = −C 3 (1) (C 1 + 2)e−^1 − C 2 e^1 = −πC 4 (2)

At x = 1

−C 3 = C 5 e^1 + (C 6 + 2)e−^1 (3) −πC 4 = C 5 e^1 − (C 6 + 2)e−^1 (4)

Solve for C 3 and C 4

Adding equations (1) and (2) gives:

2(C 1 + 2)e−^1 = −C 3 − πC 4 =⇒ C 3 + πC 4 = −2(C 1 + 2)e−^1. (5)

Next, subtract equation (2) from equation (1) to solve for C 2 :

2 C 2 e^1 = C 3 − πC 4 =⇒ C 3 − πC 4 = 2C 2 e^1. (6)

Solve for C 5 and C 6

From equation (3): −C 3 = C 5 e^1 + (C 6 + 2)e−^1 (7)

Rearranging gives: C 5 e^1 + (C 6 + 2)e−^1 + C 3 = 0. (8) From equation (4):

−πC 4 = C 5 e^1 − (C 6 + 2)e−^1 (9)

Rearranging gives: C 5 e^1 − (C 6 + 2)e−^1 + πC 4 = 0. (10)

Substitute to Solve for Coefficients

Substituting C 3 from (5) into (8):

C 5 e^1 + (C 6 + 2)e−^1 +

−2(C 1 + 2)e−^1 − πC 4

This leads to: C 5 e^1 + C 6 e−^1 + 2e−^1 (C 1 + 2) − πC 4 = 0. (11) Substituting C 4 from (6) into (10):

C 5 e^1 − (C 6 + 2)e−^1 = −

2(C 1 + 2)e−^1 + C 3

Solve the System of Equations

  1. From equation (11): Rearranging gives:

C 5 e^1 = −C 6 e−^1 − 2(C 1 + 2)e−^1 + πC 4.

  1. From equation (10): Rearranging gives:

C 5 e^1 = (C 6 + 2)e−^1 + π 2

C 4.

Equate Expressions for C 5

Calculate

R ∞

−∞ |u(x)|

2 dx

The integral can be split into three parts based on the regions defined by the piecewise solution:

Z ∞

−∞

|u(x)|^2 dx =

Z − 1

−∞

|uh(x)|^2 dx +

Z 1

− 1

|up(x)|^2 dx +

Z ∞

1

|uh(x)|^2 dx.

Calculate

R − 1

−∞ |uh(x)|

(^2) dx

For x < −1: uh(x) = C 1 ex^ + C 2 e−x. Thus:

|uh(x)|^2 = |C 1 ex^ + C 2 e−x|^2 = |C 1 |^2 e^2 x^ + |C 2 |^2 e−^2 x^ + 2Re(C 1 ∗ C 2 ).

The integral becomes: Z (^) − 1

−∞

|uh(x)|^2 dx =

Z − 1

−∞

|C 1 |^2 e^2 x^ + |C 2 |^2 e−^2 x^ + 2Re(C∗ 1 C 2 )

dx.

Calculating each part:

  1. First term: Z (^) − 1

−∞

|C 1 |^2 e^2 x^ dx = |C 1 |^2

e^2 x 2

−∞

|C 1 |^2

2 e^2

  1. Second term: Z (^) − 1

−∞

|C 2 |^2 e−^2 x^ dx = |C 2 |^2

e−^2 x 2

−∞

|C 2 |^2 e^2 2

  1. Cross-term: Z (^) − 1

−∞

2Re(C 1 ∗ C 2 ) dx = −∞ unless Re(C∗ 1 C 2 ) = 0.

Combining these results gives: Z (^) − 1

−∞

|uh(x)|^2 dx → −∞.

Thus, this integral diverges unless Re(C 1 ∗ C 2 ) = 0.

0.0.1 Calculate

R 1

− 1 |up(x)|

(^2) dx

Assuming up(x) = A + Bx + Cx^2 :

|up(x)|^2 = (A + Bx + Cx^2 )(A + Bx + Cx^2 )∗.

Calculating: Z (^1)

− 1

|up(x)|^2 dx =

Z 1

− 1

(A + Bx + Cx^2 )^2 dx.

Expanding gives: Z (^1)

− 1

A^2 + 2ABx + 2ACx^2 + B^2 x^2 + 2BCx^3 + C^2 x^4

dx.

Calculating: 1. Constant term:

A^2

Z 1

− 1

1 dx = 2A^2.

  1. Linear term: 2 AB

Z 1

− 1

x dx = 0.

  1. Quadratic term:

(2AC + B^2 )

Z 1

− 1

x^2 dx = (2AC + B^2 ) ·

(2AC + B^2 ).

  1. Cubic term: 2 BC

Z 1

− 1

x^3 dx = 0.

  1. Quartic term:

C^2

Z 1

− 1

x^4 dx = C^2 ·

2 C^2

Combining these results gives: Z (^1)

− 1

|up(x)|^2 dx = 2A^2 +

(2AC + B^2 ) +

2 C^2

Calculate

R ∞

1 |uh(x)|

(^2) dx

For x > 1: uh(x) = C 1 ex^ + C 2 e−x.

Thus: |uh(x)|^2 = |C 1 ex^ + C 2 e−x|^2.