f1 <- function(x) sin(pi/x)
froots(f1, 1/10, 1)
# 0.1000000 0.1111028 0.1250183 0.1428641 0.1666655
# 0.2000004 0.2499867 0.3333441 0.4999794 1.0000000
f2 <- function(x) 0.5*(1 + sin(10*pi*x))
froots(f2, 0, 1)
# 0.15 0.35 0.55 0.75 0.95
Run the code above in your browser using DataLab