Question 1

Put \([9513,9153,1539,1543,3159]\) in ascending 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() ──
## ✖ 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(Numbers = c(9513,9153,1539,1543,3159))
q1_data %>%
  arrange(Numbers) # arrange(): ascending order
##   Numbers
## 1    1539
## 2    1543
## 3    3159
## 4    9153
## 5    9513

Question 2

Make a polygon with the \((x,y)\) data below.

# install.packages("tidyverse")
library(tidyverse)
q2_data <- data.frame(x = c(-3,5,5,8,8,1,1,-3),
                      y = c(-4,-4,3,3,7,7,3,3))
ggplot(q2_data,aes(x = x,y = y)) +
  geom_polygon(fill = "purple") +
  labs(title = "Polygon",
       x = "x",
       y = "y") +
  theme_gray(base_size = 14)

Question 3

Find the cube root of 319 correct to 2 decimal places.

# install.packages("pracma")
library(pracma)
## 
## Attaching package: 'pracma'
## The following object is masked from 'package:purrr':
## 
##     cross
value <- nthroot(x = 319,n = 3) # x = 319 (value),n = 3 (cube root)
cat("The cube root of 319 correct to 2 decimal places is:",round(value,2),"\n")
## The cube root of 319 correct to 2 decimal places is: 6.83

Question 4

What is the following indefinite integral below?

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