Skip to content
Prev 62496 / 398498 Next

UNIROOT

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)