If \(f(x) = \sin(x) \ln(x^2 + 1)\), what is \(f'(x)\)?
# install.packages("Deriv")
library(Deriv)
f <- function(x) {
sin(x) * log(x^2 + 1)
}
f_prime <- Deriv(f)
f_prime
## function (x)
## {
## .e1 <- x^2
## 2 * (x * sin(x)/(1 + .e1)) + cos(x) * log1p(.e1)
## }
Which one of the following four decimal numbers is the second least?
A. 386.09
B. 38.691
C. 389.06
D. 390.618
# 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
q2_data <- data.frame(Choice = LETTERS[1:4],
Value = c(386.09,38.691,389.06,390.618))
correct_answer <- q2_data %>%
arrange(Value) %>%
slice(2)
correct_answer
## Choice Value
## 1 A 386.09
Find the roots and graph \(g(x) = x^2 - 11x + 24\).
# install.packages(c("rootSolve","tidyverse"))
library(rootSolve)
library(tidyverse)
g <- function(x) {
x^2 - 11 * x + 24
}
roots <- uniroot.all(g,c(-10,10))
for (x in seq_along(roots)) {
cat("Root",x,":",roots[x],"\n")
}
## Root 1 : 3
## Root 2 : 8
x_values <- seq(2,9,length.out = 500)
y_values <- g(x_values)
q3_data <- data.frame(x = x_values,y = y_values)
ggplot(q3_data,aes(x = x,y = y)) +
geom_line(col = "black",lwd = 1.25) +
annotate("point",x = roots[1],y = g(roots[1]),col = "blue",size = 5) +
annotate("point",x = roots[2],y = g(roots[2]),col = "blue",size = 5) +
labs(title = "Graph of g(x) = x^2 - 11x + 24",
caption = paste("Roots:",roots[1],"and",roots[2]),
x = "x",
y = "y") +
theme_gray()
What is \(\int \frac{4}{1 + 9x^2} \space 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
h <- makeFun(4 / (1 + 9 * x^2) ~ x)
anti_h <- antiD(h(x) ~ x)
anti_h
## function (x, C = 0)
## (4 * atan(3 * x))/3 + C