Due date : 30 Dec 2020, 23:59


Objectives


Questions


1 - A dependent function chain is defined as \(h(x)=\frac{log(x)-1}{\sqrt{x}}\), \(g(x)=e^{\sqrt{h(x)}}\) and \(f(x)=sin(g(x))^{cos(g(x))}\). Create a function and solve \(f(x)\) for each x <- 4:250. Print and plot\(f(x)\).

my_fun <- function() { 
  
x <- 4:250

# Fill here

plot(fx)

}

2 - Create a function. Inside;

my_num <- function(n, min, max, threshold) { 
  
# x <- runif(n,min,max)     # You can use runif() function or different function

# big_numbers <-   (you can use this to fidn which values are bigger than threshold: (x > threshold) )

# if

# else

}

3 - Create a function that calculates the sum of each digit of any number (For instance, sum of digits of 385102 is 3 + 8 + 5 + 1 + 2 = 19). While sum is lower than 50, then add 10 to sum in a loop. In every loop, print a warning sentence.

sumofdig <- function(x) { 
  
# You can use strsplit() function
# sum <-

# while ( ) {
#
# print("sum is lower than 50, so I am going to add more 10")
#    
#   }

}

For questions or problems, please use Ninova


I inspired from Ismail SEZEN