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
Integrasi adalah proses untuk menemukan integral suatu fungsi. Dalam bahasa pemrograman R, kita dapat menggunakan paket-paket seperti pracma atau fungsi bawaan R untuk melakukan integrasi numerik.
Contoh penggunaan fungsi integrate dari R untuk menghitung integral dari suatu fungsi:
# Definisikan fungsi yang akan diintegralkan
f <- function(x) {
return(x^2 + 3*x + 5)
}
# Hitung integral dari fungsi f antara batas 1 dan 5
result <- integrate(f, lower = 1, upper = 5)
print(result)
## 97.33333 with absolute error < 1.1e-12
Dalam contoh di atas, kita mendefinisikan fungsi dan menggunakan fungsi integrate dari R untuk menghitung integral fungsi tersebut dari batas 1 hingga 5.
Referensi: Kaplan, Daniel. 2022. MOSAIC Calculus. GitHub Pages. https://dtkaplan.github.io/MC2/