Evaluate the following limit.
\[\lim_{x \to 0} \frac{\sin(x) - x \cos(x)}{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 <- (sin(x) - x * cos(x)) / (x^3)
result <- lim(f,x,0)
result
## y: 1/3
There are 12 marbles in a bag: 3 orange, 4 green, 3 blue, and 2 red. You mix them up and choose one marble from the bag without looking. Which color marble are you least likely to choose? Use a Monte Carlo simulation to aid you in this problem.
marble_bag <- c(rep("Orange",3),rep("Green",4),rep("Blue",3),rep("Red",2))
N <- 1e6 # 1 million trials
simulation <- sample(x = marble_bag,size = N,replace = T)
probabilities <- prop.table(table(simulation))
probabilities
## simulation
## Blue Green Orange Red
## 0.250247 0.332920 0.250166 0.166667
Which of the following products is odd?
A. \(23 \times 25 \times 24\)
B. \(23 \times 25 \times 27\)
C. \(23 \times 25 \times 28\)
D. \(22 \times 24 \times 28\)
# 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()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
q3_data <- data.frame(Choice = c("A","B","C","D"),
Product = c(23 * 25 * 24,23 * 25 * 27,23 * 25 * 28,22 * 24 * 28))
answer <- q3_data %>%
mutate(Is_Odd = ifelse(test = Product %% 2 == 1,yes = "Odd",no = "Even")) %>%
filter(Is_Odd == "Odd") %>%
pull(Choice)
cat("Choice",answer,"is an odd number.","\n")
## Choice B is an odd number.
A company that makes electronic components claims that they last for 5000 hours. Sixteen components were randomly selected and tested to see how long they lasted. The times (to the nearest hour) that they lasted were: \([5005,4976,4961,4953,4916,4954,4968,5085,4840,4901,4967,4854,4880,4943,4998,5073]\). Assuming that the times are a random sample from a Normal distribution with population mean \(\mu\), carry out a one-tailed t-test at the 1% level of significance using the following null and alternative hypotheses: \(H_0 : \mu = 5000\), \(H_1 : \mu < 5000\).
sixteen_components <- c(5005,4976,4961,4953,4916,4954,4968,5085,4840,4901,4967,4854,4880,4943,4998,5073)
t.test(sixteen_components,mu = 5000,conf.level = 0.01,alternative = "less")
##
## One Sample t-test
##
## data: sixteen_components
## t = -2.6646, df = 15, p-value = 0.008835
## alternative hypothesis: true mean is less than 5000
## 1 percent confidence interval:
## -Inf 4910.307
## sample estimates:
## mean of x
## 4954.625
Solve the following indefinite integral.
\[\int (3x - 1)(3x + 1) 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
g <- makeFun((3 * x - 1) * (3 * x + 1) ~ x)
anti_g <- antiD(g(x) ~ x)
anti_g
## function (x, C = 0)
## 3 * x^3 - x + C