Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Following data: set.seed(1128719) data=matrix(rnorm(20)), byrow=T, ncol=2) Required in R/RStudio programming. 5. A very useful feature in R is the ability to pass a function name
Following data:
set.seed(1128719)
data=matrix(rnorm(20)), byrow=T, ncol=2)
Required in R/RStudio programming.
5. A very useful feature in R is the ability to pass a function name as an argument. Here is an example, where 2 is added to the value of a function, for three different functions $exp(x)$, $log(x)$, and $sin(x)$, at selected points $X$. test=function(x,f){ output=f(x+2 return(output) test(0, exp) test(1, log) test(0,sin) test(pi/2,sin) [1] 3 [1] 2 [1] 2 [1] 3 Modify your function from problem 4 so that you pass in the name of the function for which you want to approximate the derivative. Use the same default value for $$, and approximate the derivative of sin(x) at $x=\pi/45, of $log(x)$ at $x=2$, and of $exp(x)$ at $x=1$. 6. Write a function which takes one argument $$ of length 2, and returns the ordered values of $x$. That is, if $x_2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started