Convert \(\frac{5 \pi}{18}\) radians to degrees.
# install.packages("pracma")
library(pracma)
value <- rad2deg(rad = 5 * pi / 18)
cat("5 pi / 18 radians =",value,"degrees","\n")
## 5 pi / 18 radians = 50 degrees
Graph and solve the definite integral below.
\[\int_{2}^{4} \ln(x) dx\]
# install.packages("tidyverse")
library(tidyverse)
## Warning: package 'lubridate' was built under R version 4.5.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.1 ✔ stringr 1.5.2
## ✔ ggplot2 4.0.0 ✔ tibble 3.3.0
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.1.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ purrr::cross() masks pracma::cross()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
f <- function(x) {
log(x)
}
answer <- integrate(f = f,lower = 2,upper = 4)$value
x_values <- seq(1.95,4.05,length.out = 500)
y_values <- f(x_values)
q2_data <- data.frame(x = x_values,y = y_values)
ggplot(q2_data,aes(x = x,y = y)) +
geom_line(col = "black",lwd = 1.25) +
geom_ribbon(data = subset(q2_data,x >= 2 & x <= 4),
aes(ymin = 0,ymax = y),
fill = "blue") +
labs(title = "Graph of f(x) = log(x)",
caption = paste("Answer:",round(answer,4)),
x = "x",
y = "y") +
theme_gray(base_size = 14)