Finite difference approximations of the Jacobian are really only good if the step lengths are chosen appropriately for each coordinate. But a black-box solver like CVODE has no way of knowing what these step lengths should be, and so has to use heuristics to choose them. This may or may not work. You are almost always better off if you provide an ...


I think that the main problem might be with the solver you are using. The Hamiltonian (matrix) in this case is Hermitian, it is even symmetric since it is purely real. You could use eigh instead of eig to take advantage of this. Furthermore, you are not removing only the first and last points but intervals of size 1 at each end. Following, I show you a ...


The are some who would say that this is the price you pay for not having to invert a matrix. You traded relatively cheap timestep updates for accuracy. You could switch to an implicit method and take as fine a grid as you like at the cost of having to solve a linear system at each timestep.

Only top voted, non community-wiki answers of a minimum length are eligible