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