1 > x = c(1:10) 2 > y=x^2 The R code above simply creates 2 vectors, x and y, corresponding to values of the function y = x 2 in the domain [1,10]. Use R expressions to write the following: (a) Four...


1 > x = c(1:10)


2 > y=x^2


The R code above simply creates 2 vectors, x and y, corresponding to values of the function y = x 2 in the domain [1,10]. Use R expressions to write the following:


(a) Four plus the square of x.


(b) The difference of y and x.


(c) The sum of all elements in y.


(d) A vector containing the product of each entry of x with the corresponding entry of y.


(e) The first 5 elements of y (use the facts that a range of values can be written as a:b, and you can access elements of a vector with a call such as v[a : b], where a and b are indices).



May 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here