x <- 1.1
a <- 2.2
b <- 3.3
#a)
z <- ((x)^a)^b
print(z)
## [1] 1.997611
z <- x^a^b
print(z)
## [1] 3.61714
#(unsure how to interpret, giving both potential responses)
#b)
z <- (x^a)^b
print(z)
## [1] 1.997611
#c)
z <- (3 * x^3) + (2*x^2) + 1
print(z)
## [1] 7.413
#a
z <- c(rep(1:8),rep(7:1))
print(z)
## [1] 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
#b
z <- rep(1:5, 1:5)
z
## [1] 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
#c
z <- rep(5:1, 1:5)
z
## [1] 5 4 4 3 3 3 2 2 2 2 1 1 1 1 1
random_uniform_numbers <- runif(2)
random_uniform_numbers
## [1] 0.5523538 0.2990678
random_number1 <- 0.53610015
random_number2 <- 0.06247857
radius <- sqrt((random_number1^2)+(random_number2^2))
radius
## [1] 0.5397286
theta <- atan(random_number1 / random_number2)
theta
## [1] 1.454777
#x = random_number1 * cos(theta)
#y = random_number1 * sin(theta)
xcoord <- radius * cos(theta)
ycoord <- radius * sin(theta)
xcoord
## [1] 0.06247857
ycoord
## [1] 0.5361001
polarcoords <- c(xcoord,ycoord)
polarcoords
## [1] 0.06247857 0.53610015
Finally, determine the position of the aphid in the line.
#creating the line
queue <- c("sheep", "fox", "owl", "ant")
#adding the serpent to the queue
queue <-append(queue, "serpent")
queue
## [1] "sheep" "fox" "owl" "ant" "serpent"
#removing the sheep from the queue
queue <-c(queue[2:5])
queue
## [1] "fox" "owl" "ant" "serpent"
#adding the donkey to the front of the line
queue <- c("donkey", queue)
queue
## [1] "donkey" "fox" "owl" "ant" "serpent"
#removing the serpent from the queue
queue <- c(queue[1:4])
queue
## [1] "donkey" "fox" "owl" "ant"
#removing the owl from the queue
queue <- c(queue[1],queue[2],queue[4])
queue
## [1] "donkey" "fox" "ant"
#adding the aphid to the front of the line
queue <- c(queue[1:2], "aphid", queue[3])
queue
## [1] "donkey" "fox" "aphid" "ant"
#finding the aphids position in line
aphid_position <- which(queue == "aphid")
print(paste("Aphid Place in Line:", aphid_position))
## [1] "Aphid Place in Line: 3"
#creating initial vector 1:100
integer_vector_100 <- seq(1:100)
#filtering list according to request
not_dividable_237 <- which(! integer_vector_100%%2== 0 & ! integer_vector_100%%3== 0 & ! integer_vector_100%%7==0)
print(not_dividable_237)
## [1] 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
## [26] 89 95 97