library(mosaicCalc)
## Loading required package: mosaic
## Registered S3 method overwritten by 'mosaic':
##   method                           from   
##   fortify.SpatialPolygonsDataFrame ggplot2
## 
## The 'mosaic' package masks several functions from core packages in order to add 
## additional features.  The original behavior of these functions should not be affected by this.
## 
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
## 
##     count, do, tally
## The following object is masked from 'package:Matrix':
## 
##     mean
## The following object is masked from 'package:ggplot2':
## 
##     stat
## The following objects are masked from 'package:stats':
## 
##     binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
##     quantile, sd, t.test, var
## The following objects are masked from 'package:base':
## 
##     max, mean, min, prod, range, sample, sum
## Loading required package: mosaicCore
## 
## Attaching package: 'mosaicCore'
## The following objects are masked from 'package:dplyr':
## 
##     count, tally
## 
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
## 
##     D
g <- makeFun(sin(x^2)*cos(sqrt(x^5 + 10 )-x^1) - x + 3~ x)
slice_plot(g(x) ~ x, domain(x = -1:2)) %>%
  gf_hline(yintercept  = 0, color = "blue")

slice_plot(g(x) ~ x, domain(x=2:6)) %>%
  gf_hline(yintercept = 0, color = "pink")

findZeros(g(x) ~ x, xlim = range(1, 3))
##        x
## 1 2.2008
## 2 2.3461
## 3 2.6058
## 4 2.8106
findZeros( sin(x) - 0.45 ~ x, xlim=range(-20,15) )
##           x
## 1  -16.1747
## 2  -12.0996
## 3   -9.8915
## 4   -5.8164
## 5   -3.6084
## 6    0.4668
## 7    2.6748
## 8    6.7499
## 9    8.9580
## 10  13.0331