[R] Integral implicit function
Peter.Ruckdeschel at uni-bayreuth.de
Mon Dec 10 21:04:46 CET 2007
Have you tried vectorizing the inner function?
Hint: integrate() calls the integrand vectorwise...
in your example,
should do what you expected.
Eddy H. G. Bekkers wrote:
> Could somebody help me with the following. I want to calculate the
> integral over an implicit function. I thought to integrate over a function
> depending on uniroot. In previous topics I found a thread about finding
> the root of an integral. And that works. But the other way around, does
> not work. Does R support this?
> I included the following example. The function in the example is very easy
> and can be solved explicitly, but when it does not work for such an easy
> function it will certainly not work for a more difficult function. First
> the root of an integral (which works) and then the integral of a function
> dependent on uniroot:
> # Calculating the root of an integral
> a<- function(x,y)
> b<- function(y)
> d<- uniroot(b,c(0,10))$root
> # Calculating the integral of a function dependent on uniroot
> e<- function(u,v)
> f<- function(v)
> g<- integrate(f,lower=1,upper=2)$value
> Does anyone have suggestions how to proceed? By the way, the implicit
> function I am targeting does have a unique solution, it is only not
> explicitly solvable, i.e. in the example above, you cannot solve u as a
> function of v explicitly, so as to substitute it in the integrand.
> Thanks a lot in advance for your help,
> Best regards,
> Eddy Bekkers
> Department of Economics
> Erasmus University Rotterdam
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
View this message in context: http://www.nabble.com/Integral-implicit-function-tp14201932p14260535.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help