On Sun, 8 Jan 2023 05:24:05 +0200
Leonard Mada via R-help <r-help@r-project.org> wrote:

> pracma::integral(function(x) x^3 / sin(x), -pi/2, pi/2 )
> # 3.385985

Note that at least one implementation used by pracma::integral has the
same problem:

pracma::integral(function(x) x^3/sin(x), -pi/2, pi/2, no_intervals=7)
# [1] NaN
# Warning:
# In .gkadpt(f, a, b, tol = tol) : Infinite or NA function value
# encountered.

You just have to be less lucky to have it evaluate the function at 0.
By default, the subdivision strategy used by pracma::integral combined
with the default number of intervals leaves the special point on the
edge of the interval, where the function happens not to be evaluated.

-- 
Best regards,
Ivan

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to