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
Optimasi merupakan salah satu operasi pada kalkulus dimana Optimasi: menemukan input yang menghasilkan output terbesar, Di dunia banyak sekali data yang memiliki batas maksimal dan batas minimum, Dalam kalkulus sendiri terdapat optimasi yang dapat membantu kita dalam meencari nilai terbsesar dari suatu ouput
Ini adalah perintah untuk mengimpor paket mosaicCalc ke dalam Rstudio. Paket ini berisi berbagai fungsi yang akan digunakan
h <- rfun(x^10 ~ x, seed=7234)
result <- argM(h(x) ~ x, bounds(x = -10:10))
result
## # A tibble: 2 × 3
## x .output. concavity
## <dbl> <dbl> <dbl>
## 1 3.06 -1.54 1
## 2 -1.90 17.2 -1
argM() diatur untuk mencari argmax tunggal dan argmin tunggal dalam interval domain yang diberikan sebagai argumen kedua.
slice_plot(h(x) ~x, bounds(x=-10:10)) %>%
gf_vline(xintercept = result$x[1], color = "blue", linetype = "dashed") %>%
gf_vline(xintercept = result$x[2], color = "red", linetype = "dashed")
slice_plot digunakan untuk membuat sebuah grafik yang nantinya menggunakan persamaan yang sudah di tentutkan dan dengan panjang kordinat X yang sudah di implementasiakan pada bounds(). Dan pada gf_vline(), inni digunakan sebagai pembuat garis veritkal yang nantinya akan di tampilkan pada grafik