使用PRACMA与Integral2进行双重集成会产生错误fun(x,y,...)中的错误:参数“ c”丢失,没有默认值

时间:2018-10-22 18:57:26

标签: r integral

我想知道您能否提供帮助。我正在尝试将一个集成的结果带入下一个。第一次积分计算c的值如下:

library(pracma)
f <- function(x,y) x^2*y
xmin <- -1; xmax <- 1
ymin <- function(x) x^2; ymax <-1
integral <- integral2(f, xmin,xmax,ymin,ymax)
integral$Q 

这给出的值为0.1904762,这是不带c的积分的值,但是由于我们需要不带c = 1的c⋅积分,所以我们发现c乘以1 /积分

1 / integral$Q 

等于5.25。接下来,我们将c的值合并到下面给出的公式中(此代码失败)

 f <- function(x,y,c) c * x^2 * y
 c <- 5.25
 xmin <- 1; xmax <- 0
 ymin <- function(x) x^2; ymax <-function (x) x
 I<- integral2(f, xmin,xmax,ymin,ymax)$Q 
 I$Q 

然后导致错误

Error in fun(x, y, ...) : argument "c" is missing, with no default.

c的值如何合并到第二个integer2代码中?

谢谢

0 个答案:

没有答案