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^3)*cos(sqrt(x^6 + 8 )-x^2) - x + 4~ x)
slice_plot(g(x) ~ x, domain(x = -2:2)) %>%
gf_hline(yintercept = 0, color = "red")

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

findZeros(g(x) ~ x, xlim = range(2, 4))
## x
## 1 3.2846
## 2 3.3232
## 3 3.3859
## 4 3.4256
## 5 3.4886
## 6 3.5160
## 7 3.9105
## 8 3.9342
## 9 3.9760
findZeros( sin(x) - 0.35 ~ x, xlim=range(-25,30) )
## x
## 1 -12.2088
## 2 -9.7823
## 3 -5.9256
## 4 -3.4991
## 5 0.3576
## 6 2.7840
## 7 6.6407
## 8 9.0672
## 9 12.9239
## 10 15.3504