Problem 1

x<- 1.1
a<-2.2
b<-3.3

#part a 

z<- x^(a^b)
print(z)
## [1] 3.61714
#part b 

z<-(x^a)^b
print(z)
## [1] 1.997611
#part c

z<-(3*x^3)+(2*x^2)+1
print(z)
## [1] 7.413

Problem 2

#first vector
my_vec<-c(seq(1,8),seq(7,1))    
print(my_vec)
##  [1] 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
#second vector
my_vec2<-c(1:5)
rep(x=my_vec2,times=my_vec2)
##  [1] 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
#third vector 
my_vec3<-c(5:1)
my_vec<-c(1:5)
rep(x=my_vec3, times=my_vec)
##  [1] 5 4 4 3 3 3 2 2 2 2 1 1 1 1 1

Problem 3

z<-runif(2)
print(z)
## [1] 0.7808661 0.5826711
x<-z[1]
y<-z[2]
print(x)
## [1] 0.7808661
print(y)
## [1] 0.5826711
r<-sqrt(x^2+y^2)
print(r)
## [1] 0.9742984
theta<-asin(y/r)
print(theta)
## [1] 0.6410555
polar<-c(r,theta)
print(polar)
## [1] 0.9742984 0.6410555

Problem 4

queue <- c("sheep", "fox", "owl", "ant")
print(queue)
## [1] "sheep" "fox"   "owl"   "ant"
#a
queue<-c(queue,'serpent')
print(queue)
## [1] "sheep"   "fox"     "owl"     "ant"     "serpent"
#b
queue<-queue[-c(1)]
print(queue)
## [1] "fox"     "owl"     "ant"     "serpent"
#c
queue<-c('donkey', queue)
print(queue)
## [1] "donkey"  "fox"     "owl"     "ant"     "serpent"
#d
queue<-queue[-c(5)]
print(queue)
## [1] "donkey" "fox"    "owl"    "ant"
#e
queue<-queue[-c(3)]
print(queue)
## [1] "donkey" "fox"    "ant"
#f
which(queue=='ant')
## [1] 3
queue<-c(queue[1:2], 'aphid',queue[3])
print(queue)
## [1] "donkey" "fox"    "aphid"  "ant"
#g
which(queue=='aphid')
## [1] 3

Problem 5

z<-seq(1:100)
z[z %% 2 !=0 & z %% 3 !=0 & z %% 7 != 0]
##  [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