Skip to content
Prev 274786 / 398506 Next

About an integral univariate problem

Your original code was not directly vectorizible (and I should have
noted that): this should work:

fnc <- function(x, y) {
    z <- outer(y, x, FUN = "^")
    exp(-x) * colSums(z)
}
y <- c(2,3,5)
integrate(fnc, 0, 3, y)

This should work and sorry for the initial confusion.

Michael

On Tue, Oct 18, 2011 at 11:05 AM, Freddy Hernandez Barajas
<fhernanb at gmail.com> wrote:
Message-ID: <CAAmySGPkvrfDbD0TiCH4ZK_sk3kwKHcHxtZdMuUX14wp-ydh5A@mail.gmail.com>
In-Reply-To: <CAEb2E7Z+j98d-mUtBwF0Cro3EcUK1xa+kRzWxvCVGL3kwLNaLQ@mail.gmail.com>