t = linspace(0, 2*pi, 100);
cla reset; hold on
for r = 21:-1:2
if mod(r,2)
fill(r*cos(t), r*sin(t), k)
else
fill(r*cos(t), r*sin(t), w)
end
end
fill(cos(t), sin(t), r)
axis equal; hold off
20
15
10
5
0
5
10
15
20
20
10
0
10
20
6.
Here are the contents of
U2 =
0.8165
0.4082
0.4082
-0.5774
-0.5774
-0.5774
0.7071
-0.7071
0.0000
0
-1.0000
0
0
0
3.0000
R2 =
2.0000
0
0
We observe that the rst and second columns of U1 are negatives of the corresponding
columns of U2, and the third columns are identical. Finally,
(c)
det(A1)
ans =
92
inv(A1)
ans =
0.4239
0.0543
-0.0978
-0.3696
-0.0217
0.2391
0.4674
-0.1196
-0.1848
det(A2)
ans =
0
The matrix A2 does not have an inverse.
det(A3)
ans =
294
inv(A3)
ans =
0.1837
0
0.1633
0.2857
det(A4)
-0.1531
0.1667
0.0306
-0.0714
-0.
2
2
1/2]
1/2 d - 1/2 a + 1/2 (d - 2 d a + a + 4 b c)
]
- -]
c
]
[1 , 1]
pretty(R4)
[
2
2
1/2
]
[1/2 d + 1/2 a + 1/2 (d - 2 d a + a + 4 b c)
, 0]
[
]
[
2
2
1/2]
[0 , 1/2 d + 1/2 a - 1/2 (d - 2 d a + a + 4 b c)
]
simplify(A4*U4 - U4*R4)
ans =
[ 0, 0]
[ 0, 0
11.
(a)
rank(A1)
ans =
3
rank(A2)
ans =
2
rank(A3)
ans =
4
rank(A4)
ans =
2
MATLAB implicitly assumes that ad bc is not 0 here.
(b)
Only the second one computed is singular.
sin(1/x)
1
0.5
0
0.5
1
0
0.2
0.4
0.6
0.8
x
6.
(a)
syms k n r x z
symsum(k2, k, 0, n)
ans =
1/3*(n+1)3-1/2*(n+1)2+1/6*n+1/6
simplify(ans)
ans =
1/3*n3+1/2*n2+1/6*n
(b)
symsum(rk, k, 0, n)
ans =
r(n+1)/(r-1)-1/(r-1)
1
pretty(ans)
(n + 1)
r
1
- - -r - 1
r - 1
(c)
symsum(xk/factorial(k), k, 0, Inf)
Error using => factorial
N must be a matrix of non-negative integers.
Here are two ways around this difculty.
symsum(xk/gamma(k + 1), k, 0, Inf)
ans =
exp(x)
symsum(xk/sym(k!)
(f)
M5*X0
ans =
x0+31/64*y0
1/32*y0
31/64*y0+z0
M10*X0
ans =
x0+1023/2048*y0
1/1024*y0
1023/2048*y0+z0
(g)
With the suggested alternate model, only the rst three columns of the table are relevant, the transition matrix M becomes M = [1 1/2 0; 0 1/2 1; 0 0
(d)
The average for the ve different 20-year careers is:
(ave1 + ave2 + ave3 + ave4 + ave5)/5
ans =
0.3366
Not bad. In fact if we ran the simulation 100 times and took the average it would be
very close to 0.338.
4.
Our solution and its output is below. F
Not surprisingly, all the amounts are less than what one obtains by investing the original $50,000 all at once. But in this model it matters where you enter the business
cycle. Its clearly best to start your investment program when a recession is in force
function ave = career(n, k)
% This function file computes the batting average for each
% year in a k-year career, assuming n at bats in each year.
% Then it lists the average for each of the years in the
% career, and finally computes a lifetime average.
The results are all the same; you wind up with $72,795 regardless of where you enter
in the cycle, because the product 1j5 (1 + rates(j) is independent of the order in
which you place the factors. If you put the $50,000 in a bank account paying 8%, you
ge
(g)
First, taking the whole bundle at once, after 20 years the $65,000 left after taxes
generates
option1 = 65000*(1 + 0.05/12)(12*20)
option1 =
176321.62
The stash grows to about $176,322. The second option yields
S = 0.8*(100000/240);
option2 = S*(1 + 0
2.
(a)
Consider the status of the bank account on the last day of each month. At the end of
the rst month, the account has M + M J = M (1 + J) dollars. Then at the end
of the second month the account contains [M (1 + J)](1 + J) = M (1 + J)2 dollars.
Simil
months = solve(1 + 0.05/12)n = 2);
years = double(months)/12
years =
13.8918
months = solve(1 + 0.1/12)n = 2);
years = double(months)/12
years =
6.9603
If you double the interest rate, you roughly halve the time required to achieve the
goal.
(e)
format ba
So lets do a Monte Carlo simulation to see what his odds are:
x1 = 25; y1 = 25;
disp([The chances of Picard surviving are , .
num2str(simulation(x1, y1)/100)])
The chances of Picard surviving are 0.13
We ran this simulation a few times and saw survival ch
dosage = 10000/(4*pi*(x1 - x0)2 + (y1 - y0)2 + 1);
if dosage > 50
r = 1;
else
r = 0;
end
Here is the series of commands to test the Captains survival possibilities:
x1 = 25; y1 = 25; h = 0;
for n = 1:100
x0 = 50*rand;
y0 = 50*rand;
r = lifeordeath(x1, y1,
We now redene the color of the leftmost third of the array and create a JPEG le of
the Italian ag.
A(:, 1:100, 3) = zeros(200, 100);
A(:, 1:100, 2) = ones(200, 100);
image(A); axis equal tight
set(gca, XTick, []), set(gca, YTick, [])
imwrite(A, italia.jpg
R =
1.0000
0
0
0
1.0000
0
0
0
0.5000
(d)
M should be U RU 1 . Lets check:
M - U*R*inv(U)
ans =
0
0
0
0
0
0
0
0
0
Since Rn is the diagonal matrix with entries 1, 1, 1/2n , we know that R is the
diagonal matrix with entries 1, 1, 0. Therefore M = U R U 1 .
(b)
limit(1 + cos(x)/(x + pi), x, -pi)
ans =
0
(c)
limit(x2*exp(-x), x, Inf)
ans =
0
(d)
limit(1/(x - 1), x, 1, left)
ans =
-Inf
(e)
limit(sin(1/x), x, 0, right)
ans =
-1 . 1
This means that every real number in the interval between 1 and +1 is a limit
po
(b)
quadl(@(x) sqrt(x.3 + 1), 0, 1)
ans =
1.11144798484585
(c)
MATLAB integrated this one exactly in 3(e) above; lets integrate it numerically and
compare answers. Unfortunately, the range is innite, so to use quadl we have to
approximate the interval. No
M341 H9 (S. Zhang) 2.2.
det([3
det([3
det([3
det([2
det([2
det([1
1. (2.2:3(e-f)
Find the determinants by eliminations (or all row operations).
3
6
3
0
0
1
,
2
3
1
2
1
2
2 , 4
3
2
3
4
1
,
2
2. (2.2:4)
Find all possible choices of c that would make the f