compute the entanglement entropy for arbitrary wavefunctions, and as a function of x for chains