MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: initial condition in using dsolve

  • To: mathgroup at
  • Subject: [mg64394] Re: [mg64316] initial condition in using dsolve
  • From: Devendra Kapadia <dkapadia at>
  • Date: Wed, 15 Feb 2006 03:32:13 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

On Sat, 11 Feb 2006, rudy wrote:

> Hello,
> I'm trying to use DSolve tu obtaine the solution of the PDE:
> eq={D[f[x, t], t]+ v*D[f[x, t], x]==0, f[x, 0]==fo[x]}
> but with the instruction
> DSolve[eq, f, {x, t}]
> Mathematica doesn't resolve.
> It's strange because the solution is known:
> f[x,t] = f[x- v t,0]
> If I do:
> eq={D[f[x, t], t]+ v*D[f[x, t], x]==0}
> and
> DSolve[eq, f, {x, t}]
> it works:
> out > {f -> Function[{x, t}, C[1][(t v - x)/v]]}
> I don't understand why it works in the second case and not in the first...
> can anybody help?
> Regards
> Rudy
Hello Rudy,

At present, the DSolve function can find the general solution for
a linear first-order partial differential equation such as the one
considered by you. However, it is currently not possible to solve
initial-value problems for such equations. For this reason, In[3]
below returns unevaluated while In[5] returns a result.


In[1]:= $Version

Out[1]= 5.2 for Linux (June 27, 2005)

In[2]:=  eq = {D[f[x, t], t] + v*D[f[x, t], x] == 0, f[x, 0] == fo[x]};

In[3]:= DSolve[eq, f, {x, t}]//InputForm

DSolve[{Derivative[0, 1][f][x, t] + v*Derivative[1, 0][f][x, t] == 0,
   f[x, 0] == fo[x]}, f, {x, t}]

In[4]:=  eq = {D[f[x, t], t] + v*D[f[x, t], x] == 0};

In[5]:= (sol = DSolve[eq, f, {x, t}]) // InputForm

Out[5]//InputForm= {{f -> Function[{x, t}, C[1][(t*v - x)/v]]}}


We hope to include the functionality for solving initial-value
problems for PDEs in a future release.

One can start with the general solution (Out[5] above) and find
an expression for the solution f[x, t] of the initial-value
problem as follows.


In[6]:= f0[x] == (f[x, t]/.sol[[1]]/.{t-> 0})

Out[6]= f0[x] == C[1][-(-)]

In[7]:= f[x_, t_] = (f[x, t] /. sol[[1]] /. {C[1][a_] :> f0[-v*a]})

Out[7]= f0[-(t v) + x]


We can now verify that this solution satisfies the equation and
the initial condition.


In[8]:= f[x, 0]

Out[8]= f0[x]

In[9]:= D[f[x, t], t] + v*D[f[x, t], x]

Out[9]= 0


Sorry for the inconvenience caused by this limitation.


Devendra Kapadia.
Wolfram Research

  • Prev by Date: Re: Using a text editor like interface for Mathematica?
  • Next by Date: Re: Joining List of Lists
  • Previous by thread: initial condition in using dsolve
  • Next by thread: newbie want to join the group