Finite Double integration in R- Studio Error

I want to integrate a two variable function in R studio using “cubature” package in R but when submitting code getting the error.
I don’t know whether the problem is in writing function or using function.
I have given the two codes that I am using followed by the error in italic font;

  1. Code:

f10 <- function(x, y) {1/(sqrt(1- x^2) * sqrt(1 – y^2))}

(a10 <- adaptIntegrate(f10, lower = c(0, 0), upper = c(1, 1))$integral)

Error :
Error in f(x, …) : argument “y” is missing, with no default
Called from: f(x, …)

  1. Code:

f10 <- function(x) {1/(sqrt(1- x^2) * sqrt(1 – y^2))}

(a10 <- adaptIntegrate(f10, lower = c(0, 0), upper = c(1, 1))$integral)

Error:
Error in f(x, …) : object ‘y’ not found
Called from: f(x, …)

Please Help!

Read more here: Source link