inst/snippet/alice-bob01.R

f <- function(prob) { 
        prob  + prob * (1-prob)^3/(1-(1-prob)^2) 
}
g <- function(prob) { f(prob) - 0.50 }
uniroot(g,c(0.20,0.5))$root          # when g=0, f=0.5

Try the fastR package in your browser

Any scripts or data that you put into this service are public.

fastR documentation built on May 2, 2019, 5:53 p.m.