library(mosaicCalc)
## Loading required package: mosaicCore
## Loading required package: Deriv
## Loading required package: Ryacas
## 
## Attaching package: 'Ryacas'
## The following object is masked from 'package:stats':
## 
##     integrate
## The following objects are masked from 'package:base':
## 
##     %*%, diag, diag<-, lower.tri, upper.tri
## Registered S3 method overwritten by 'mosaic':
##   method                           from   
##   fortify.SpatialPolygonsDataFrame ggplot2
## 
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
## 
##     D
g <- makeFun(sin(x^2)*cos(sqrt(x^4 + 7 )-x^2) - x + 1 ~ x)
slice_plot(g(x) ~ x, domain(x = -2:2)) %>%
  gf_hline(yintercept  = 0, color = "red")

library(mosaicCalc)
slice_plot(g(x) ~ x, domain(x=3:6)) %>%
  gf_hline(yintercept = 0, color = "green")

library(mosaic)
## 
## 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
findZeros(g(x) ~ x, xlim = range(-100,  150))
##       x
## 1 0.718
library(mosaic)
findZeros( sin(x) - 0.35 ~ x, xlim=range(-15,20) )
##           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
library(mosaicCalc)
g <- makeFun(sin(x) - 0.35 ~ x)
slice_plot(g(x) ~ x, domain(x = -20:20)) %>%
  gf_hline(yintercept =  0, color = "blue") %>%
  gf_vline(xintercept = 0, color = "pink")

library(mosaicCalc)
g <- makeFun(4 + exp(k*t) - 2^(b*t) ~ b, k=0.00035, t=1)
findZeros( g(b) ~ b , xlim=range(-1000, 1000) )
##       b
## 1 2.322
library(mosaicCalc)
g <- makeFun(4 + exp(k*t) - 2^(b*t) ~ b, k=0.00035, t=2)
findZeros(g(b, t=2) ~ b, xlim=range(-100,150))
##        b
## 1 1.1611