1d-Chars.mws
- Introduction
- Initialization
- Example 1:
diff(u(x,t),t) = 0;.
- Example 2:
diff(u(x,t),t)+c*diff(u(x,t),x) = 0;.
- Example 3:
diff(u(x,t),t)+x*diff(u(x,t),x) = 0;.
- Example 4:
diff(u(x,t),t)-t^2*diff(u(x,t),x) = 1;.
- References
- Disclaimer
Partial Differential Equations
First-Order PDE: The method of characteristics.
Anton Dzhamay
Department of Mathematics
The University of Michigan
Ann Arbor, MI 48109
wPage:
http://www.math.lsa.umich.edu/~adzham
email:
adzham@umich.edu
Copyright 2003 by Anton Dzhamay
All rights reserved
Introduction
In this worksheet we give some examples on how to use the method of characteristics for first-order linear PDEs of the form
. The main idea of the method of characteristics is to reduce a PDE on the (
)-plane to an ODE along a parametric curve (called the characteristic curve) parametrized by some other parameter
. The characteristic curve is then determined by the condition that
=
and so we need to solve another ODE to find the characteristic. In the examples below we always take
, and so we can use
instead of
. In this case the characteristics are given by the equation
. On the characteristic we then get an equation
, which is again an ODE. Solving both ODEs, choosing the constants of integration to match the initial data, and going from the characteristic to the whole plane then gives us the solution
of the PDE.
Initialization
Some packages that we use in this worksheet:
> |
restart: with(plottools): with(plots):
|
Warning, the names arrow and changecoords have been redefined
In all of the examples below we use the same initial profile given by a localized "hump":
> |
f_ini:=x->piecewise(x<-1,0,x<1,(cos(Pi/2*x))^2,0):
|
> |
plot(f_ini(x),x=-2..2,scaling=constrained,thickness=2,title="Initial profile");
|
Note that this initial profile has a continuous first derivative:
> |
plot([f_ini(x),diff(f_ini(x),x)],x=-2..2,scaling=constrained,thickness=2,color=[red,blue],
title="Initial profile and its derivative");
|
Example 1:
.
Our first example is a trivial one. We consider the equation
.
The equation of the characteristics is then simply
> |
char_eq:=diff(x(t),t)=0;
|
The characteristic curves are then given by the equation
> |
char_curve:=dsolve({char_eq,x(0)=x[0]});
|
And so the characteristics are straight vertical lines (the
nch
variable below denotes the number of characteristics per unit interval on the
-axis)
> |
nch:=3:
char_plot:=display([seq(plot([subs(x[0]=x/nch,eval(x(t),char_curve)),t,t=0..4],
color=black,thickness=2),x=-4*nch..2*nch)],view=[-2..2,0..4]):
display(char_plot);
|
On the characteristics we need to solve the following ordinary differential equation:
which coincides with our PDE upon the substitution
(restricted to a characteristic curve):
> |
eval(subs(w(t)=u(eval(x(t),char_curve),t),ode));
|
This ODE is easy to solve:
> |
char_sol:=dsolve({ode,w(0)=f(x[0])});
|
our solution of the PDE then is
:
> |
u:=unapply(subs(x[0]=solve(subs(x(t)=x,char_curve),x[0]),eval(w(t),char_sol)),x,t):'u(x,t)'=u(x,t);
|
This result is not surprising since the equation means that the initail profile does not change in time and therefore is simply shifted in the
-direction. We color the plot according to the values, so same color represents same values of the function
.
> |
sol_plot:=plot3d(subs(f=f_ini,u(x,t)),x=-2..2,t=0..4,axes=boxed,scaling=constrained,numpoints=2000,
shading=zhue): display(sol_plot,style=patchnogrid,view=-0.1..1,orientation=[-65,55]);
|
We now combine the plot of the characteristic curves with the graph of the solution. We make the resulting graph a "movie" with two frames, the first frame plots the solution using the
patchnogrid
style, the second frame uses the
wireframe
style and so allows us to see the characteristics. Below is the graph of the solution as viewed from above, to get a better understanding of the solution you should rotate it.
> |
shift:=transform((x,y)->[x,y,-0.1]):
|
> |
movie:=display([display(sol_plot,style=patchnogrid),display(sol_plot,style=wireframe)],insequence=true):
|
> |
display([movie,shift(char_plot)],orientation=[-90,0],view=[-2..2,0..4,-0.1..1],scaling=constrained);
|
Clean-up:
> |
u:='u': f:='f': w:='w':
|
Example 2:
.
Our second example is the
transport equation
. We consider the equation
.
> |
pde:=diff(u(x,t),t)+c*diff(u(x,t),x)=0;
|
The equation of the characteristics is then simply
> |
char_eq:=diff(x(t),t)=c;
|
The characteristic curves are then given by the equation
> |
char_curve:=dsolve({char_eq,x(0)=x[0]});
|
And so the characteristics are straight lines with the slope of
(we choose
for the plot)
> |
nch:=3:
char_plot:=display([seq(plot([subs({c=0.5,x[0]=x/nch},eval(x(t),char_curve)),t,t=0..4],
color=black,thickness=2),x=-4*nch..2*nch)],view=[-2..2,0..4]):
display(char_plot);
|
On the characteristics we need to solve the following ordinary differential equation:
which coincides with our PDE upon the substitution
(restricted to a characteristic curve):
> |
eval(subs(w(t)=u(eval(x(t),char_curve),t),ode));
|
This ODE is easy to solve:
> |
char_sol:=dsolve({ode,w(0)=f(x[0])});
|
our solution of the PDE then is
:
> |
u:=unapply(subs(x[0]=solve(subs(x(t)=x,char_curve),x[0]),eval(w(t),char_sol)),x,t):'u(x,t)'=u(x,t);
|
> |
sol_plot:=plot3d(subs({c=0.5,f=f_ini},u(x,t)),x=-2..2,t=0..4,axes=boxed,scaling=constrained,numpoints=2000,
shading=zhue): display(sol_plot,style=patchnogrid,view=-0.1..1,orientation=[-65,55]);
|
> |
shift:=transform((x,y)->[x,y,-0.1]):
|
> |
movie:=display([display(sol_plot,style=patchnogrid),display(sol_plot,style=wireframe)],insequence=true):
|
> |
display([movie,shift(char_plot)],orientation=[-90,0],view=[-2..2,0..4,-0.1..1],scaling=constrained);
|
And this is how the initial profile evolves in time. This animation helps to see why our PDE is called the transport equation.
> |
animate(plot,[subs({c=0.5,f=f_ini},u(x,t)),x=-2..2,color=red,thickness=2],t=0..6,scaling=constrained);
|
Clean-up:
> |
u:='u': f:='f': w:='w':
|
Example 3:
.
For the next example we consider the equation with non-constant coefficients,
> |
pde:=diff(u(x,t),t)+x*diff(u(x,t),x)=0;
|
The equation of the characteristics is
> |
char_eq:=diff(x(t),t)=x(t);
|
The characteristic curves are then given by the equation
> |
char_curve:=dsolve({char_eq,x(0)=x[0]});
|
And so the characteristics are graphs of the exponential function
> |
nch:=10:
char_plot:=display([seq(plot([subs({c=0.5,x[0]=x/nch},eval(x(t),char_curve)),t,t=0..4],
color=black,thickness=2),x=-4*nch..2*nch)],view=[-2..2,0..4]):
display(char_plot);
|
On the characteristics we need to solve the following ordinary differential equation:
which coincides with our PDE upon the substitution
(restricted to a characteristic curve):
> |
eval(subs(w(t)=u(eval(x(t),char_curve),t),ode));
|
The ODE is easy to solve:
> |
char_sol:=dsolve({ode,w(0)=f(x[0])});
|
our solution of the PDE then is
:
> |
u:=unapply(subs(x[0]=solve(subs(x(t)=x,char_curve),x[0]),eval(w(t),char_sol)),x,t):'u(x,t)'=u(x,t);
|
> |
sol_plot:=plot3d(subs({c=0.5,f=f_ini},u(x,t)),x=-2..2,t=0..4,axes=boxed,scaling=constrained,numpoints=2000,
shading=zhue): display(sol_plot,style=patchnogrid,view=-0.1..1,orientation=[-65,55]);
|
> |
shift:=transform((x,y)->[x,y,-0.1]):
|
> |
movie:=display([display(sol_plot,style=patchnogrid),display(sol_plot,style=wireframe)],insequence=true):
|
> |
display([movie,shift(char_plot)],orientation=[-90,0],view=[-2..2,0..4,-0.1..1],scaling=constrained);
|
And this is how the initial profile evolves in time.
> |
animate(plot,[subs({c=0.5,f=f_ini},u(x,t)),x=-2..2,color=red,thickness=2],t=0..6,scaling=constrained);
|
Clean-up:
> |
u:='u': f:='f': w:='w':
|
Example 4:
.
This example is a non-homogeneous equationwith non-constant coefficients,
> |
pde:=diff(u(x,t),t)-t^2*diff(u(x,t),x)=1;
|
The equation of the characteristics is
> |
char_eq:=diff(x(t),t)=-t^2;
|
The characteristic curves are then given by the equation
> |
char_curve:=dsolve({char_eq,x(0)=x[0]});
|
And this is how the characteristic curves look like:
> |
nch:=5:
char_plot:=display([seq(plot([subs({c=0.5,x[0]=x/nch},eval(x(t),char_curve)),t,t=0..4],
color=black,thickness=2),x=-4*nch..8*nch)],view=[-2..2,0..4]):
display(char_plot);
|
On the characteristics we need to solve the following ordinary differential equation:
which coincides with our PDE upon the substitution
(restricted to a characteristic curve):
> |
eval(subs(w(t)=u(eval(x(t),char_curve),t),ode));
|
The ODE is easy to solve:
> |
char_sol:=dsolve({ode,w(0)=f(x[0])});
|
our solution of the PDE then is
:
> |
u:=unapply(subs(x[0]=solve(subs(x(t)=x,char_curve),x[0]),eval(w(t),char_sol)),x,t):'u(x,t)'=u(x,t);
|
In this case solution is not constant along the characteristics. Instead, it exibits the linear growth there:
> |
sol_plot:=plot3d(subs({c=0.5,f=f_ini},u(x,t)),x=-2..2,t=0..4,axes=boxed,scaling=constrained,numpoints=2000,
shading=zhue): display(sol_plot,style=patchnogrid,view=-0.1..4,orientation=[-135,70]);
|
Still, looking at the solution from the top we can see the characteristic curves:
> |
shift:=transform((x,y)->[x,y,-0.1]):
|
> |
movie:=display([display(sol_plot,style=patchnogrid),display(sol_plot,style=wireframe)],insequence=true):
|
> |
display([movie,shift(char_plot)],orientation=[-90,0],view=[-2..2,0..4,-0.1..4],scaling=constrained);
|
And this is how the initial profile evolves in time. It is a combination of growth and accelerated motion to the left (with the speed of
):
> |
animate(plot,[subs({c=0.5,f=f_ini},u(x,t)),x=-5..4,color=red,thickness=2],t=0..6,scaling=constrained);
|
Clean-up:
> |
u:='u': f:='f': w:='w':
|
References
-
Walter A. Strauss, Partial Differential Equations: An Introduction, Wiley, 1992
-
Richard Haberman, Elementary Applied Partial Differential Equations, 3rd edition, Prentice Hall
-
Stanley J. Farlow, Partial Differential Equations for Scientists and Engineers, Dover 1982
Disclaimer
"While every effort has been made to validate the solutions in this worksheet, Waterloo Maple Inc. and the contributors are not responsible for any errors contained and are not liable for any damages resulting from the use of this material."