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
Fungsi eksponensial adalah jenis fungsi matematika yang memiliki bentuk umum
f(x) = a^x,
di mana a adalah konstanta positif (a lebih besar dari 0) yang disebut sebagai dasar eksponensial, dan x adalah variabel. Fungsi ini memiliki beberapa properti khusus yang membuatnya penting dalam matematika dan berbagai bidang ilmu.
Pemetaan Fungsi
library(ggplot2)
Misalkan
f(x) = 2^x, maka
f(2) = 2^2 = 4
f(3) = 2^3 = 8
Nilai dari fungsi f(x) = 3^x + 1, jika x = 2 adalah
f(x) = 3^x + 1
f(2) = 3^2 + 1
= 9 + 1
= 10
# Install ggplot2 jika belum diinstal
# install.packages("ggplot2")
# Memuat library ggplot2
library(ggplot2)
# Membuat data frame dengan nilai x = 2
data <- data.frame(x = 2, y = 3^2 + 1)
# Membuat plot menggunakan ggplot2
plot <- ggplot(data, aes(x, y)) +
geom_point(color = "blue", size = 3) +
geom_text(label = expression(3^2 + 1), vjust = -0.5, hjust = -0.5, color = "red", size = 4) +
labs(title = "Grafik Fungsi Eksponensial",
x = "x",
y = "f(x)") +
theme_minimal()
# Menampilkan plot
print(plot)
## Warning in is.na(x): is.na() applied to non-(list or vector) of type
## 'expression'
library(ggplot2)
Nilai fungsi f(x) = 5^x-2 + 1, jika x = 1 adalah
f(x) = 5^x-2 + 1
f(1) = 5^1-2 + 1
= 1/5 + 1
= 6/5
= 1,2
# Memasukkan library
library(ggplot2)
# Membuat fungsi eksponensial
f <- function(x) {
return(5^(x-2) + 1)
}
# Membuat vektor x dengan nilai 1
x <- 1
# Menghitung nilai fungsi pada x
y <- f(x)
# Membuat data frame
data <- data.frame(x, y)
# Membuat grafik menggunakan ggplot2
grafik <- ggplot(data, aes(x, y)) +
geom_point(color = "red", size = 3) + # Menambahkan titik pada koordinat (x, y)
geom_line(color = "blue") + # Menambahkan garis plot
labs(title = "Grafik Fungsi Eksponensial",
x = "Nilai x",
y = "Nilai f(x)") + # Menambahkan label sumbu
theme_minimal() # Memilih tema grafik
# Menampilkan grafik
print(grafik)
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?