SECOND PAPER APPLIED LINEAR ALGEBRA ASSIGNMENT
QUESTION 1 -
1. (a) How would you write the matrix in MAtlab/Octave?
(b) Give the Matlab/Octave command to find the transpose of A.
(c) Give the command to find the entry of A in the second row and second column.
2. Set up any 3 x 3 matrix and call it A. Then write some Matlab/Octave command-line statements to perform the following operations.
(a) interchange columns 2 and 3
(b) add a fourth column (of 0 s)
(c) remove the second column
3. We can draw the Mexican hat using the following equation
z = sin(r)/r, where
r = √(x2+y2) + ε, and ε = 2.2204 x 10-16
Write a Matlab/Octave code that solves for z and plot z in the internal -8 < x < 8, -8 < y < 8.
Hint: Plot using the meshgrid function with the grid width of 0.5.
4. Write a Matlab/Octave code that draws a graph of the population of the United States from 1790 to 2000, using the (logistic) model
P(t) = 197273000/1 + e-0.03134(t-1913.25),
where t is the date in sears. The actual data (in 1000s) for every decade limn 1790 to 1950 is as follows:
Year
|
Data
|
1790
|
3929
|
1800
|
5308
|
1810
|
7240
|
1820
|
9638
|
1830
|
12866
|
1840
|
17069
|
1850
|
23192
|
1860
|
31443
|
1870
|
38558
|
1880
|
50156
|
1890
|
62948
|
1900
|
75995
|
1910
|
91972
|
1920
|
105711
|
1930
|
122775
|
1940
|
131669
|
1950
|
150697
|
Superimpose the data on the graph of P(t).
QUESTION 2 -
2. Suppose we have invested some money that thaws 10% interest per year, compounded annually. We want to know how long it will take for the investment to double. More specifically we want a statement of the account each year until the balance has doubled. Write a Matlab/Octave code that implements and solves this problem
The pseudocode for this problem is as follows
(a) Initialise balance year, interest rate
(b) Display headings
(c) Repeat
Update year and balance according to interest rate
Display year, balance,
Until balance exceeds twice initial balance
(d) Stop
2. The binomial coefficient is widely used in Mathematics and Statistics. It is defined as the number of ways of choosing r objects out, of n without regard to order and is given by
Write a Matlab/Octave code that computes the binomial coefficient when n = 10 and r = 3.
QUESTION 3 -
1. (a) Write an Octave/Matlab code that evaluates
1∫3 1/(1 + v)1.8 dv, where v is taken to be the 0.3 after the integration.
(b) Calculate the average slope of a function in (a) above over an interval a < x < b defined as f(b) - f(a)/b-a, where a = 1 and b = 3.
2. Use Octave to draw the following graphs
(i) f(x) = x sin (x) , -3 ≤ x ≤ 8,
(ii) f(x)= cos (x2) , 0 ≤ x ≤ 5
3. 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 contom map.
QUESTION 4 -
1. 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
(a) Write Octave/Matlab commands that can be used to capture A and B into the computer memory.
(b) Write Octave/Matlab command(s) that replaces the ith column of A with B.
(c) Express the ratio B/A in Octave/Matlab using \ and /.
2. Consider the system of equations
3x1 + 4x2 + 5x3 = 4
6x1 + 2x2 + 3x3 = 7
x1 + 3x2 + 3x3 = 1
(a) Solve the system by wilting an Octave/Matlab code using the Gauss-seidal iterative method.
(b) Find the exact solution by Gaussian elimination i.e., by Analytic means and by using either Octave or Matlab.