1. Assigned variables x, a, and b using <-, and then assigned z values based on each given expression
x <- 1.1
a <- 2.2
b <- 3.3
  1. 3.61714
z <- x^(a^b)
print(z) # [1] 3.61714
  1. 1.997611
z <- (x^a)^b
print(z) # [1] 1.997611
  1. 7.413
z <- 3*x^3 + 2*x^2 + 1
print(z) # [1] 7.413
    1. (1 2 3 4 5 6 7 8 7 6 5 4 3 2 1)
a <- seq(1:8) # assigned a sequence of 1-8 to vector a
b <- rep(7:1) # assigned a singly repeating patter of 7-1 descending to vector b
c <- c(a,b) # concatenated vectors a and b and assigned them to vector c, our desired output
print(c)
  1. (1 2 2 3 3 3 4 4 4 4 5 5 5 5 5)
rep(1:5, c(1,2,3,4,5)) # repeated integers 1-5 respectively once, twice, thrice, four times, and five times
  1. (5 4 4 3 3 3 2 2 2 2 1 1 1 1 1)
rep(5:1, c(1,2,3,4,5)) # repeated integers 5-1 descending, again respectively once, twice, thrice, four times, and five times
  1. (1.094789, 0.7340976)
a <- runif(2) # created a vector a with two random uniform numbers
x <- a[1] # 0.813 # designated the first random number as x
y <- a[2] # 0.733 # designated the second random number as y
r <- sqrt(x^2 + y^2) # assigned r the value of the line that would connect x and y
print(r) # [1] 1.094789
theta <- atan(y/x) # [1] 0.7340976 # found theta using given formula for converting Cartesian to polar coordinates
# the polar coordinates are then (r, theta)
queue <- c("sheep", "fox", "owl", "ant") # starting lineup
queue <- append(queue, "serpent") # serpent gets in line
queue <- queue[-1] # sheep leaves line
queue <- c("donkey",queue) # donkey gets in line at front
queue <- queue[-5] # serpent leaves line
queue <- queue[-3] # owl leaves line
queue <- append(queue, "aphid", after = 2) # aphid gets in line before ant
print(queue) #[1] "donkey" "fox"    "aphid"  "ant" ; aphid is third in line
x <- (1:100) # created a vector x with integers 1-100
x <- which(x%%2 & x%%3 & x%%7 != 0) # redefine vector excluding values that are not (!= 0) divisible by (%%) 2, 3, and (&) 7
print(x) # (1, 5, 11, 13, 17, 19, 23, 25, 29, 31, 37, 41, 43, 47, 53, 55, 59, 61, 65, 67, 71, 73, 79, 83, 85, 89, 95, 97)