Chris Rhoads wrote: > > > I wish to find the root of a function of two variables that is defined by > an integral which must be > evaluated numerically. > > So the problem I want to solve is of the form: Find k such that f(k)=0, > where f(y) = int_a^b > g(x,y) dx. Again, the integral > involved must be done numerically. > >
g <- function(x,p) 2*(x-p) Find value of p such that integral_0^1 g(x,p)dx is zero f <- function(p) integrate(g,0,1,p)$value uniroot(f, c(0,1)) $root should be 0.5 which is what is expected here. Berend Hasselman -- View this message in context: http://www.nabble.com/numerical-integration-of-a-ftn-of-2-variables-tp15578652p15618830.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.