Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
31 views22 pages

Introduction To The Method of Characteristics: June 2019

Uploaded by

andrei.stan
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)
31 views22 pages

Introduction To The Method of Characteristics: June 2019

Uploaded by

andrei.stan
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/ 22

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/333985264

Introduction to the Method of Characteristics

Preprint · June 2019

CITATIONS READS
0 10,280

1 author:

Brian G Higgins
University of California, Davis
178 PUBLICATIONS 2,416 CITATIONS

SEE PROFILE

All content following this page was uploaded by Brian G Higgins on 24 June 2019.

The user has requested enhancement of the downloaded file.


Introduction to the Method of Characteristics
Brian G. Higgins∗
Department of Chemical Engineering
University of California
Davis, CA 95616

June 24, 2019

Introduction
First order partial differential equations in chemical engineering arise in
models of processes that are dominated by convection rather than by dissi-
pative processes. For example, consider a process that can be described by
the 1-D convective diffusion equation with chemical reaction
∂c ∂c ∂2c
+V = D 2 + f (c, k) (1)
∂t ∂x ∂x
This process involves multiple time scales. There is a diffusive time scale:
τD = L2 /D, a convective time scale: τC = L/V , and a reaction time scale
τR = 1/k. When diffusion and convection are important, the ratio of the
respective time scales gives the Peclet number Pe = V L/D. When reaction
and diffusion are important, the corresponding dimensionless group is the
Thiele modulus φ2 = kL2 /D, and when convection and reaction are im-
portant, the ratio of time scales gives the Damkler number Da = Lk/D.
Thus in the limit of large Peclet numbers with finite Damkler numbers, the
system is described by a first order PDE, which when expressed in suitable
dimensionless variables takes the form
∂c ∂c
+ Pe = f (c) (2)
∂t ∂x
In these notes we discuss the solution of first order PDEs described by
∂u ∂u
a +b =c (3)
∂x ∂y

email: [email protected]

1
In particular, we use the above equation to motivate the basic solution
method we will used, called the method of characteristics. Seven example
calculations will be presented to illustrate the solution technique. And when
necessary, we will make use of Mathematica to show graphically how the
solution families evolve in time and space.

Method of Characteristics
Consider the following first order PDE
∂u ∂u
a +b =c (4)
∂x ∂y
where a, b, c are in general functions of x and y, and possibly also u(x, y).
Suppose we have found a solution to Eq. (4), then tuple {x, y, u(x, y)}
defines a surface S in a Cartesian coordinate system, where the position
vector r to any point on the surface is given by

r (x, y) = x i + y j + u(x, y) k (5)

From calculus we know that the unit normal n to the surface u(x, y) is given
by the following formula
∂r ∂r
∂x × ∂y
n = ∂r ∂r (6)
| ∂x × ∂y |
A simple calculation shows that
     
∂r ∂r ∂u ∂u ∂u ∂u
× = i+ k × j+ k = i+ j −k (7)
∂x ∂y ∂x ∂y ∂x ∂y

Suppose now that u(x, y) is a solution to Eq. (4). Then we construct the
following vector p = a i + b j + c k , where the coefficients a, b, c are the same
as those in Eq. (4). It follows then that the scalar product
 
∂u ∂u
∂x i + ∂y j − k
p · n = (a i + b j + c k ) ·
| ∂x × ∂∂yr |2
∂r
(8)
∂u ∂u
=a +b −c≡0
∂x ∂y
Thus we can conclude that the vector p that we constructed must lie in the
tangent plane of the solution surface S with unit normal n . So our task to

2
finding a solution to Eq. (4) is equivalent to finding a surface S such that
at every point on the surface, the vector p lies in the tangent plane.
Now consider a curve C that lies in the surface S. Let its position vector
r(
r(x, y) be defined as in Eq. (5). It will be convenient to parameterize the
curve in terms of arc length s along the curve, i.e.,

r (x(s), y(s)) = x(s) i + = y(s) j + u[x(s), y(s)] k (9)

Then the tangent vector local to the curve C is given by


dr dx dy du
= i+ j+ k (10)
ds ds ds ds
Since our vector p = (a i + b j + c k ) lies in the tangent plane to the surface
u(x, y), it must also be everywhere tangent to the curve C in the surface S.
Thus the following parametric equations must hold
dx dy du
= a[x(s), y(s)], = b[x(s), y(s)], = c[x(s), y(s)] (11)
ds ds ds
By solving this system of ODEs, we are assured that p is tangent to the
curve C, which in turn lies in the solution surface S. The curve C is called
an integral curve (also referred to as a solution curve) of the vector field
p = (aii + bjj + ckk ). Integral curves are also called characteristic space curves
of the PDE given by Eq.(4). The curve parameterized by {x(s), y(s)} along
which x0 (s) = a, y 0 (s) = b holds is called a characteristic ground curve of
Eq. (4). Sometimes space curves and ground curves are used interchange-
ably and called characteristics. In these notes will consider several example
calculations.

Example 1
Suppose we have the following PDE
∂u ∂u
+C =0
∂t ∂x
where C is a constant. Note this equation is a special case of Eq. (4) where
the variable t is used instead of y and a = 1, c = 0. To solve this equation,
we introduce the parameter s along the curve such that the origin of the
curve (at s = 0) satisfies

C: x = x0 , t = t0 , at s = 0

3
From Eq. (11) we know that a solution curve C that satisfies the PDE must
satisfy the following characteristic ODEs
dx dt du
= C, = 1, =0
ds ds ds
Integrating the above equations gives

x = C s + K1 , t = s + K2 , u = K3

We can evaluate the constants of integration K1 and K2 from the initial


conditions imposed on the solution curve C at s = 0. Thus we have

x = C s + x0 , t = s + t0 , u = K3

We can eliminate the parameter s to get

x = C(t − t0 ) + x0 , =⇒ x0 = x − C(t − t0 )

Since u(x, y) is a constant along the solution curve C (recall du/ds = 0).
This means that u(x, y) must be some function of the ”initial condition”
specified for the solution curve C. Thus we can write

u = F (x0 , t0 )

where F is an arbitrary function that depends on the solution curve. The


function F is normally determined from some initial condition specified on
u(x, y), as discussed in the next Section

Initial-Value Problem
The initial-value or Cauchy problem is define as follows
∂u ∂u
a +b =c (12)
∂x ∂t
subject to the initial condition

IC: u(x, 0) = f (x) (13)

Note it should be evident that we are at liberty to select any independent


variable to be ”time” in our PDE. Normally the physics of the problem dic-
tates which is the ”time variable”. But the PDE is agnostic as the dependent
variable u is first order in both variables.

4
A more general IC can be constructed by defining a curve Γ parameter-
ized by ŝ such that
Γ: x = p(ŝ), t = q(ŝ), u = u(ŝ), ŝ1 < ŝ < ŝ2 (14)
The initial data curve Γ is subject to the constraint that
dp dq
a − b 6= 0 along Γ (15)
dŝ dŝ
This ensures that {p(ŝ), q(ŝ)} is not a characteristic ground curve of PDE
(4). We then refer to Γ as the initial data curve for the PDE (19). Thus our
problem statement becomes
∂u ∂u
a +b =c
∂x ∂t (16)
IC: u(x, t) = u(p(ŝ), q(ŝ)) = f (ŝ)
Thus the solution to our initial value problem is a surface with the following
parametric representation:
x = x(s, ŝ), t = t(s, ŝ), u = u(s, ŝ) (17)
Here ŝ is the parameter that establishes the curve Γ that defines the initial
data for the problem. Along the solution curve C, the parameter s varies
and is assigned the value s = 0 on Γ. Thus the surface u(x, t) is found by
solving the following system of ODEs
dx
= a, x(0, ŝ) = p(ŝ)
ds
dt
= b, t(0, ŝ) = q(ŝ) (18)
ds
du
= a, u(0, ŝ) = f (ŝ)
ds
In the neighborhood of Γ we have x = x(s, ŝ), and t = t(s, ŝ). We can
then ask whether we can solve these two equations to find s = s(x, t) and
ŝ = ŝ(x, t). This can be answered using the implicit function theorem,
namely  
∂x ∂x
 ∂s ∂ŝ 
det   6= 0 (19)
 
 ∂t ∂t 
∂s ∂ŝ

5
Expanding Eq. (26) we get

∂x ∂t ∂x ∂t ∂t ∂x
− =a −b 6= 0 (20)
∂s ∂ŝ ∂ŝ ∂s ∂ŝ ∂ŝ
This is nothing more than the constraint that the initial data curve must
satisfy. If this constraint is not satisfied then the solution to the initial value
problem may not exist or have multiple solutions.
Suppose our initial data is given by

u(x, 0) = cos(x), x≥0 (21)

For this initial data, the parameter ŝ represents the positive x-axis at t = 0
and we denote values along the x-axis by x0 and our system of equations
becomes
dx
= a, x(0, x0 ) = x0
ds
dt
= b, t(0, x0 ) = 0 (22)
ds
du
= c, u(0, x0 ) = f (x0 ) = cos(x0 )
ds
Suppose our initial data is given by

u(0, t) = g(t), t≥0 (23)

For this initial data the parameter ŝ represents the positive t-axis and we
denote values along the t-axis by t0 and our system of equations becomes
dx
= a, x(0, t0 ) = 0
ds
dt
= b, t(0, x0 ) = t0 (24)
ds
du
= c, u(0, x0 ) = g(t0 )
ds
In the next series of examples we will show how these ideas can be applied
to different problems.

6
Example 2
Let us define the following initial value problem (IVP)

∂u ∂U
+C = 0, −∞ < x < ∞, t>0
∂t ∂x

u(x, 0) = f (x)

As in Example 1, the solution is found by solving the characteristic equations


dx dt du
= C, = 1, =0
ds ds ds
We saw in the previous example that u(x, t) is constant along characteristic
curves C, and that the value of u is determined by the value of x0 given by
the initial data. That is

u(x0 , 0) = f (x0 ), where − ∞ < x0 < ∞

But we showed in Example 1 that x0 = x − Ct. Thus the solution is

u(x, t) = f (x − Ct)

Note that at t = 0 the solution satisfies the IC.

Example 3
Consider the following PDE that describes the function u(t, x):

∂u ∂u
2xt + = u, where − ∞ < x < ∞, t > 0
∂x ∂t

IC: u(0, x) = x

The characteristic equations are


dx dt du
= 2xt, = 1, =u
ds ds ds
subject to the initial conditions at s = 0

x(0, x0 ) = x0 , t(0, x0 ) = 0, u(0, x0 ) = x0

7
In this example the function u(t, x) is not constant along characteristic
curves C. Thus our solution strategy is to first solve for t then use the
result to eliminate t from the equation for x as follows
dt
= 1 =⇒ t = s, as t = 0 at s = 0
ds
Since we now know how t is related to s, we can solve for x = x(s)

dx
= 2xt = 2xs =⇒ x = x0 exp(s2 ), with x = x0 at s = 0
ds
Finally we solve for u along the characteristic to get
du
=u =⇒ u = A exp(s)
ds
Evaluating at t = 0 (s = 0) we have

u(0, x0 ) = x0 =⇒ A = x0

so that the general solution is

u(x, t) = x0 exp(t) = x exp(−t2 ) exp(t) = x exp(t − t2 )

Let us use Mathematica to check that this is indeed a solution

(D[u[x, t], t] + 2 x t D[u[x, t], x] == u[x, t])


/. u -> (#1 E^(#2 - #2^2) &) // Simplify
True

Example 4
In this example we consider an initial boundary value problem (IBVP)

∂u ∂u
u2 + = 0, x > 0, t > 0
∂x ∂t
subject to the following conditions

u(0, x) = x, x>0

u(t, 0) = 0, t>0

8
This is called an initial-boundary value problem. The characteristic equa-
tions for the parametric functions x(s, ŝ), t(s, ŝ), u(s, ŝ) are:

dx dt du
= u2 , = 1, =0
ds ds ds
subject to the initial conditions at s = 0 along the positive x-axis:

x(0, x0 ) = x0 , t(0, x0 ) = 0, u(0, x0 ) = x0

The last equation shows that along characteristics u is a constant that de-
pends on the initial condition

u(s, x0 ) = F (x0 ) = x0

Since u is a constant along the characteristic curve C we can integrate dx/ds


to find x
dx
= u2 =⇒ x = u2 s + x0
ds
dt
=0 =⇒ s = t
ds
Thus
x = u2 t + x0
Substituting for x0 in the expression for u gives
√ p
u(s, x0 ) = x0 = x − u2 t ≡ u(t, x)

This is an implicit equation for u. We can square both sides and then solve
for u2 to get
x
u2 = x − u2 t, =⇒ u2 =
1+t
Note that this function automatically satisfies the BC at x = 0. Let us use
Mathematica to check that this expression satisfies the PDE.

(u[x, t]^2 D[u[x, t], x] + D[u[x, t], t] == 0)


/. u -> ((#1/(1 + #2))^(1/2) &) // Simplify
True

9
Example 5
Consider the following nonlinear first order PDE
1 ∂u ∂u
+ u2 =u
x ∂x ∂y
subject to the following initial data

u=x on y = 0, −∞ < x < ∞

Thus our initial data lies on the ”curve” Γ along the x-axis. Our goal then is
to find the following parametric equations x(s, ŝ), y(s, ŝ), u(s, ŝ) by solving
the characteristic equations:
dx 1 dy du
= , = u2 , =u
ds x ds ds
subject to the initial conditions at s = 0 along the x-axis:

x(0, x0 ) = x0 , y(0, x0 ) = 0, u(0, x0 ) = x0

We can solve directly for x


dx 1 x2
= =⇒ = s + K1
ds x 2
Applying the initial condition that x = x0 at s = 0 gives
x2 x2
=s+ 0
2 2
Solving the characteristic equation for u and applying the initial condition
at s = 0 gives
du
=u =⇒ u = K2 exp(s) = x0 exp(s)
ds
The characteristic equation for y using the IC y = 0 at s = 0 on C gives
dy x20 x2
= x20 exp(2 s) =⇒ y = exp(2 s) + K3 = 0 (exp(2 s) − 1)
ds 2 2
We can eliminate the arc length parameter s in the above expression by
solving x = x(s) to find s in terms of x, and solving u=u(s) to find s in
terms of u.
x2 x20
s= − , s = log(u) − log(x0 )
2 2

10
Thus we can write
x2 = 2 log u + x20 − 2 log(x0 )

x2 u2
 
y= 0 −1
2 x20

Consider next the characteristic curve C that passes through x0 = 1, y = 0.


The parametric equations for this characteristic are

(u2 − 1)
x2 = 2 log(u) + 1, y=
2
In Figure 1 we plot of the characteristic that passes through x0 = 1 and
y0 = 0, using u as a parameter. The Mathematica code for the plot is given
below.

ParametricPlot[{Sqrt[2 Log[u] + 1], (u^2 - 1)/2}, {u, 1, 5},


PlotStyle -> Thick, Frame -> True,
FrameLabel -> {Style["x", 16], Style["y", 16]},
RotateLabel -> False, AspectRatio -> 1,
FrameTicksStyle -> Directive[Black, 16],
FrameStyle -> Directive[Black, Thickness[0.0025]]]

Example 6
We will consider a plug flow reactor in which a first-order, irreversible re-
action takes place. If the density and temperature of the reaction mixture
remain uniform and constant, the species balance for the reactant at a dis-
tance x from the inlet and at time t is given by
∂c ∂c
+V = −k c
∂t ∂x
in which c is the molar concentration of the reactant and V is the superficial
velocity of the reactant mixture and k is the reaction rate constant. The
IC-BC for this problem are

IC: c(0, x) = f (x), for x ≥ 0 at t = 0

BC: c(t, 0) = g(t), for t ≥ 0 at x = 0

11
Figure 1: Characteristic curve for Example 5 through x0 = 1, y0 = 0

The characters equations for this problem are


dt dx dc
= 1, = V, = −k c
ds ds ds
It follows that the slope of the characteristic curves in the t − x plane are
straight lines with slope 1/V . Note that the characteristic line though the
origin divides the (t − x)-plane into two regions. Above this line the solution
is determine by the BC data g(t), while below this line it is determined by
the IC data f (x). Solving the characteristic equations gives
t = s + K1 , x = V s + K2 , c = K3 exp(−ks)
The constants Ki are to be determined from the IC-BC.
For each IC-BC we can determine a set of initial conditions for the
characteristic equations. Consider first the BC, which represents the t-axis
at x = 0. Along this axis we set ŝ = t0 . Then for each of the characteristic
variables at s = 0 viz., x(s, ŝ), t(s, ŝ), c(s, ŝ) we have
x(0, t0 ) = 0, t(0, t0 ) = t0 , c(0, t0 ) = g(t0 )

12
Applying these ICs to the characteristic curves determined above gives
K1 = t0 , K2 = 0, K3 = g(t0 )
Solving for s and t0 gives
x x
s= , t0 = (t − )
V V
Thus the concentration along these characteristics is given by
x k x
c(t, x) = g(t − ) exp(− x), for t >
V V V
Consider next the IC. Along the x-axis at t = 0 we set ŝ = x0 . Then for each
of the characteristic variables at s = 0 viz., x(s, ŝ), t(s, ŝ), c(s, ŝ) we have
x(0, x0 ) = x0 , t(0, x0 ) = 0, c(0, x0 ) = f (x0 )
Applying these ICs to the characteristic curves determined above gives
K1 = 0, K2 = x0 , K3 = f (x0 )
Solving for s and x0 gives
s = t, x0 = (x − V t)
Thus the concentration along the characteristics emanating from the x-axis
is given by
c(t, x) = f (x − V t) exp(−k t), for x > V t
In summary: the reactant concentration profile along the reactor is given by
the following two equations:
c(t, x) = f (x − V t) exp(−k t), for x>Vt

x k
c(t, x) = g(t − ) exp(− x), for x < V t
V V
The slope of any characteristic curve C is V as shown in Figure 2. The blue
characteristic passing through (0, 0) divides the plane into two regions. The
characteristics that intersect the x-axis have an initial value given by f (x0 ),
while those that intersect the t-axis have an initial value given by g(t0 ). Let
us suppose that the functions g(t0 ) and f (x0 ) are given by
(t0 − 2)2
 
1
f (x0 ) = tanh(x0 ), g(t0 ) = √ exp −
0.7 2π 2 × 0.72
A three dimensional plot of the concentration profile is shown in Figure
4. The vertical plane at t = 4 gives a cross section of the profile along the
reactor as seen in Figure 3.

13
Figure 2: Characteristic curves for Example 6

Example 7
In this example we consider the following problem
∂u ∂u
+ = 0, 0 < x < ∞, t > 0
∂t ∂x
subject to the conditions
BC: u(0, t) = t, t>0

x2 , 0 ≤ x ≤ 2

IC: u(x, 0) =
x, 2 ≤ x
The characteristics for this problem are
dt dy du
= 1, = 1, =0
ds ds ds

14
Figure 3: Concentration profiles along reactor in Example 6 for select
times

Solving these equations gives

x = s + K1 , t = s + K2 , u = K3

For each BC-IC we have a set of initial conditions for the characteristic
equations. We consider first the BC which represents the t-axis at x = 0.
Along this axis we set ŝ = t0 . Then for each of the characteristic variables
at s = 0 viz., x(s, ŝ), t(s, ŝ), u(s, ŝ) we have

x(0, t0 ) = 0, t(0, t0 ) = t0 , u(0, t0 ) = t0

Applying these ICs to the characteristic curves determined above gives

K1 = 0, k2 = t0 , K3 = t0

This means that the characteristic curves emanating from the t-axis at x = 0
are
x = s, t = s + t0 , u = t0
Eliminating t0 gives
u(x, t) = t − x

15
Figure 4: Concentration profiles along reactor in Example 6 as a func-
tion of t and x

Consider next the initial conditions for characteristics emanating from the
x-axis. The initial conditions for x(s, ŝ), t(s, ŝ), u(s, ŝ) at s = 0 are

x(0, x0 ) = x0 , t(0, x0 ) = 0

u(0, x0 ) = x20 , for 0 ≤ x0 < 2

u(0, x0 ) = x0 , for 2 ≤ x0

Now for 0 ≤ x ≤ 2, and t = 0, we have at s = 0

x0 = K1 , K2 = 0, u = K3 = x20

Thus
x = s + x0 , t = s, u = x20

16
This gives after eliminating x0 and s the solution on all characteristics pass-
ing through 0 ≤ x ≤ 2, t = 0

u(x, t) = (x − t)2

And finally, for x > 2, we have

x = s + x0 , t = s, u = x0

This gives after eliminating x0 and s the solution on all characteristics pass-
ing through x > 2, t = 0
u(x, t) = (x − t)
Note that all characteristics have slope dx/dt = 1, and hence do not inter-
sect. Here is a plot of the characteristics defined for the various zones. Also
show is the line at t0 = 1.25

Figure 5: Characteristic Curves for Example 7

17
Figure 6: Profile for u(1.25, x) superimposed on the characteristic
curves for Example 7

Note the black points indicate when dependence of the solution on a


particular family of characteristics changes.
We can explain the behavior in the above plots by examining the char-
acteristics that pass through the dashed line. As we increase x at = 1.25
we move along the dashed line. The value of u is determined by the charac-
teristic that passes through (x∗ , 1.25). For x∗ < 1.25 we are in a zone that
has characteristics emanating from the t-axis; thus u[x, t] decreases. When
we reach x∗ = 1.25 we are at the boundary between characteristics that em-
anate from the t-axis versus those that emanate from the x-axis (see black
point) Any further increase in x∗ means that the value of u(x∗ , t) is given by
u(x, t) = (x − 1.25)2 . Thus u(x, t) increases quadratically with increasing x
until x∗ = 1.25 + 2. Then the value of u(x, t) is given by u(x, t) = (x∗ − 1.25)
and u(x, t) increases linearly with x. In Figure 6 we superimpose the u(x,t)

18
profile calculated as described above on the t-x plane

Figure 7: u(t, x) profile from Example 7 for select values of t0

Final Comments
The method of characteristics is covered in most textbooks on PDEs, though
the detail of presentation might vary a lot. The references listed below were
helpful in preparing these notes:

References
[1] C. Pozrikidis, Numerical Computation in Science and Engineering, Ox-
ford University Press, 1998

[2] H - K. Rhee, R. Aris and N. R. Amundson, First-Order Partial Differ-


ential Equations : Volume 1, Prentice Hall, 1986

[3] E. C. Zachmanoglou and D. W. Thoe, Introduction to Partial Differ-


ential Equations with Applications Dover Publications, 1986

Appendix
The Mathematica code for generating the plots in Figure 3 is shown below

19
myfuncC4[t_, x_, V_, k_] := Tanh[x - V t] Exp[-k t] /; x > V t
myfuncC4[t_, x_, V_, k_] :=
1/(0.7 Sqrt[2 \[Pi]]) Exp[-((t - x/V) - 2)^2/(2 0.7^2)] Exp[-k x/V] /;
x <= V t
Plot[{myfuncC4[1, x, 1, 0.3], myfuncC4[2, x, 1, 0.3],
myfuncC4[4, x, 1, 0.3], myfuncC4[6, x, 1, 0.3]}, {x, 0, 10},
PlotStyle -> Thick, Frame -> True,
FrameLabel -> {Style["x", 16], Style["c(t,x}", 16]},
PlotRange -> {0, 1},
Epilog -> {Text[Style["t=1", 14], {4, 0.78}],
Text[Style["t=2", 14], {6, 0.58}],
Text[Style["t=4", 14], {7, 0.34}],
Text[Style["t=6", 14], {9, 0.2}]},
FrameTicksStyle -> Directive[Black, 16],
FrameStyle -> Directive[Black, Thickness[0.0028]]]

The Mathematica code for generating the plots in Figure 4 is shown below

Show[{Plot3D[myfuncC4[t, x, 1, 0.3], {x, 0, 10}, {t, 0, 10},


PlotPoints -> 50 ,
AxesLabel -> {Style["x", 16], Style["t", 16],
Style["c(x,t)", 16]}, Mesh -> False],
ContourPlot3D[x == 4, {t, 0, 10}, {x, 0, 10}, {z, 0, 1}]},
PlotRange -> All, TicksStyle -> Directive[Black, 16],
BoxStyle -> Directive[Black, Thickness[0.0025]]]

The Mathematica code for generating the plots in Figure 6.

u[x_, t_] := (t - x) /; t >= x;


u[x_, t_] := (x - t) /; (t < x && x > t + 2);
u[x_, t_] := (x - t)^2 /; (t < x <= t + 2);
plt1 = Plot[{x, x - 2}, {x, 0, 5}, PlotRange -> {0, 4},
AspectRatio -> 1,
PlotStyle -> {{Red, Thick}, {Blue, Thick}, {Magenta, Thick}},
Frame -> True, FrameLabel -> {Style["x", 16], Style["t", 16]},
RotateLabel -> False,
Epilog -> {Text[
StyleForm["u(0,x)=\!\(\*SuperscriptBox[\(x\), \(2\)]\)",
FontSize -> 16], {1, .15}],

20
Text[StyleForm["u(0,x)=x", FontSize -> 16], {3, .15}],
Text[
StyleForm["u(t,x)=(x-t\!\(\*SuperscriptBox[\()\), \(2\)]\)",
FontSize -> 16], {2.5, 1.5}],
Text[StyleForm["u(t,x)=(x-t)", FontSize -> 16], {4, 1}],
Text[StyleForm["u(t,x)=(t-x)", FontSize -> 16], {1, 2.5}],
Dashing[{0.02, 0.02}], Line[{{0, 1.25}, {5, 1.25}}],
AbsolutePointSize[8], Black, Point[{1.25, 1.25}],
Point[{3.25, 1.25}]},
FrameTicksStyle -> Directive[Black, 16],
FrameStyle -> Directive[Black, Thickness[0.0025]]];
plt2 = Plot[Evaluate[u[x, 1.25]], {x, 0, 5},
PlotStyle -> {Gray, Thick}, Frame -> True,
FrameLabel -> {"x", "u(x,t)"}, RotateLabel -> False];
Show[plt1, plt2]

The Mathematica code for generating the plots in Figure 7.

Plot[Evaluate[Table[u[x, j], {j, 0, 4, .5}]], {x, 0, 8},


PlotStyle -> {{Gray, Thick}}, Frame -> True,
FrameLabel -> {Style["x", 16], Style["u(x,t)", 16]},
RotateLabel -> False, FrameTicksStyle -> Directive[Black, 16],
FrameStyle -> Directive[Black, Thickness[0.0025]]]

21

View publication stats

You might also like