Question 1

An average rate is given by the limit below. Evaluate it.

\[\lim_{x \to 3} \frac{2x^2 - 18}{x - 3}\]

# install.packages("Ryacas")
library(Ryacas)
## Warning: package 'Ryacas' was built under R version 4.5.2
## 
## Attaching package: 'Ryacas'
## The following object is masked from 'package:stats':
## 
##     integrate
## The following objects are masked from 'package:base':
## 
##     %*%, det, diag, diag<-, lower.tri, upper.tri
x <- ysym("x")
f <- (2 * x^2 - 18) / (x - 3)
result <- lim(f,x,3)
result
## y: 12

Question 2

Consider the set of numbers \(\lbrace 5,3,2,6,8,7,1 \rbrace\). What is the smallest seven-digit number you can make with these numbers?

numbers <- c(5,3,2,6,8,7,1)
sorted_digits <- sort(x = numbers,decreasing = F) # decreasing is false: ascending order
smallest_number <- as.numeric(paste(sorted_digits,collapse = "")) # single number as a string, then convert to a number
cat("The smallest number is:",smallest_number,"\n")
## The smallest number is: 1235678

Question 3

##        Month Number
## 1    January    130
## 2   February    120
## 3      March     65
## 4      April     80
## 5        May     70
## 6       June     10
## 7       July      5
## 8     August     15
## 9  September     20
## 10   October     30
## 11  November     85
## 12  December     50

Consider the data above. Please compute the descriptive statistics and graph the data.

A. Compute the descriptive statistics.

# install.packages("summarytools")
library(summarytools)
q3_data <- data.frame(Month = month.name,
                      Number = c(130,120,65,80,70,10,5,15,20,30,85,50))
descr(q3_data$Number)
## Descriptive Statistics  
## q3_data$Number  
## N: 12  
## 
##                     Number
## ----------------- --------
##              Mean    56.67
##           Std.Dev    42.28
##               Min     5.00
##                Q1    17.50
##            Median    57.50
##                Q3    82.50
##               Max   130.00
##               MAD    48.18
##               IQR    62.50
##                CV     0.75
##          Skewness     0.34
##       SE.Skewness     0.64
##          Kurtosis    -1.35
##           N.Valid    12.00
##                 N    12.00
##         Pct.Valid   100.00

B. Graph the data.

# 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()
## ✖ purrr::simplify() masks Ryacas::simplify()
## ✖ tibble::view()    masks summarytools::view()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
ggplot(q3_data,aes(x = factor(Month,levels = month.name),y = Number)) +
  geom_col() +
  labs(title = "Rainfall of a Village",
       x = "Month",
       y = "Amount of Rainfall (mm)") +
  theme_gray() +
  theme(axis.text.x = element_text(angle = 45,hjust = 1))