On Thu, May 17, 2012 at 09:43:13PM -0400, li li wrote:> Dear all,
> I have a function f <- function(x,y,c){as.numeric(x*y < c) }
> I need to solve the value of c so that when I take the integral of
> the function f from 0.2 to 0.8 with respect to x and from 0 to 1
> with respect to y, the integral equal some prefixed value, say 0.025.
Hi.
The function f() is a 0/1 function. So, the integral may be
reformulated as the area of the set of points (x, y) satisfying
0.2 <= x <= 0.8
0 <= y <= 1
x*y <= c
In other words, it is the univariate integral of the function
g(x) = min(1, c/x)
over the range x \in [0.2, 0.8]. This is
G <- function(cc) {
ifelse(cc <= 0.2, cc*log(4), # cc*(log(0.8) - log(0.2))
ifelse(0.2 < cc & cc < 0.8, (cc - 0.2) + cc*(log(0.8) -
log(cc)), 0.8 - 0.2))
}
What i get is that G(cc) = 0.025 for cc = 0.025/log(4).
I hope there are not too may errors in this calculation.
Petr Savicky.