Optimasi adalah salah satu operasi yang terdapat dalam kalkulus. Optimasi adalah mencari input yang menghasilkan output terbesar.

library(mosaicCalc)
## Loading required package: mosaic
## Warning: package 'mosaic' was built under R version 4.3.2
## 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
## Warning: package 'mosaicCore' was built under R version 4.3.2
## 
## 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
h <- rfun(x^2 ~ x, seed=7234)
result <- argM(h(x) ~ x, bounds(x = -20:20))
slice_plot(h(x) ~x, bounds(x=-20:20)) %>%
  gf_vline(xintercept = result$x[1], color = "blue", linetype = "dashed") %>%
    gf_vline(xintercept = result$x[2], color = "red", linetype = "dashed")

Daftar Pustaka: Daniel, K. (2022). MOSAIC Calculus. Diakses pada tanggal 1 Desember 2023 dari https://www.mosaic-web.org/MOSAIC-Calculus/