[R] UNIROOT

Gabor Grothendieck ggrothendieck at myway.com
Sat Jan 15 08:16:49 CET 2005


aar paar <aar420 <at> hotmail.com> writes:

: 
: f(x) = .01*(1.2^y) integrated from 0 to x
: 
: Find x such that
: 
: f(x) = some number, say 4
: 
: How do we do it in R?

You don't need R for this.

Your integral can be solved analytically, check any 
table of integrals, and the rest can be solved using
elementary algebra so R is not needed here.  If you 
really do want to use R anyways:

g <- function(y) .01 * 1.2^y
f <- function(x) integrate(g, 0, x)$value - 4
uniroot(f, low = -100, up = 100)




More information about the R-help mailing list