Here's a strange bug: adaptiveSimpson(x => x * Math.sin(n * x), 0, Math.PI) is effectively zero for all n that are multiples of 4, though the correct result is +/- pi/n. I discovered this while trying to develop some tools for Fourier Series. :)
I've added a minDepth parameter to help overcome this, though you've hit on a weakness of this method. I've also allowed use of a params object instead, so that, for example, `adaptiveSimpson(x => x * Math.sin(n * x), 0, Math.PI, { minDepth: 2 })` fixes this particular case. It's not ideal since there's not a clear indication when you've aligned the zeros with the function's zeros, but it's the best I have for now! Thanks for pointing out this case!