Question 1

Put \([32.06,3.26,20.36,23.6]\) in order from least to greatest.

# 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 <- data.frame(Number = c(32.06,3.26,20.36,23.6))
q1_data %>%
  arrange(Number) # arrange(): ascending order
##   Number
## 1   3.26
## 2  20.36
## 3  23.60
## 4  32.06

Question 2

Solve the system of equations.

\[2x + 7y = -4 \\ -3x + 2y = 31\]

q2_data <- data.frame(X = c(2,-3),
                      Y = c(7,2),
                      Constants = c(-4,31))
q2_model <- lm(Constants ~ . - 1,data = q2_data) # ".": includes all other variables minus response variable, -1 to exclude intercept
coef(q2_model)
##  X  Y 
## -9  2

Question 3

Differentiate \(f(x) = \cos(x)\).

# install.packages("Deriv")
library(Deriv)
f <- function(x) {
  cos(x)
}
f_prime <- Deriv(f)
f_prime
## function (x) 
## -sin(x)