ilExercise 2.1
Consider the system of equations
2X1 + 1×2 + x3 = 1
1×1 + 0x2 + 3×3 = 2
-3X1 + 2X2-7X3 = 3
d. Solve it by hand,
Convert this system of equations into a matrix equation of the form Cx
and record your solution in your document.
a. Enter the matrix C and the column vector d into MATLAB, and use the command
>> X
Cid
to check your solution.
b. We would expect to get the column vector d in MATLAB if we ran the command C*X, right?
In other words, C*x-d should be zero. Enter this expression into MATLAB:
>> C*X-d
Include the input and output.
Exercise 2.2
Consider the system of equations
-10X1 + 5×2 = 0
6X1 – 3×2 = 0
As you did in the previous exercise, enter the corresponding matrix C and column vector d into
MATLAB. Then type in
>> X =
Cid
Note the strange output. Include it in your write-up. Now go ahead and solve this system by
hand. How many free variables do you have in your solution? Based on your answer, can you
explain why you got the error message when trying to use the command x C\d?
=
Exercise 2.3
while
Consider the homogeneous system of equations
X1 – 3×2 + 2×3 = 0
-2X1 + 6×2 – 4×3 = 0
4×1 – 12X2 + 8×3 = 0
By using the rref command, write down the general solution to this system of equations. How
many free variables are required?
Wassily Leontief (1906-1999) was a Russian-born American economist who, aside from developing
highly sophisticated economic theories, enjoyed trout fishing, ballet, and fine wines. He won the 1971
Nobel Memorial Prize in Economics for his work in creating mathematical models to describe various
economic phenomena. In the remainder of this lab we will look at a very simple special case of his
work called a closed exchange model. There are two basic assumptions:
Everyone exclusively buys from and sells to the central pool (i.e., there is no outside supply or
demand).
Everything produced is consumed.
With these assumptions and some data about how the goods are consumed, we can compute exactly
what price each good should have for everyone in the community to survive.
To see how this works, let’s suppose there’s a small country town with only five residents: a farmer, a
tailor, a carpenter, a coal miner, and Slacker Bob. The farmer produces food; the tailor, clothes; the
carpenter, housing; the coal miner, energy; and Slacker Bob makes moonshine, half of which he drinks
himself. The following table lists what fraction of each good our five residents consume:
Food
Clothes
Housing Energy Alcohol
Farmer
0.25
0.15
0.25
0.18
0.20
Tailor
0.17
0.28
0.18
0.17
0.10
0.22
0.19
0.22
0.22
0.10
Carpenter
Miner
0.20
0.15
0.20
0.28
0.15
Slacker Bob
0.16
0.23
0.15
0.15
0.45
So for example, the carpenter consumes 22% of all food, 19% of all clothes, 22% of all housing, 22%
of all energy, and 10% of all the moonshine.
Exercise 2.4
The columns in this table all add up to 1. Explain why.
Now, let f, t, c, m, and b denote the incomes of the farmer, tailor, carpenter, miner, and Bob,
respectively. Note that each of these quantities represents not only the gross incomes of each of our
citizens but also the total cost of the goods they sell. So for example, f is the farmer’s income and also
is the cost of all the food. If the farmer produces $100 worth of food, then his income will also be
$100, since all of this food gets purchased and all the revenue goes to the farmer.
We want to price the goods so that everyone earns enough money to pay for all the goods they
consume. To do that, we need to satisfy the following five equations:
0.25f + 0.15t + 0.250 + 0.18m + 0.20b =f
0.17€ + 0.28t + 0.180 + 0.17m + 0. 10b = t
0.22f + 0.19+ 0.220 + 0.22m + 0.10b = 0
0.20f + 0.15t + 0.200 + 0.28m + 0.15b = m
0.16f + 0.234 + 0.150 + 0.15m + 0.45b = b
Exercise 2.5
Explain where this system of equations came from and what it means. (What do the left-hand
side and the right-hand side of each equation represent?)
Let’s denote the column vector (f, t, c, m, b) by p. Let C be the coefficient matrix of the above system.
We can now rewrite that system as Cp = p, or equivalently,
Cp – p = Cp – Ip = (C – 1)p = 0
where I is the 5×5 identity matrix.
Exercise 2.6
Enter the matrices C and I into MATLAB.
=
>>
C [0.25 0.15 0.25 0.18 0.20;
0.17 0.28 0.18 0.17 0.10;
0.22 0.19 0.22 0.22 0.10;
0.20 0.15 0.20 0.28 0.15;
0.16 0.23 0.15 0.15 0.45]
>> I
=
eye (5)
The command eye(n) used here creates an nxn matrix with ones on the diagonal and zeros
elsewhere.
a. Use MATLAB to row-reduce the augmented matrix [C -1|0], and write down the general
solution to (C – 1)p = 0.
b. What are highest- and lowest-priced commodities in this model community? List the
inhabitants in order of income, from lowest to highest. If our friend Bob sells $40,000 in
moonshine per year, what are the gross incomes for the rest of the inhabitants?
Exercise 2.7
Suppose that we have five websites: A, B, C, D, and E. Let’s also suppose that the links
between the sites are depicted in the graph below:
A
E
B
D
С
Here, the arrow pointing from C to D means that there is a hyperlink on site C that takes you to
site D. For small sets of objects, graphs like this one are a convenient way to depict
connections.
a. Create a linking matrix L containing the information of which site links to which, just as we
did in the popularity example. Remember to normalize, and be sure that your input is exact.
(For example, make sure you enter 1/3 instead of 0.3333—this is important for the next part
of this exercise, since our columns must sum to 1.) Include all input and output from
MATLAB.
b. Use the rref command to find all solutions x to the matrix equation (L – 1)X = 0. Include all
input and output from MATLAB. If you get an error message, be sure to double-check your
answer for the first part of this exercise.
c. Which website has the highest PageRank? Explain your answer, especially in light of any
negative numbers that may have appeared in your solutions. List the remaining websites in
decreasing PageRank order.
Icon
Item
Comments
Commands entered You should copy relevant input and output from MATLAB
in MATLAB & and paste it into your Word document. You need only
resulting output include commands that worked.
Plots & graphs
Include all graphs generated in an exercise unless the
problem specifically tells you which/how many to include.
Answer questions with at least one or two complete
Full sentence
sentences. Even if you’re stuck, write down any
response
reasoning or ideas you’ve had.
Do scratch work without using MATLAB. Record this
Requires manual
work in your Word document, either by typing it or
work
scanning it.
Exercise 1.3:
>> z= 73 sin(pi/2)-(25-5*exp(2+sin(pi/3))
z= 73 sin(pi/2)-(25-5*exp(2+sin(pi/3))
个
Invalid expression. Check for missing multiplication operator, missing
or unbalanced delimiters, or other syntax error. To construct
matrices, use brackets instead of parentheses.
>> z= 73*sin(pi/2)-(25-5*exp((2+sin(pi/3))))
Z=
135.8353
Exercise 1.4:
syms st
>> diff (log(2+2*s-sin(t)),t)
ans
-cos(t)/(2*s – sin(t) + 2)
syms st
>> diff(log(2+2*s-sin(t)),s)
ans =
2/(2*s – sin(t) + 2)
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more