Dosen: Prof. Dr. Suhartono, S.Si., M.Kom_196805192003121001
Fakultas: Sains dan Teknologi
Program Studi: Teknik Informatika
Kelas: C
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
## The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
## which was just loaded, will retire in October 2023.
## Please refer to R-spatial evolution reports for details, especially
## https://r-spatial.org/r/2023/05/15/evolution4.html.
## It may be desirable to make the sf package available;
## package maintainers should consider adding sf to Suggests:.
## The sp package is now running under evolution status 2
## (status 2 uses the sf package in place of rgdal)
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
NUMERICAL ZERO FINDING MENGGUNAKAN ZEROS()
f <- rfun( ~ x, seed=579)
Zeros() diatur untuk mencari masukan dimana fungsi nol sebagai keluaran. Tapi misalkan kita sedang menghadapi masalah seperti f(x) = 13 Anda dapat memodifikasi ekspresi tilde sehingga mengimplementasikan fungsi yang sedikit berbeda seperti f(x) - 13. jika kita ingin menemukan x0 seperti f(x0) - 13 = 0 menjadi f(x0) = 13. contoh kita ingin mencari nilai angka nol dari fungsi f(x) - 13 yang sesuai dengan penyelesaian f(x) = 13
Zeros(f(x) -13 ~ x, bounds(x=-10:10))
## # A tibble: 2 × 2
## x .output.
## <dbl> <dbl>
## 1 -2.15 -0.00000131
## 2 -0.423 -0.0000605
## # A tibble: 2 × 2
## x .output.
## <dbl> <dbl>
## 1 -2.15 -1.305046e-06
## 2 -0.422 -6.048633e-05
Keluaran yang dihasilkan Zeros() berupa bingkai data dengan satu baris untuk masing masing nilai dari x0, untuk nilai ke 1 x0 = -2.15 dan nilai yang ke 2 x0 = -0.2179. jika kita ingin merubah menjadi grafis, menggunakan :
slice_plot(f(x) ~ x, bounds(x=-3:3)) %>%
gf_hline(yintercept = ~ 13, color="orange")