Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I wish to solve the following second order partial differential equation

$$u_{tt}=c^2 u_{xx}$$

with the initial conditions

$$u(x,0)=e^x,\quad u_t(x,0)=\sin x$$

In Mathematica, I evaluated the following code:

DSolve[{D[p[x, t], {t, 2}] == c^2 *(D[p[x, t], {x, 2}]), 
        p[x, 0] == Exp[x], D[p[x, t], t] == Sin[x]},
      p[x, t], {x, t}]

Mathematica responded with

DSolve::deqx: Supplied equations are not differential equations of the given functions.

I think the problem lies in the initial conditions. How can I fix this code?

share|improve this question
    
Hi Scorpio19891119! Welcome to Mathematica.SE! I formatted your post for more convenient to read. Please do check the source code to see how I did it by click the time above my avatar at the left bottom. Additionally please refer to this for more detail. –  Silvia Jan 19 '13 at 22:26
    
You should use Derivative[0, 1][p][x, 0] == Sin[x] instead of D[p[x, t], t] == Sin[x] in your code. (Although this correction did not seem to be sufficient to give a solution.) –  Silvia Jan 19 '13 at 22:45
1  
@Silvia That notation doesn't really matter (OK, one has to add /.t->0 in his approach, but it's not the main problem). I feel tempted to answer, but it looks a lot like a homework problem. As a hint: first solve without the initial conditions, leading to two functions C[1] and C[2]. Then find those functions by imposing the initial conditions at t = 0. This can be done by converting both conditions to a set of equations only involving C'[i] at x and -x. –  Jens Jan 19 '13 at 23:57
    
@Jens +1 btw I'm aware of the standard method for dealing with so-called traveling wave solutions, but wondering why DSolve can't handle this.. –  Silvia Jan 20 '13 at 0:31
    
@Silvia That's a valid question - but for now the only answer seems to be: it just can't be done. At least looking at the DSolve documentation, it states that the acceptable form for PDEs is only DSolve[eqn, y, {x1, x2, ...}] and not DSolve[{eqn1, eqn2 ...}, y, {x1, x2, ...}] with multiple equations as would be the use case here. –  Jens Jan 20 '13 at 7:01

1 Answer 1

Looking at the DSolve documentation, it states that the acceptable form for partial differential equations is only DSolve[eqn, y, {x1, x2, ...}] and not DSolve[{eqn1, eqn2 ...}, y, {x1, x2, ...}] with multiple equations as would be the use case here.

The documentation may in fact not be quite consistent here: there is an example of an "initial condition" in a first-order PDE on this page, but the wording of the docs indicates that there's no guarantee that DSolve can handle arbitrary PDEs with initial or boundary conditions. That makes sense because most such PDEs have no closed-form solutions.

So you have to solve the PDE without the initial conditions first. That will give you a well-known result but in terms of functions named in Mathematica's standard way, C[1] and C[2]. Then you'll need to figure out a way to determine these unknown functions from the initial conditions. Since I don't know if this is a homework problem, I'll leave it at that for now.

Another approach would be to use NDSolve, which does allow you to specify initial conditions (see under "Applications", "Partial Differential Equations").

share|improve this answer
    
+1 Indeed! Never noticed that statement before.. Thanks –  Silvia Jan 20 '13 at 11:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.