0

I'm stuck with computing an integral in R. Suppose I have some function:

SomeFun = function(x) {x*parameter}

Now, parameter need not be a scalar. It may be a matrix (e.g. a (2 x 2) matrix). Hence, if I input a scalar-valued x my function returns a (2 x 2) matrix.

Now my question: Is it possible to compute the definite integral of SomeFun where each element of the matrix has different upper and lower bounds? Something like:

integrate(SomeFun, lower=c(0,2,0,-1), upper=c(1,5,1,1))

Hence, I get a (2 x 2) matix of definite integrals where the first entry (upper left corner) is integrated between 0 and 1 whereas the last entry (lower right) is integrated between -1 and 1.

Thank you very much for your comments. Romain

RomainD
  • 301
  • 1
  • 2
  • 9

0 Answers0