Question 1

Determine whether or not the series converges or diverges below.

\[\sum_{n = 1}^{\infty} \frac{(-1)^n \ln(n + 1)}{n}\]

total <- 0
series <- function(n) {
  ((-1)^n * log(n + 1)) / n
}
for (x in 1:1e6) {
  total <- total + series(x)
}
total
## [1] -0.3922525

We find that the series does converge to a value of -0.3923.

Question 2

Write 11,561,538 in words.

# install.packages("english")
library(english)
## Warning: package 'english' was built under R version 4.5.2
words(11561538)
## [1] "eleven million five hundred sixty-one thousand five hundred thirty-eight"

Question 3

A two letter code is made by selecting at random two letters from A to Z inclusive. What is the probability the code contains at least one E?

set.seed(1234)
N <- 1e6
letters_vector <- LETTERS
counter <- 0
for (i in 1:N) {
  two_letter_code <- sample(x = letters_vector,size = 2,replace = T)
  if ("E" %in% two_letter_code) {
    counter <- counter + 1
  }
}
probability <- counter / N
cat("The probability of at least one E is:",probability,"\n")
## The probability of at least one E is: 0.075989

Question 4

Find the roots of \(f(x) = 36x^4 - 289x^2 + 400\).

# install.packages("rootSolve")
library(rootSolve)
f <- function(x) {
  36 * x^4 - 289 * x^2 + 400
}
roots <- uniroot.all(f = f,interval = c(-10,10))
for (x in seq_along(roots)) {
  cat("Root",x,":",roots[x],"\n")
}
## Root 1 : -2.499993 
## Root 2 : -1.333326 
## Root 3 : 1.333326 
## Root 4 : 2.499993

Question 5

If \(g(x) = 4x^3\), what is \(g'(x)\)?

# install.packages("Deriv")
library(Deriv)
g <- function(x) {
  4 * x^3
}
g_prime <- Deriv(g)
g_prime
## function (x) 
## 12 * x^2