Put the following data in order from least to greatest.
q1_data <- data.frame(Route = c("ATL -> BNA","ATL -> LAX","ATL -> YYZ"),
Mileage = c(214,1947,739))
q1_data
## Route Mileage
## 1 ATL -> BNA 214
## 2 ATL -> LAX 1947
## 3 ATL -> YYZ 739
# 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() ──
## ✖ 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
q1_data %>%
arrange(Mileage)
## Route Mileage
## 1 ATL -> BNA 214
## 2 ATL -> YYZ 739
## 3 ATL -> LAX 1947
Which of the following numbers is odd?
A. \(67 \times 65 \times 64\)
B. \(67 \times 65 \times 63\)
C. \(67 \times 66 \times 64\)
D. \(68 \times 66 \times 64\)
# install.packages("tidyverse")
library(tidyverse)
q2_data <- data.frame(Choice = c("A","B","C","D"),
Number = c(67 * 65 * 64,67 * 65 * 63,67 * 66 * 64,68 * 66 * 64))
odd_number_choice <- q2_data %>%
filter(Number %% 2 == 1) %>%
pull(Number,Choice)
odd_number_choice
## B
## 274365
What is \(\int 5x^2 - 2 \sin(x) dx\)?
# install.packages(c("ggformula","mosaicCalc"))
library(ggformula)
## Warning: package 'ggformula' was built under R version 4.5.2
## Loading required package: scales
##
## Attaching package: 'scales'
## The following object is masked from 'package:purrr':
##
## discard
## The following object is masked from 'package:readr':
##
## col_factor
## Loading required package: ggiraph
## Warning: package 'ggiraph' was built under R version 4.5.2
## Loading required package: ggridges
## Warning: package 'ggridges' was built under R version 4.5.2
##
## New to ggformula? Try the tutorials:
## learnr::run_tutorial("introduction", package = "ggformula")
## learnr::run_tutorial("refining", package = "ggformula")
library(mosaicCalc)
## Warning: package 'mosaicCalc' was built under R version 4.5.2
## Registered S3 method overwritten by 'mosaic':
## method from
## fortify.SpatialPolygonsDataFrame ggplot2
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
f <- makeFun(5 * x^2 - 2 * sin(x) ~ x)
anti_f <- antiD(f(x) ~ x)
anti_f
## function (x, C = 0)
## (5 * x^3 + 6 * cos(x))/3 + C
Solve and graph the following definite integral.
\[\int_{\frac{\pi}{4}}^{\frac{3 \pi}{4}} -3 \cos(2x) dx\]
# install.packages("tidyverse")
library(tidyverse)
g <- function(x) {
-3 * cos(2 * x)
}
answer <- integrate(g,lower = pi / 4,upper = 3 * pi / 4)$value
x_values <- seq(0,pi,length.out = 500)
y_values <- g(x_values)
q4_data <- data.frame(x = x_values,y = y_values)
ggplot(q4_data,aes(x = x,y = y)) +
geom_line(col = "black",lwd = 1.25) +
geom_ribbon(data = subset(q4_data,x >= pi / 4 & x <= 3 * pi / 4),
aes(ymin = 0,ymax = y),
fill = "blue") +
labs(title = "Graph of g(x) = -3 cos(2x)",
caption = paste("Answer:",round(answer,4)),
x = "x",
y = "y") +
theme_gray(base_size = 14)