Reputation: 3
I want to define the function f(x) = (2/pi) * sqrt(1-(x^2))
and its range [-1,1]
. I don't think there's a Indicator Function in R, but how can I define this range?
Upvotes: 0
Views: 189
Reputation: 102920
What about this kind of function definition?
f <- function(x) {
stopifnot(abs(x)<=1)
(2/pi) * sqrt(1-(x^2))
}
Upvotes: 1