solution of a 1d wave equation

75 Views Asked by At

I'm trying to solve a wave equation,$u_{tt} = u_{xx}$. This equation has general solution, $f(x+t)+g(x-t)$. The initial condition and boundary condition are given as below:

$u(0,x)=1-|x|$ and $u_{t}(0,x)=1$ for $x$ in $[-1,1]$.

We then can solve the equation using two conditions, and the solution is $u(t,x)= \frac{1}{2}(2-|x+t|-|x-t|+2t)$ and thus $u(1,x)=1$ for $x$ in $[-1,1]$.

However, if we change the initial condition $u(0,x)=1-|x|$ to $u(0,x)=1-x$ if $x$ in $[0,1]$ and $u(0,x)=1+x$ if $x$ in $[-1,0)$, the solution will be different.

I managed to find out the difference occurs when replacing $x$ by $x+t$ and $x-t$ in $f$ and $g$ respectively. However, I have no idea which method is correct. These two conditions are the same, but yield out different answers.

Please tell me which one is correct