NaN returned by gauss()

I’m using the function gauss() from QuadGK in order to calculate a non-adaptive quadrature and am irritated about the appearance of NaN beyond a certain N. Specifically, gauss(1093,38.68598671891722,150000.0) returns an array that is partly populated with NaN, whereas gauss(1092,38.68598671891722,150000.0) seems to be ok. Why is this, and is it supposed to be this way? A proper warning or error message would be more helpful than just returning NaN and waiting with the crash until they are used.

Can you use FastGaussQuadrature.jl?

Is using BigFloats an option?
gauss(BigFloat, 1093, 38.68598671891722, 150000.0)

Thanks for pointing me to this extra option. Yes, I tried it with N=1500 and it did work, although the use of BigFloats seems to make the calculation noticeably slower.

Yes and no, I guess. Yes, because it seems that the NaNs don’t show up. However, when applying the nodes and weights from it (generated with gausschebyshev, because my interval is finite) to my main calculation, where the integration appears, with changing bounds, in a time-stepping loop, the calculation seems to hang for some reason, although I don’t think I made a mistake in the remapping of the interval (which I understand is for some reason not included in FastGaussQuadrature.jl).

This is a bug; it looks like an underflow problem in my Newton iteration. I’ll push a fix shortly.

1 Like

The bug is fixed in the latest version (2.4.2) of QuadGK:

julia> all.(isfinite, gauss(1093,38.68598671891722,150000.0))
(true, true)
1 Like

A post was split to a new topic: Problem upgrading GR package