I think the project should be called "NIntegrate".
BTW, that is not a serious suggestion; it is just that Wolfram Language (aka Mathematica) has both `Integrate` and `NIntegrate` for symbolic and numeric integration, respectively.
It looks a bit sloppy to hardcode so many constants in a single file: `src/gauss_quadrature/legendre.rs`. Isn't it possible to generate them with the help of rust macros in the same way Julia uses metaprogramming?
I was always amazed that R can do:
> integrate(dnorm, -Inf, +Inf)
1 with absolute error < 9.4e-05
Can we do the same in this library?In the rectangle method, there is "let x = a + i * h + (h / F1::from(2)...)"
I didn't check, but I wonder if it is not better to do x = a + (i+0.5)*h... My reasoning is that if "i" is very big, then i * h can be much bigger than h/2 and thus h/2 may be eaten by numerical precision when added to i*h... And then you have to convince the optimizer to do it the way you want. But well, it's late...
I don't see any explicit SIMD in here. Is the rust compiler able to emit SIMD instructions automatically in cases like this? (I guess I could compile and disassemble to check... )
Fast, small, lightweight compared to what?
Thanks for showing this! It is very motivating to develop (and finish) my Raku numerical integration project.
Is there a technical reason to now allow closures as the integrand?
[flagged]
> Does the function oscillate over the region of integration? If it does, then make sure that the step size is chosen to be smaller than the wave length of the function.
Nyquist limit, but for numerical integration?