Question 1

Write 917 in words.

# install.packages("english")
library(english)
## Warning: package 'english' was built under R version 4.5.2
words(917)
## [1] "nine hundred seventeen"

Question 2

Write 8059 in words.

# install.packages("english")
library(english)
words(8059)
## [1] "eight thousand fifty-nine"

Question 3

Given the \((x,y)\) data below, create the associated polygon.

# 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(X = c(-5,-5,4,7,4),
                      Y = c(-2,6,6,3,-2))
ggplot(q3_data,aes(x = X,y = Y)) +
  geom_polygon(fill = "steelblue",color = "black",lwd = 1.25) +
  geom_point(size = 3) +
  coord_equal() +
  theme_gray()

Question 4

Convert \(270^{\circ}\) to radians.

# install.packages("pracma")
library(pracma)
## 
## Attaching package: 'pracma'
## The following object is masked from 'package:purrr':
## 
##     cross
value <- deg2rad(deg = 270)
cat("270 degrees =",value,"radians","\n")
## 270 degrees = 4.712389 radians

Question 5

Twenty students in a class sat a math test. The results are recorded in groups as follows. Use the midpoints of the groups to estimate the mean mark.

# install.packages("tidyverse")
library(tidyverse)
q5_data <- data.frame(Mark = c("10-19","20-29","30-39","40-49","50-59","60-69","70-79","80-89"),
                      Number = c(1,3,2,5,2,4,2,1))
mean_mark <- q5_data %>%
  separate(Mark,into = c("Lower","Upper"),sep = "-",convert = T) %>%
  mutate(Midpoint = (Lower + Upper) / 2) %>%
  summarise(EstMean = sum(Midpoint * Number) / sum(Number)) %>%
  pull(EstMean)
cat("The mean mark is:",mean_mark,"\n")
## The mean mark is: 49

Question 6

Find the coordinates of the point of intersection of the straight line \(f(x) = 5x - 3\) and the parabola \(g(x) = x^2 + 3x - 2\).

# install.packages("tidyverse")
library(tidyverse)
f <- function(x) {
  5 * x - 3
}
g <- function(x) {
  x^2 + 3 * x - 2
}
x_values <- seq(-10,10,length.out = 500)
f_values <- f(x_values)
g_values <- g(x_values)
q6_data <- data.frame(x = x_values,f = f_values,g = g_values)
intersection <- q6_data %>%
  mutate(Difference = abs(f - g)) %>%
  slice_min(Difference,n = 1)
ggplot(q6_data,aes(x = x)) +
  geom_line(aes(y = f,col = "f(x) = 5x - 3"),lwd = 1.25) +
  geom_line(aes(y = g,col = "g(x) = x^2 + 3x - 2"),lwd = 1.25) +
  scale_color_manual(values = c("f(x) = 5x - 3" = "blue",
                                "g(x) = x^2 + 3x - 2" = "red")) +
  labs(title = "Graph of f(x) and g(x)",
       caption = paste("The intersection is:",round(intersection,4)),
       x = "x",
       y = "y",
       color = "Functions") +
  theme_gray()

Question 7

What is \(\int 3x^2 \cos(x^3) 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
## The following object is masked from 'package:english':
## 
##     ordinal
## 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
h <- makeFun(3 * x^2 * cos(x^3) ~ x)
anti_h <- antiD(h(x) ~ x)
anti_h
## function (x, C = 0) 
## {
##     F <- makeF(3 * x^2 * cos(x^3))
##     evalFun(F, x = x, .const = C)
## }
## <environment: 0x00000202ee0aa120>