Question 1

If \(r(x) = \frac{1}{\cos(\sqrt{x})}\), what is \(r'(x)\)?

# install.packages("Deriv")
library(Deriv)
r <- function(x) {
  1 / cos(sqrt(x))
}
r_prime <- Deriv(r)
r_prime
## function (x) 
## {
##     .e1 <- sqrt(x)
##     0.5 * (sin(.e1)/(cos(.e1)^2 * .e1))
## }

Question 2

There are ten colored pencils in a box. You choose one colored pencil from the box without looking. Which color pencil are you least likely to choose?

pencil_box <- c(rep("Black",3),rep("Blue",2),rep("Yellow",2),rep("Green",2),"Orange")
simulation <- sample(x = pencil_box,size = 1e6,replace = T)
probabilities <- prop.table(table(simulation))
probabilities
## simulation
##    Black     Blue    Green   Orange   Yellow 
## 0.300411 0.199913 0.199980 0.100179 0.199517

We find that orange is the least likely to be chosen.

Question 3

Which one of the following is even?

A. \(51 \times 53 \times 55\)

B. \(53 \times 55 \times 57\)

C. \(52 \times 54 \times 56\)

D. \(53 \times 57 \times 59\)

# 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
q3_data <- data.frame(Choice = LETTERS[1:4],
                      Number = c(51*53*55,53*55*57,52*54*56,53*57*59))
correct <- q3_data %>%
  mutate(Even = Number %% 2 == 0) %>%
  filter(Even == TRUE) %>%
  pull(Choice)
cat("The correct answer is:",correct,"\n")
## The correct answer is: C

Question 4

What is \(\int 3 \cos(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(3 * cos(x) ~ x)
anti_f <- antiD(f(x) ~ x)
anti_f
## function (x, C = 0) 
## 3 * sin(x) + C