I have a 2D space-time PDE and I want to solve it numerically over the time axis. The time initial field is already known with respect to space, i.e., the spatial distribution is already known at time t = 0. I solved the same PDF in Mathematica and got a solution. I tried to solve it numerically step wise in time and implemented the same numerical update equation in MATLAB. Both give me different results. I checked the paper where I took the question from and with only a visual inspection it feels like the one from Mathematica is more accurate. As time progresses, the numerical model becomes more erroneous.
The PDE:
$$ \frac{\partial \eta(x, t)}{\partial t} + \sin\Big(\frac{2 \pi x}{L}\Big) \frac{\partial \eta(x, t)}{\partial x} = 0 $$
Boundary conditions: At the spatial boundaries, the function has a value of 0.
$$ \eta(0, t) = 0, \eta(L, t) = 0 $$
The time initial field is given by
$$ \eta(x, 0) = \sin\Big(\frac{2 \pi x}{L}\Big) $$
The solution from mathematica is:
$$ \eta(x, t) = \sin\Big( 2 \cot^{-1} \Big[ e^{\frac{2 \pi t + L \log\Bigg[\cos\Big({\frac{\pi x}{L}\Big)}\Bigg] - L \log\Bigg[ \sin\Big({\frac{\pi x}{L}\Big)} \Bigg]}{L}} \Big] \Big) $$
I solve the numerical version by integrating the PDE with respect to t, then, I get the follwing
$$ \eta(x, t + 1) = \eta(x, t) - \sin(2 \frac{\pi x}{L}) \frac{\Delta t }{\Delta x} [\eta(x+1, t) - \eta(x, t)] $$
The results are given in the picture for $x\epsilon(0, 20]$ with a step of $\Delta x = 1$ and $t\epsilon(0, 1.3]$ with a step of $\Delta t = 0.1$.
However, they both satisfy the boundary conditions. The peak values are different. 