APPLIED LINEAR ALGEBRA ASSIGNMENT
QUESTION 1 -
(a) On Matlab/Octave command line, assign values to the variables a and b, for example a = 3, and b = 5, and write statements to find the sum, difference, product, and quotient of a and b
(b) What do the following Matlab/Octave statements mean?
(i) 1 + 1 5
(ii) 1 + [1 5]
(iii) 1 5'
(iv) [1 5']
(c) Given the following vectors
a = [ 2 4 5 ],
b = [ 6 2 2 ],
Calculate -
(i) a.*b,
(ii) a. /b,
(iii) a. ^b,
(d) Given the vector [1 2 3 4 5] Write Matlab/Octave statements that use different vector array operations to produce the following vectors
(i) [2 4 6 8 10]
(ii) [½ 1 3/2 2 5/2]
(iii) [1 ½ 1/3 ¼ 1/5]
(iv) [1 1/22 1/32 1/42 1/52]
QUESTION 2 -
(a) Suppose we have R1000,00 saved in the bank, with interest compounded at the rate of 9% per year. Write a Matlab/Octave code to determine how much your bank balance will be after one year.
(b) Given the following system of equations
3x + 2y - z = 10
-x + 3y + 2z = 5
x - y - z = -1
(i) Write Matlab/Octave code to solve the above system of equations.
(ii) Write the Matlab/Octave code to calculate the residual to the above system of equations.
(c) Provide definitions for the following
(i) Overdetermined system
(ii) Underdetermined system
(iii) Conditioned system
(d) A formula for the population of the USA is
P(t) = P0 - ae-0.02(t-1800)
where t is the date in years. Some actual data is given below
Date Population
1800 5308000
1820 9638000
1840 17069000
1870 38558000
1900 750995000
1930 122775000
1950 150697000
Write a Matlab/Octave code that finds values of P0 and a, and that gives a best fit of the formula to the data. Then plot the graph showing the function P(t) against time t as a continuous line, together with the given data points as discrete points.
QUESTION 3 -
(a) Write an Octave/Matlab code that evaluates
1∫3 dv/1+ v1.8, where
v is taken to be the 0 3 after the integration
(b) Calculate the average slope of the function in (a) above in the interval a < x < b, defined
as f(b) - f(a)/b-a, where a = 1 and b = 3
(c) Use Octave to draw the following graphs
(i) f(x) = x sin (x), -3 ≤ x ≤ 8,
(ii) f (x) = cos (x2) , 0 ≤ x ≤ 5,
(d) Write an Octave/Matlab code that plots the following graph
Z = sin√(x2+y2)/√(x2+y2),
in the range -7 ≤ x ≤ 7, -11 ≤ y ≤ 11, with a contour map.
QUESTION 4 -
(a) Consider the equation
AX = B
where XT = (x1, x2, . . . , xn) and BT = (b1, b2 bn) are 1 x n vectors, and A a n x n matrix.
(i) Write Octave/Matlab commands that can be used to capture A and B into the computer memory.
(ii) Write Octave/Matlab command(s) that replaces the ith column of A with B.
(iii) Express the ratio B/A in Octave/Matlab using \ and /.
(b) Consider the system of equations
3x1 + 4x2 + 5x3 = 4,
6x1 + 2x2 + 3x3 = 7,
x1 + 3x2 + 3x3 = 1
(i) Solve the system by writing an Octave/Matlab code using the Gauss-Seidal iterative method.
(ii) Find the exact, solution by Gaussian elimination i.e., by analytic means and by using either Octave or Matlab.