Message Boards Message Boards

0
|
6207 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

How to solve analytically Wave Equation?

Posted 10 years ago

Hi everybody, I'm trying to solve analytically the wave equation in 1-D,2-D,3-D(I have already a numeric solution). I tried to solve it with the separation of variables mathod, but I can't get an acceptable solution. Could you help me please? Thank you in advance. Here's my code:

In[50]:= Clear["Global`*"]

In[51]:= c = 3;
a = -4;

In[53]:= eq = (1/c^2)*D[U[x, t], {t, 2}] == D[U[x, t], {x, 2}];
eq = (1/c^2)*T''[t] X[x] == X''[x] T[t];
eq = T''[t]/T[t] == c^2 * X''[x]/X[x];
eq1 = T''[t]/T[t] == a;
eq2 = c^2*X''[x]/X[x] == a;
boundaryconditions = {U[x, 0] == Exp[-x^2], U[-10, t] == 0, 
   U[10, t] == 0, Derivative[0, 1][U][x, 0] == 0};
boundaryconditions = {X[x] T[0] == Exp[-x^2], X[-10] T[t] == 0, 
   X[10] T[t] == 0, X[x] T'[0] == 0};

In[119]:= L = 20;
fi = Exp[-x^2]
psi = 0;
omegan = n*Pi*c/L;


Out[120]= E^-x^2

In[123]:= An = (2/L)*Integrate[fi*Sin[n*Pi*x/L], {x, 0, L}]

Out[123]= 1/40 E^(-((n^2 \[Pi]^2)/
  1600)) Sqrt[\[Pi]] (-I Erf[20 - (I n \[Pi])/40] + 
   I Erf[20 + (I n \[Pi])/40] + 2 Erfi[(n \[Pi])/40])

In[124]:= Bn = (1/omegan)*(2/L)*Integrate[psi*Sin[n*Pi*x/L], {x, 0, L}]

Out[124]= 0

In[125]:= 
U[x, t] = 
  Sum[(An*Cos[omegan*t] + Bn*Sin[omegan*t])*Sin[n*Pi*x/L], {n, 1, 
    1000 L}];

In[126]:= Table[
 Plot[Evaluate[U[x, t]], {x, -10, 10}, 
  PlotRange -> {{-10, 10}, {0, 1}}], {t, 0, 1, .1}]

enter image description here

POSTED BY: Phil R
2 Replies

Note that the wave equation also has the non separable solutions f[x - c t] and f[x + c t].

POSTED BY: S M Blinder

If you change your definition for U to take patterns:

    Clear[U];
     U[x_, t_] = 
     Sum[(An*Cos[omegan*t] + Bn*Sin[omegan*t])*Sin[n*Pi*x/L], {n, 1, 
       10 L}]

Then

Table[Plot[Evaluate[U[x, t]], {x, -10, 10}, 
  PlotRange -> {{-10, 10}, {0, 1}}], {t, 0, 1, .1}]

works.

I truncated the fourier series at many fewer terms than your example. You may get improvement if you use the builtin fourier series functions. You may want to use a Manipulate instead of Table. Also, if your sum is numerical, you should get better performance with NSum rather than Sum.

POSTED BY: W. Craig Carter
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract