On Sun, 8 Jan 2023 05:24:05 +0200
Leonard Mada via R-help 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)
# [
`subdivisions` is the maximum number of subintervals. Looking here
https://github.com/wch/r-source/blob/79298c499218846d14500255efd622b5021c10ec/src/appl/integrate.c#L1275
I'm not surprised that changing `subdivisions` has no effect on the
outcome. The integration method from {pracma} might work,
You're dividing 0 by 0, giving you NaN, perhaps you should try
function(x) ifelse(x == 0, 0, x^3/sin(x))
On Sat, Jan 7, 2023, 22:24 Leonard Mada via R-help
wrote:
> Dear List-Members,
>
> I encounter a problem while trying to integrate the following function:
>
> integrate(function(x) x^3 / sin
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)
int
>Error in integrate(fx[[2]], 0.056, 1) :
> maximum number of subdivisions reached
>
> Can anyone help?
At the risk of longer integration time, look at the 'subdivisions' argument in
?integrate and consider increasing it?
S Ellison
Hello,
The following code of mine is giving the error:
Error in integrate(fx[[2]], 0.056, 1) :
maximum number of subdivisions reached
Can anyone help?
Thanks and Regards.
Swagato
--
fv<-vector("list")
fx<-vector("list")
v<-0
c<-0
n<-0
NOV<-0
i<-0
while(n<200){
fv[
6 matches
Mail list logo