Vectors, sequences, and logical operators
(a) Assign the names $\mathrm{x}$ and $\mathrm{y}$ to the values 5 and 7 , respectively. Find $x^y$ and assign the result to $z$. What is the valued stored in $z$ ?
(b) Create the vectors $\mathrm{u}=(1,2,5,4)$ and $\mathrm{v}=(2,2,1,1)$ using the $\mathrm{c}()$ and $\operatorname{scan}()$ functions.
(c) Provide $\mathrm{S}$ code to find which component of $\mathrm{u}$ is equal to 5 .
(d) Provide $\mathrm{S}$ code to give the components of $\mathrm{v}$ greater than or equal to 2.
(e) Find the product $\mathrm{u} \times \mathrm{v}$. How does $\mathrm{S}$ perform the operation?
(f) Explain what $\mathrm{S}$ does when two vectors of unequal length are multiplied together. Specifically, what is $\mathrm{u} \times \mathrm{c}(\mathrm{u}, \mathrm{v})$ ?
(g) Provide $\mathrm{S}$ code to define a sequence from 1 to 10 called $\mathrm{G}$ and subsequently to select the first three components of G.
(h) Use $\mathrm{S}$ to define a sequence from 1 to 30 named $\mathrm{J}$ with an increment of 2 and subsequently to choose the first, third, and eighth values of $\mathrm{J}$.
(i) Calculate the scalar product (dot product) of $q=(3,0,1,6)$ by $r=(1,0,2,4)$.
(j) Define the matrix $\mathbf{X}$ whose rows are the $\mathbf{u}$ and $\mathrm{v}$ vectors from part (b).
(k) Define the matrix $\mathbf{Y}$ whose columns are the $\mathbf{u}$ and $\mathrm{v}$ vectors from part (b).
(l) Find the matrix product of $\mathbf{X}$ by $\mathbf{Y}$ and name it $\mathbf{W}$.
(m) Provide $\mathrm{S}$ code that computes the inverse matrix of $\mathbf{W}$ and the transpose of that inverse.