Problem 6.1.15
This system of equations represents an equilibrium of daily food supply that precisely meets the average daily consumption of a number of species. Because there are fewer equations than unknowns in this system (4 unknowns, 3 equations), there are an infinite number of solutions.
a) There is sufficient food to satisfy the average daily consumption for this case. I used Matlab to compute the supply of food required to satisfy the given average daily consumption and the population of each of the 4 species:
EDU» A=[1 2 0 3 ; 1 0 2 2 ; 0 0 1 1]
A =
1 2
0 3
1 0
2 2
0 0
1 1
EDU» x=[1000;500;350;400]
x =
1000
500
350
400
EDU» b=A*x
b =
3200
2500
750
The result given above [3200 2500 750] is well within the available supply of food [3500 2700 900].
b) From part 'a' above, there is a food surplus of [300 200 150]. Comparing the values of the consumption times x11, x21, and x31 to the food surplus yields:
Consumption X Population =
Supply
A
x =
b
1*x11 = 300
1*x12 = 200 <---
0*x13 = 150
x11, x12, and x13 are all of the sames species so the most that can be added is 200 individuals to species 1.
2*x21 = 300 <---
0*x22 = 200
0*x23 = 150
x21, x22, and x23 are all of the same species so the most that can be added is 150 individuals to species 2.
0*x31 = 300
2*x32 = 200 <---
1*x33 = 150
x31, x32, and x33 are all of the same species so the most that can be added is 100 individuals to species 3.
3*x41 = 300
2*x42 = 200 <---
1*x43 = 150
x41, x42, and x43 are all of the same species so the most that can be added is 100 individuals to species 4.
c) Recalculating in Matlab the food supply consumed with species 1 extinct yielded:
>> x = [0 ; 500 ; 350 ; 400]
x =
0
500
350
400
>> b=A*x
b =
2200
1500
750
This means that a total food surplus of [1300 1200 150] exists.
Using the same method as in part 'b', the individual increase of each of the remaining species due to the extinction of species 1 are as follows:
2*x21 = 1300 <---
0*x22 = 1200
0*x23 = 150
650 individuals can be added to species 2.
0*x31 = 1300
2*x32 = 1200
1*x33 = 150 <---
150 individuals can be added to species 3.
3*x41 = 1300
2*x42 = 1200
1*x43 = 150 <---
150 individuals can be added to species 4
d) Using the same method as in part 'c', the individual increase of each of the remaining species due to the extinction of species 2 are as follows:
1*x11 = 1300
1*x12 = 1200 <---
0*x13 = 150
1200 individuals can be added to species 1.
0*x31 = 1300
2*x32 = 1200
1*x33 = 150
150 individuals can be added to species 3.
3*x41 = 1300
2*x42 = 1200
1*x43 = 150
150 individuals can be added to species 4.
Problem 6.2.9d
GAUSSIAN ELIMINATION WITH SCALED PARTIAL PIVOTING
The reduced system - output by rows:
0.00000000 0.00000000 -4764.89719400
0.00000000 24.08184190 7.21293459
-1.56110000 5.17920000 -1.68550000
Has solution vector:
1.00000000 .50000000 -1.00000000
with 1 row interchange(s)
The rows have been logically re-ordered to:
3 2 1
The solution vector above was found using Algorithm 6.2 in Maple.
**********************************************
I also use Algorithm 6.1 as a comparison in methods:
GAUSSIAN ELIMINATION WITH BACKWARD SUBSTITUTION
The reduced system - output by rows:
3.33300000 15920.00000000 10.33300000 7953.00000000
0.00000000 -10596.62333000 2.72333333 -5301.03500000
0.00000000 0.00000000 5.07190544 -5.07190700
Has solution vector:
1.00000030 .50000000
-1.00000030
with 0 row interchange(s)
**********************************************
Scaled partial pivoting selects the element to be pivoted. The
reason for this is to reduce roundoff error in the solution. As you
can see above, the partial pivoting method is more accurate than backward
substitution. Although the partial pivoting solution was found using
one row interchange, this does not add significantly to the computation
time.
Problem 6.3.11
a) Contribution that a female beetle makes to the population in 2 years = A^2:
0
2.0000 0
0
0 3.0000
0.1667
0
0
Contribution that a female beetle makes to the population in 3 years = A^3:
1 0
0
0 1
0
0 0
1
The matrices above (=A^n) describe the population of the female beetles after n years. The third year yields the identity matrix which when multiply by A again (to calculate the 4th year) will yield the matrix A. This means that the population goes back to the 1st year population after 3 years. This repeats every three years (if you continue to increase n).
b) The above statement is demonstrated when I multiply the matrix A^n by x, which is the population of the female beetle for each of the age groups in the first year.
>> A= [ 0 0 6 ; 0.5 0 0 ; 0 1/3 0]
A =
0
0 6.0000
0.5000
0 0
0
0.3333 0
>> x=[6000 ; 6000; 6000]
x =
6000
6000
6000
>> b=A*x
b =
36000
3000
2000
>> b=A*A*x
b =
12000
18000
1000
>> b=A*A*A*x
b =
6000
6000
6000
As you can see, by the beginning of the 4th year the population is back to 6000 across the board as it was the beginning of the first year.
c) The inverse of A (or A^-1) is calculated below:
>> inv(A)
ans =
0
2.0000 0
0
0 3.0000
0.1667
0 0
This is an interesting result because it equals A^2 calculated above. This means thet A^-1 is equal to the population of the female beetles every 2 years.
Problem 6.5.3a
The strength behind the LU Factorization method lies in its ability to reduce the number of operations needed to find the solution. (that is, once the factorization is determined)
GENERAL LU FACTORIZATION
The diagonal of L consists of all entries = 1.0
Entries of L below/on diagonal and entries of U above/on diagonal
- output by rows in overwrite format:
2.00000000 -1.00000000 1.00000000
-.50000000 2.50000000 3.50000000
4.50000000 1.80000000 -7.80000000
Then using Matlab to find the solution:
>> L=[1 0 0; -0.5 1 0; 4.5 1.8 1]
L =
1.0000
0 0
-0.5000 1.0000
0
4.5000 1.8000
1.0000
>> U=[2 -1 1; 0 2.5 3.5; 0 0 -7.8]
U =
2.0000 -1.0000 1.0000
0
2.5000 3.5000
0
0 -7.8000
>> b=[-1;0;4]
b =
-1
0
4
>> y=b\L
y =
1.0000 0.4235 0.2353
>> x=y/U
x =
0.5000 0.3694 0.1997
The solution above is solved with the diagonal of L equaling 1.
**********************
I also found the solution with the diagonal of U equaling to 1:
GENERAL LU FACTORIZATION
The diagonal of U consists of all entries = 1.0
Entries of L below/on diagonal and entries of U above/on diagonal
- output by rows in overwrite format:
2.00000000 -.50000000 .50000000
-1.00000000 2.50000000 1.40000000
9.00000000 4.50000000 -7.80000000
Then using Matlab:
>> L=[2 0 0;-1 2.5 0;9 4.5 -7.8]
L =
2.0000
0 0
-1.0000 2.5000
0
9.0000 4.5000 -7.8000
>> U=[1 -.5 .5; 0 1 1.4; 0 0 1]
U =
1.0000 -0.5000 0.5000
0
1.0000 1.4000
0
0 1.0000
>> b=[-1;0;4]
b =
-1
0
4
>> y=b\L
y =
2.0000 1.0588 -1.8353
>> x=y/U
x =
2.0000 2.0588 -5.7176
I would expect that the two solutions vectors for x would agree, but
for some reason they do not. I don't quite understand the book's
explanation of this method.
Problem 6.6.6d
CROUT METHOD FOR TRIDIAGONAL LINEAR SYSTEMS
The solution is
-.09357798 1.58715596
-1.16743119 .54128440