PEMECAHAN

Dari Persamaan ke Nol Fungsi

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

Contoh 1

g <- makeFun(sin(x^2)*cos(sqrt(x^4 + 6 )-x^2) - x + 1 ~ x)
slice_plot(g(x) ~ x, domain(x = -4:4)) %>%
  gf_hline(yintercept  = 2, color = "red")

Contoh 2

slice_plot(g(x) ~ x, domain(x=4:5)) %>%
  gf_hline(yintercept = 2, color = "red")

findZeros(g(x) ~ x, xlim = range(0, 7))
##        x
## 1 0.8166
findZeros(g(x) ~ x, xlim = range(-1000,  1000))
##        x
## 1 0.8166

Beberapa Solusi

findZeros( sin(x) - 0.75 ~ x, xlim=range(-30,70) )
##           x
## 1  -11.7183
## 2  -10.2728
## 3   -5.4351
## 4   -3.9897
## 5    0.8481
## 6    2.2935
## 7    7.1313
## 8    8.5767
## 9   13.4144
## 10  14.8599

Menyiapkan Masalah

g <- makeFun(7 + exp(k*t) - 3^(b*t) ~ b, k=0.00075, t=3)
findZeros( g(b) ~ b , xlim=range(-2000, 2000) )
##       b
## 1 0.631
findZeros( g(b, t=5) ~ b, xlim=range(-2000,2000) )
##        b
## 1 0.3786