Question 1

Let \(s(x) = x^3 - 2\) and \(s(2) = 6\). Find \((s^{-1})'(6)\).

# install.packages("Deriv")
library(Deriv)
s <- function(x) {
  x^3 - 2
}
s_prime <- Deriv(s)
inverse <- function(f,lower,upper) {
  Vectorize(function(y) {
    uniroot(function(x) {f(x) - y},lower = lower,upper = upper)$root
  })
}
x_at_6 <- inverse(f = s,lower = 0,upper = 3)(6)
answer <- (s_prime(x_at_6))^(-1)
cat("Answer:",answer,"\n")
## Answer: 0.08333427

Question 2

Write 433 in words.

# install.packages("english")
library(english)
## Warning: package 'english' was built under R version 4.5.2
words(433)
## [1] "four hundred thirty-three"

Question 3

\(\frac{3}{4} \pi\) rads is the same as _______ degrees.

# install.packages("pracma")
library(pracma)
value <- rad2deg(rad = 3 * pi / 4)
cat("0.75 rads is the same as",value,"degrees","\n")
## 0.75 rads is the same as 135 degrees

Question 4

A jar contains 40 blue bubblegums, 27 pink bubblegums, and 33 yellow bubblegums. Abigail randomly chooses two bubblegums from the jar without replacement. What is the probability she chooses a blue bubblegum and a pink bubblegum in any order?

# 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
jar <- c(rep("Blue",40),rep("Pink",27),rep("Yellow",33))
counter <- 0
N <- 1e5
for (i in 1:N) {
  pick <- sample(x = jar,size = 2,replace = F)
  if (all(c("Blue","Pink") %in% pick)) {
    counter <- counter + 1
  }
}
probability <- counter / N
cat("The probability she chooses a blue bubblegum and a pink bubblegum in any order is:",probability,"\n")
## The probability she chooses a blue bubblegum and a pink bubblegum in any order is: 0.2186

Question 5

Solve and graph the following definite integral below.

\[\int_{1}^{3} 2x \space dx\]

# install.packages("tidyverse")
library(tidyverse)
f <- function(x) {
  2 * x
}
result <- integrate(f = f,lower = 1,upper = 3)$value
x_values <- seq(0,4,length.out = 500)
y_values <- f(x_values)
q5_data <- data.frame(x = x_values,y = y_values)
ggplot(q5_data,aes(x = x,y = y)) +
  geom_line(col = "black",lwd = 1.25) +
  geom_ribbon(data = subset(q5_data,x >= 1 & x <= 3),
              aes(ymin = 0,ymax = y),
              fill = "brown") +
  labs(title = "Graph of f(x) = 2x",
       caption = paste("Area between x = 1 and x = 3 is:",result),
       x = "x",
       y = "y") +
  theme_gray()