I have an intricate function whose integration behavior I fail to make sense of:
- Does
points
specify intervals of possible singularities, or points? - Whatever answer to above, how to explain
2.1
working but not2
? (also1
,5
, ...) Note that the only subject of singularity is at 0, but it's not even the case as without/ w
the function is 0 there and nearby. - Behavior persists even with
/ w
removed.
import numpy as np
from scipy.integrate import quad
def fn(w, mu=11.316582914572866):
return (np.exp(-1 / (1 - ((w - mu) * (np.abs(w - mu) < .999))**2))
) * (np.abs(w - mu) < .999) / w
for pt2 in (1.0, 2.0, 2.1, 5.0):
print(pt2, '--', quad(fn, 1e-8, 40, points=(0, pt2))[0])
1.0 -- 0.039282478570060606
2.0 -- 0.0
2.1 -- 0.03928247857037831
5.0 -- 0.03928247859275705
