Skip to content

how to include integrate in a function that can be solved with uniroot?

2 messages · R. Michael Weylandt, Gerrit Draisma

#
You need to explicitly pass th to your function with the ... argument
of integrate.

E <- function(th){
    integrate(function(x,th) x*g(x, th), 0, Inf, th)$value
}

Also, it's value, not Value, which might be producing errors of another sort.

Michael
On Mon, Nov 14, 2011 at 9:16 AM, Gerrit Draisma <gdraisma at xs4all.nl> wrote:
1 day later
#
Thanks Michael,
Op 11/14/2011 3:30 PM, R. Michael Weylandt schreef:
That was a point I was missing!
Thanks again,
This solved my problems for this time.
Gerrit.