Starting from:

$24.99

MAST90104 Lab 1 Solution

Week 1 Workshop/Lab
Workshop questions
1. Show that XTX is a symmetric matrix.
2. (a) Let

be a nonsingular 2 × 2 matrix. Show by direct multiplication that
.
(b) Find the inverse of
3. Let
and
(a) Find the product AB (b) Does BA exist?
(c) Can we calculate BTAT ? If so, what is it?
4. Let x and y
(a) What is the norm of x ?
(b) Are x and y orthogonal ?
5. Is orthogonal? If not, what value of c makes the matrix cX orthogonal? 6. For the following matrices, find the eigenvalues and eigenvectors

1
Practical questions
Open RStudio on your computer. Set the working directory (using setwd()). Open a new .R file
The following are taken from Chapter 2 of spuRs (Introduction to Scientific Programming and Simulation Using R).
1. Give R assignment statements that set the variable z to
(a) xab
(b) (xa)b
(c) 3x3 + 2x2 + 6x + 1 (try to minimise the number of operations required)
(d) the second-to-last digit of x before the decimal point (hint: use floor(x) and/or %%) (e) z + 1
2. Give R expressions that return the following matrices and vectors
(a) (1,2,3,4,5,6,7,8,7,6,5,4,3,2,1)
(b) (1,2,2,3,3,3,4,4,4,4,5,5,5,5,5)
 0 1 1 
(c)  1 0 1  1 1 0
 0 2 3 
(d)  0 5 0 
7 0 0
3. Use R to produce a vector containing all integers from 1 to 100 that are not divisible by 2, 3, or 7.
4. Which of the following assignments will be successful? What will the vectors x, y, and z look like at each stage?
rm(list = ls()) x <- 1 x[3] <- 3 y <- c() y[2] <- 2 y[3] <- y[1] y[2] <- y[4] z[1] <- 0
5. Build a 10 × 10 identity matrix. Then make all the non-zero elements 5. Do this latter step in at least two different ways.
2

More products