I am trying to solve the KdV equation numerically. The following code would work perfectly in version 5:
```
q[x_] = (Erf[x] - 1)/2 - 5 Sech[x - 1]; xmax = 300; tmax = 10;
NDSolve[{D[u[x, t], t] == -D[u[x, t], x, x, x] + 6 u[x, t] D[u[x, t], x],
u[x,0] == q[x], u[-xmax, t] == -1, u[xmax, t] == 0,
Derivative[1, 0][u][-xmax, t] == 0, Derivative[1, 0][u][xmax, t] == 0},
u, {t, 0, tmax}, {x, -xmax, xmax}, Method -> StiffnessSwitching]
```
but fails in 12.3.0 for Mac with the error:
>At t==1.57.., stepsize is effectively zero
Obviously the method used by *Mathematica* produces oscillations on the positive half-axis, which should not be there. Any hints on how to get a valid numerical solution with *Mathematica*? Thanks.