PHY- 100 Assignment
Assignment 1: Basic matrix manipulation
1. With x = 5 and y = 2, compute the following quantities:
(a) u = x + y
(b) v = xy
x
(c) w = y
4(y5)
(d) 3x6
(e) z = w3
x5
(f) t = (x5 1)
(g) w = 2(sin(x))/5
(h) p = ex1
(i) u = 2 + cos(2x)
(j) m = x + 4 + sin(0.2) + e2
2. Given a following 4 x 3 matrix
1 2 3 4
A = 5 6 7 8
9 10 11 12
perform the following operations:
(a) Extract the 3rd column of matrix A and store it in vector B.
(b) Extract the 1st and 3rd columns of matrix A and store them in matrix C.
(c) Add the 1st and 3rd rows of matrix A together and store the result in vector D
(d) Change the value in the 2nd row and 3rd column of A to -7 (instead of +7) and
call the result AA (do not destroy/change the original A matrix).
(e) Create a matrix that contains rows 1 and 3 from A, the second row of AA, and
the result of step (c). The resultant 4x4 matrix should be
1 2 3 4
9 10 11 12
BB =
5 6 7 8
10 12 14 16
1
PHY- 100 Assignment
3. Find a short Matlab expression to build the matrix:
1 2 3 4 5 6 7
A = 9 7 5 3 1 1 3
4 8 16 32 64 128 256
4. Given two matrices,
5 6 9 4
3 4 3 8
Try the following and ensure you can follow what is happening.
A + 5, A + B, A - B, A * B, A2 , A
5. Given the matrix A,
3 4 5
A = 9 7 3
4 8 12
Determine the transpose AT of the matrix A.
(a) Calculate AAT and check whether it is symmetric with C = A * B
(b) Calculate AT A and compare your answer with C
(c) Calculate 3A + 5B3
6. Given the equations,
x1 + 2x2 = 5
3x1 + 4x2 = 6
Set the equations for the following form:
Ax = B
Solve the equations to find x1 and x2 .