Nick
Nick

Reputation: 5440

Mathematica doesn't solve wave equation when given boundary conditions

Still new to Mathematica syntax. When I do:

DSolve[{
  D[u[x, t], {x, 2}] == (1/(v*v))*D[u[x, t], {t, 2}],
  u[0, t] == 0,
  u[l, 0] == 0
  }, u, {x, t}]

it just returns what I entered

DSolve[{(u^(2,0))[x,t]==(u^(0,2))[x,t]/v^2,u[0,t]==0,u[l,0]==0},u,{x,t}]

However, when I remove the boundary conditions, I get

{{u->Function[{x,t},C[1][t-(Sqrt[v^2] x)/v^2]+C[2][t+(Sqrt[v^2] x)/v^2]]}}

with C[1] and C[2] representing the functions for the boundary conditions.

Anyone know why this is happening?

Upvotes: 4

Views: 3281

Answers (2)

Simon
Simon

Reputation: 14731

I think that Mathematica doesn't know how to deal with these boundary conditions for 2nd order PDEs. How would you want the answer returned? As a general Fourier series?

This is mentioned in the Mathematica Cookbook (and probably other places)...

Breaking down the problem for Mathematica (with the dimensional factor v->1), you find

In[1]:= genSoln = DSolve[D[u[x, t], {x, 2}] == D[u[x, t], {t, 2}], u, {x, t}] // First
Out[1]= {u -> Function[{x, t}, C[1][t - x] + C[2][t + x]]}

In[2]:= Solve[u[0, t] == 0 /. genSoln]
Out[2]= {{C[1][t] -> -C[2][t]}}

In[3]:= u[l, 0] == 0 /. genSoln /. C[1][x_] :> -C[2][x] // Simplify
Out[3]= C[2][-l] == C[2][l]

that the solution is written as f(t-x)-f(t+x) where f is periodic over [-l,l]...

You can't do any more with out making assumptions about the smoothness of the solution.

You can check that the standard Fourier series approach would work, e.g.

In[4]:= f[x_, t_] := Sin[n Pi (t + x)/l] - Sin[n Pi (t - x)/l]

In[5]:= And[D[u[x, t], {x, 2}] == D[u[x, t], {t, 2}], 
              u[0, t] == 0, u[l, 0] == 0] /. u -> f // Reduce[#, n] & // Simplify

Out[5]= C[1] \[Element] Integers && (n == 2 C[1] || n == 1 + 2 C[1])

Upvotes: 2

Nasser
Nasser

Reputation: 13173

2 things:

  1. Don't you need more boundary and initial conditions than just 2? You have second order derivatives on left and right side, each requires 2 conditions. Hence total is 4. see http://mathworld.wolfram.com/WaveEquation1-Dimensional.html

  2. I do not think DSolve or NDSolve can solve initial and boundary value problems? I seem to have read this somewhere sometime ago. No time to check now.

Upvotes: 5

Related Questions