Dosen Pengampu : Prof .Dr.Suhartono, M.Kom

Lembaga : Universitas Islam Negeri Maulana Malik Ibrahim Malang

Fakultas : Sains dan Teknologi

Jurusan : Teknik Informatika

Kelas : (C) Kalkulus

NIM : 230605110080

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
library(ggplot2)
library(quadprog)

INTEGRAL

Integral adalah suatu konsep dalam matematika yang terkait dengan ide menghitung luas di bawah suatu kurva pada bidang koordinat. Terdapat dua jenis utama dari integral yaitu integral tak tentu dan integral tentu atau bisa disebut sebagai integral pasti.

INTEGRAL PASTI

Integral pasti mengukur luasan di bawah kurva fungsi f(x) di antara dua titik tertentu pada sumbu x. Integral pasti ditunjukkan dengan simbol ∫ dengan batas bawah (a) dan batas atas (b) :

∫ batas bawah (a) batas atas (b) f(x)dx

Hasilnya adalah suatu nilai tunggal dan mewakili luas daerah di antara kurva f(x) dan sumbu x dari x=a hingga x=b.

Integral memiliki banyak aplikasi di berbagai bidang matematika dan sains, seperti fisika, ekonomi, dan statistika. Dalam konteks aplikatif, integral dapat digunakan untuk menghitung luasan, volume, nilai rata-rata, dan berbagai parameter lainnya.

Penerapan konsep integral seringkali melibatkan teknik-teknik kalkulus, baik itu untuk menyelesaikan masalah secara analitis atau menggunakan metode numerik untuk mendekati nilai integral dalam kasus yang lebih kompleks.

Contoh:

Misalkan kita memiliki fungsi f(x)=2x dan kita ingin menghitung integral pasti dari 1 hingga 3

∫ dengan batas atas (3) dan batas bawah (1) 2x dx

Langkah-langkahnya adalah sebagai berikut:

Hitung Integral:

∫ batas atas (3) dan batas bawah (1) 2x dx 2x dx = [x^2] batas atas (3) dan batas bawah

Evaluasi Batas Atas dan Bawah:

[3^2] − [1^2]

= 9 − 1 = 8

Jadi, integral pasti dari 2x dari 1 hingga 3 adalah 8. Ini dapat diinterpretasikan sebagai luasan daerah di bawah kurva 2x dari x=1 hingga x=3 pada sumbu x.

# Tentukan fungsi
f <- function(x) 2*x

# Hitung integral tentu dari 1 hingga 3
result <- integrate(f, lower = 1, upper = 3)

# Tampilkan hasil
print(result)
## 8 with absolute error < 8.9e-14
# Install dan load library yang diperlukan
install.packages("ggplot2")
## Warning: package 'ggplot2' is in use and will not be installed
library(ggplot2)

# Tentukan fungsi
f <- function(x) 2*x

# Tentukan batas integral
a <- 1
b <- 3

# Buat data frame untuk plot fungsi
x_values <- seq(a - 1, b + 1, length.out = 100)
y_values <- f(x_values)

df <- data.frame(x = x_values, y = y_values)

# Buat plot
plot <- ggplot(df, aes(x = x, y = y)) +
  geom_ribbon(data = subset(df, x >= a & x <= b),
              aes(ymax = y, ymin = 0),
              fill = "skyblue", alpha = 0.5) +
  geom_line() +
  geom_segment(aes(x = a, y = 0, xend = a, yend = f(a)),
               linetype = "dashed", color = "red") +
  geom_segment(aes(x = b, y = 0, xend = b, yend = f(b)),
               linetype = "dashed", color = "red") +
  labs(title = "Grafik Fungsi dan Area di Bawah Kurva",
       subtitle = "Integral Tentu dari 1 hingga 3",
       x = "x", y = "f(x)") +
  theme_minimal()

# Tampilkan plot
print(plot)