APPLIED LINEAR ALGEBRA ASSIGNMENT
QUESTION 1 -
1. An amount of money A, invested over a period of n years with an annual interest rate r, grows by an amount A (1 + r)n. Calculate the final balances for investments of R750, R1000, R3000, R5000 and R11999 over 10 years with an interest rate of 9%.
2. Suppose vectors a and b are defined a S follows
a = [2 -1 5 0]
b = [3 2 -1 4]
Evaluate by hand the vector C in the following statements
(a) C = a - b,
(b) C = b + a, -3,
(c) C=2* a + a ^b,
(d) C = b /a,
(e) C = b a
3. Given the following algorithm, write an Octave/Matlab code of the algorithm
1 Initialize a
2 Initialize x to a/2
3 Repeat 6 times (Say)
Replace x by (x + a/x)/2
Display x
4 Stop
4. Decide which of the following numbers are not acceptable in Matlab/Octave, and state why
(a) 9.87
(b) 3.57*e2
(c) 3.57e2.1
(d) 33.57e-2
5. Write a program to calculate x, where
x = -b ± √(b2 - 4ac)/2a
and a = 2, b = -10, c = 12
QUESTION 2 -
1. A formula to find a numerical approximation to the second derivative of a function f (x) is
f''(x) = d2f/dx2 = f (x + h) - 2f (x) + f (x - h)/h2
with the approximation being better and better as h → 0 Write a function file deriv2 m that implements the formula. The inputs should be the function to be differentiated (remember the function handle construct @, the value of x, and the value of h) Use your code to estimate the second derivative of sin (x) at x = π/4 with h = 10-1.
2. Write the code to evaluate the following series n=1∑∞ un in which un is not known explicitly but is given in terms of a recurrence relation. You should stop the summation when |un| < 10-8
un+1 = (un-1)2 + (un)2 with u1 = 0.5, u2 = 0.6
3. In the following, R can take any value between 5 and 6. Write a code to calculate a value of I for R = 5.00, 5.01, 5.02, ,5.99 and 6 I is defined as
I = 30/R√(R2+15π2)
QUESTION 3 -
1. Define the 100 x 100 square matrix A and the column vector b by
Aij = Iij + 1/(i-j)2+1, bi = 1 + 2/i, 1 ≤ i, j ≤ 100
where Iij is the 100 x 100 identity matrix (i.e., 1 on the main diagonal and 0 everywhere else).
Write the code to solve Ax = b for x using both the Gauss-Seidel method and the A\b construct.
2. The Hilbert matrix is a square n x n matrix defined by
Hijn = 1/i + j - 1
Define bn to be a column vector of dimension n, and with each element 1. Construct bn and then solve write the code that solve for xn, Hnxn = bn.
3. Modify the power method so that it finds the smallest eigenvalue and corresponding eigenvector. Do this by evaluating
xn+1 = A-1xn
rather than xn+1 = Axn, When convergence occurs, it is to the eigenvector corresponding to the inverse of the smallest eigenvalue.
QUESTION 4 -
1. Write the code find the maximum value, as well as the point at which the maximum occurs, of
L= x1 + 2x2 + 3x3
subject to the constraints
x1 + x2 + 2x3 ≤ 8
3x1 + 3x2 + x3 ≤ 9
x1, x2, x3 ≥ 0
2. Write the code to find the minimum value, as well as the point at which the minimum occurs, of
L = -4x1 - 5x2 + 2x3
subject to the constraints
-x1 + 2x2 + 2x3 ≤ 10
2x1 + 4x2 + 5x3 ≤ 25
x1, x2, x3 ≥ 0