Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
pracma软件包中integral3的R错误_R_Numerical Integration - Fatal编程技术网

pracma软件包中integral3的R错误

pracma软件包中integral3的R错误,r,numerical-integration,R,Numerical Integration,我有一个简单的三维积分,我想用pracma软件包中的integral3求解: library(pracma) W <- function(x,y,z){ x + y + z } ymin <- function(x) x zmin <- function(x,y) x zmax <- function(x,y) y integral3(W, xmin = 0, xmax = 1, ymin = ymin, ymax = 1, zmin = zmin, zmax

我有一个简单的三维积分,我想用
pracma
软件包中的
integral3
求解:

library(pracma)

W <- function(x,y,z){
  x + y + z
}

ymin <- function(x) x
zmin <- function(x,y) x
zmax <- function(x,y) y

integral3(W, xmin = 0, xmax = 1, ymin = ymin, ymax = 1, zmin = zmin, zmax = zmax)
库(pracma)

W虽然您的函数
zmin
zmax
看起来很简单,但它们没有矢量化

W <- function(x,y,z) x + y + z

ymin <- function(x) x
zmin <- function(x,y) rep(x, length(y))
zmax <- function(x,y) rep(y, length(x))

integral3(W, xmin = 0, xmax = 1,
             ymin = ymin, ymax = 1, zmin = zmin, zmax = zmax)
## [1] 0.25
W