Search code examples
rmatrixintegrate

Integrate a matrix


I am new to R. any help is welcome. Let's say I have a function A in R that returns a matrix A(x). How i can I compute enter image description here ? I am aware of the existence of integrate, but this function works only with scalar functions. thank you in advance


Solution

  • I would just do a loop for it with rectangles or something.

    res=0
    for (i in seq(0,1,1/10000)[-10001])
        res=res+A(i)
    res=res/10000