Dear List-Members, I encounter a problem while trying to integrate the following function:
integrate(function(x) x^3 / sin(x), -pi/2, pi/2) # Error in integrate(function(x) x^3/sin(x), -pi/2, pi/2) : # non-finite function value # the value should be finite: curve(x^3 / sin(x), -pi/2, pi/2) integrate(function(x) x^3 / sin(x), -pi/2, 0) integrate(function(x) x^3 / sin(x), 0, pi/2) # but this does NOT work: integrate(function(x) x^3 / sin(x), -pi/2, pi/2, subdivisions=4096) integrate(function(x) x^3 / sin(x), -pi/2, pi/2, subdivisions=4097) # works: integrate(function(x) x^3 / sin(x), -pi/2, pi/2 + 1E-10) # Note: works directly with other packages pracma::integral(function(x) x^3 / sin(x), -pi/2, pi/2 ) # 3.385985 I hope that integrate() gets improved in base R as well. Sincerely, Leonard ______________________________________________ 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.