MATH 18 matlab assignment 2
Math 18 MATLAB Assignment 2
Exercise 2.1 Cx= b x= [ 1.0714 1.2143
1.5714 ]
- My solution is correct.
INPUT: >> x = C\d
OUTPUT: x =
1.0714 1.2143
1.5714
- INPUT: >>C*x-d
OUTPUT: ans =
12.2143 9.2143 8.2143
11.5000 8.5000 7.5000
3.2857 0.2857 -0.7143
Exercise 2.2
INPUT: >> x= [-10 4; 15 -6]
OUTPUT: x =
-10 4
15 -6
INPUT: >> y=[0 0]
OUTPUT: y =
0 0
INPUT: >> h=x/y
OUTPUT: Warning: Rank deficient, rank = 0, tol = 0.000000e+00.
h =
0
0
My solution is the same. The error exists because the augmented matrix, h, is inconsistent because the last column contains a pivot.
Exercise 2.3
INPUT: >> rref ([C d])
OUTPUT: ans =
1 -3 2 0
0 0 0 0
0 0 0 0
There are 2 free variables.
Exercise 2.4
The columns all add up to one because each additive represents a percentage. 1 is 100 % and each row within the additive of 1 represents a factor of that 1. Exercise 2.5
The left-hand side of the equation coefficients are scalars of the variables f, t, c, m, and b. These coefficients represent A in the equation Ax=b. The variables f, t, c, m, and b are within the vector x in Ax=b, their letters represent the Farmer, Tailor, Carpenter, Miner, and Slack Bob respectively. Vector x also represents what these variable produce, Food, Clothes, Housing, Energy, and Alcohol respectively. Matrix A represents the percentage of consumption these variables of vector x represent. The right-hand side of the equation, b, represent the total price of each good of Food, Clothes, Housing, Energy, and Alcohol respectively.
Exercise 2.6
- INPUT: >> x=C-I
INPUT: >> d=[0
0
0
0
0]
INPUT: y= [x d]
OUTPUT: y =
Columns 1 through 4
-0.7500 0.1500 0.2500
0.1800
0.1500 -0.7200 0.1800
0.1700
0.2200 0.1900 -0.7800
0.2200
0.2000 0.1500 0.2000
-0.7200
0.1800 0.2300 0.1500 0.1500
Columns 5 through 6
0.2000 0 0.0500 0 0.1000 0
0.1500 0
-0.5000 0 INPUT : >> rref([y])
OUTPUT:
ans = Columns 1 through 4
1.0000 0 0 0 0 1.0000 0 0
0 0 1.0000 0
0 0 0 1.0000
0 0 0 0
Columns 5 through 6
-0.8025 0
-0.5919 0
-0.7108 0
-0.7520 0
0 0
General Solution: p1=.8025b, p2=.5919b, p3= .7108b, p4=.7520, p5=free
The highest priced commodity is food and the lowest priced
- commodity is clothes. Highest to Lowest Income: Farmer, Miner, Carpenter, Tailor, Slacker
Bob, in which Slacker Bob is a free variable. Slacker Bob has the highest income because the other occupations are just fractions of his income.
If Slacker Bob sells $40,000 a year, the corresponding Gross incomes are true, Farmer=$32100, Tailor=$23676, Carpenter=$28432, and Miner=$30080.
Exercise 2.7
a. INPUT: >> L=[0 1/4 1/4 1/4 1/4; 1/2
0 1/2 0 0; 0 1/2 0 0 1/2; 1/3 0 1/3 0
1/3; 0 0 1 0 0]
OUTPUT:
L =
Columns 1 through 4
0 0.2500 0.2500 0.2500
0.5000 0 0.5000 0
0 0.5000 0 0
0.3333 0 0.3333 0
0 0 1.0000 0
Column 5
0.2500
0
0.5000
0.3333
0
- INPUT: >> j=L-I
OUTPUT: j =
Columns 1 through 3
-1.0000 0.2500 0.2500
0.5000 -1.0000 0.5000
0 0.5000 -1.0000
0.3333 0 0.3333
0 0 1.0000
Columns 4 through 5
0.2500 0.2500
0 0
0 0.5000
-1.0000 0.3333
0 -1.0000
INPUT: f =
0
0
0
0
0
INPUT: >> w= [j f]
OUTPUT: w = Columns 1 through 3
-1.0000 0.2500 0.2500
0.5000 -1.0000 0.5000
- 5000 -1.0000
0.3333 0 0.3333
- 0 0000
Columns 4 through 6
0.2500 0.2500 0
0 0 0
0 0.5000 0
-1.0000 0.3333 0
- -1.0000 0
INPUT: >> rref (w)
OUTPUT:
ans =
- 0 0 0 -1 0
0 1 0 0 -1 0
0 0 1 0 -1 0
0 0 0 1 -1 0
0 0 0 0 0 0
- They all have equal PageRank because they all equal E. E is a free variable.