Application Center - Maplesoft

App Preview:

First-Order PDE: The method of characteristics

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

1d-Chars.mws

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
a(x,t)*diff(u(x,t),t)+b(x,t)*diff(u(x,t),x)+c(x,t)*u(x,t) = h(x,t) . The main idea of the method of characteristics is to reduce a PDE on the ( x, t )-plane to an ODE along a parametric curve (called the characteristic curve) parametrized by some other parameter tau . The characteristic curve is then determined by the condition that diff(u(x(tau),y(tau)),tau) = diff(t(tau),tau)*diff(u(x,t),t)+diff(x(tau),tau)*diff(u(x,t),x)  = a(x,t)*diff(u(x,t),t)+b(x,t)*diff(u(x,t),x)  and so  we need to solve another ODE to find the characteristic. In the examples below we always take a(x,t) = 1 , and so we can use t  instead of tau . In this case the characteristics are given by the equation diff(x,t) = b(x,t) . On the characteristic we then get an equation diff(u(t),t)+c(t)*u(t) = h(t) , 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 u(x,t)  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");

[Maple Plot]

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");

[Maple Plot]

>   

Example 1: diff(u(x,t),t) = 0 .

Our first example is a trivial one. We consider the equation diff(u(x,t),t) = 0 .

>    pde:=diff(u(x,t),t)=0;

pde := diff(u(x,t),t) = 0

The equation of the characteristics is then simply

>    char_eq:=diff(x(t),t)=0;

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]});

char_curve := x(t) = x[0]

And so the characteristics are straight vertical lines (the nch   variable below denotes the number of characteristics per unit interval on the x -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);

[Maple Plot]

On the characteristics we need to solve the following ordinary differential equation:

>    ode:=diff(w(t),t)=0;

ode := diff(w(t),t) = 0

which coincides with our PDE upon the substitution w(t) = u(x(t),t)  (restricted to a characteristic curve):

>    eval(subs(w(t)=u(eval(x(t),char_curve),t),ode));

diff(u(x[0],t),t) = 0

This ODE is easy to solve:

>    char_sol:=dsolve({ode,w(0)=f(x[0])});

char_sol := w(t) = f(x[0])

our solution of the PDE then is u(x,t) = w(t,x[0](x,t)) :

>    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);

u(x,t) = f(x)

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 t -direction. We color the plot according to the values, so same color represents same values of the function u(x,t) .

>    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]);

[Maple Plot]

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);

[Maple Plot]

Clean-up:

>    u:='u': f:='f': w:='w':

>   

Example 2: diff(u(x,t),t)+c*diff(u(x,t),x) = 0 .

Our second example is the transport equation . We consider the equation diff(u(x,t),t)+c*diff(u(x,t),x) = 0 .

>    pde:=diff(u(x,t),t)+c*diff(u(x,t),x)=0;

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;

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]});

char_curve := x(t) = c*t+x[0]

And so the characteristics are straight lines with the slope of 1/c  (we choose c = .5  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);

[Maple Plot]

On the characteristics we need to solve the following ordinary differential equation:

>    ode:=diff(w(t),t)=0;

ode := diff(w(t),t) = 0

which coincides with our PDE upon the substitution w(t) = u(x(t),t)  (restricted to a characteristic curve):

>    eval(subs(w(t)=u(eval(x(t),char_curve),t),ode));

D[1](u)(c*t+x[0],t)*c+D[2](u)(c*t+x[0],t) = 0

This ODE is easy to solve:

>    char_sol:=dsolve({ode,w(0)=f(x[0])});

char_sol := w(t) = f(x[0])

our solution of the PDE then is u(x,t) = w(t,x[0](x,t)) :

>    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);

u(x,t) = f(x-c*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]);

[Maple Plot]

>    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);

[Maple Plot]

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);

[Maple Plot]

Clean-up:

>    u:='u': f:='f': w:='w':

>   

Example 3: diff(u(x,t),t)+x*diff(u(x,t),x) = 0 .

For the next example we consider the equation with non-constant coefficients, diff(u(x,t),t)+x*diff(u(x,t),x) = 0

>    pde:=diff(u(x,t),t)+x*diff(u(x,t),x)=0;

pde := -D(f)(x-c*t)*c+x*D(f)(x-c*t) = 0

The equation of the characteristics is

>    char_eq:=diff(x(t),t)=x(t);

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]});

char_curve := x(t) = x[0]*exp(t)

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);

[Maple Plot]

On the characteristics we need to solve the following ordinary differential equation:

>    ode:=diff(w(t),t)=0;

ode := diff(w(t),t) = 0

which coincides with our PDE upon the substitution w(t) = u(x(t),t)  (restricted to a characteristic curve):

>    eval(subs(w(t)=u(eval(x(t),char_curve),t),ode));

D[1](u)(x[0]*exp(t),t)*x[0]*exp(t)+D[2](u)(x[0]*exp(t),t) = 0

The ODE is easy to solve:

>    char_sol:=dsolve({ode,w(0)=f(x[0])});

char_sol := w(t) = f(x[0])

our solution of the PDE then is u(x,t) = w(t,x[0](x,t)) :

>    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);

u(x,t) = f(x/exp(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]);

[Maple Plot]

>    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);

[Maple Plot]

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);

[Maple Plot]

Clean-up:

>    u:='u': f:='f': w:='w':

>   

Example 4: diff(u(x,t),t)-t^2*diff(u(x,t),x) = 1 .

This example is a non-homogeneous equationwith non-constant coefficients, diff(u(x,t),t)-t^2*diff(u(x,t),x) = 1

>    pde:=diff(u(x,t),t)-t^2*diff(u(x,t),x)=1;

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;

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]});

char_curve := x(t) = -1/3*t^3+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);

[Maple Plot]

On the characteristics we need to solve the following ordinary differential equation:

>    ode:=diff(w(t),t)=1;

ode := diff(w(t),t) = 1

which coincides with our PDE upon the substitution w(t) = u(x(t),t)  (restricted to a characteristic curve):

>    eval(subs(w(t)=u(eval(x(t),char_curve),t),ode));

-D[1](u)(-1/3*t^3+x[0],t)*t^2+D[2](u)(-1/3*t^3+x[0],t) = 1

The ODE is easy to solve:

>    char_sol:=dsolve({ode,w(0)=f(x[0])});

char_sol := w(t) = t+f(x[0])

our solution of the PDE then is u(x,t) = w(t,x[0](x,t)) :

>    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);

u(x,t) = t+f(x+1/3*t^3)

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]);

[Maple Plot]

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);

[Maple Plot]

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 t^2 ):

>    animate(plot,[subs({c=0.5,f=f_ini},u(x,t)),x=-5..4,color=red,thickness=2],t=0..6,scaling=constrained);

[Maple Plot]

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."