Homework assigned 9/20, due 9/27
Problems 1, 8
Write the programs using matlab.
hint on #8: "help exp"
Problems 2, 4b, 6
Problems 2b, 3b, 7b, 7c, 9
A problem that generalizes the averaging proof we did in
First, assume that x_1 < x_2 < x_3 and that w_1 + w_2 + w_3 = 1,
where w_1, w_2, and w_3 >= 0. Assume that the function f is
continuous on the interval [x_1,x_3]. Prove that there is some
point x_0 in [x_1,x_3] such that
f(x_0) = w_1 f(x_1) + w_2 f(x_2) + w_3 f(x_3).
Now, assume that x_1 < x_2 < ... < x_n and that w_1 + w_2 + ... + w_n = 1,
where w_1, w_2, ... w_n >= 0. Assume that the function f is
continuous on the interval [x_1,x_n]. Prove that there is some
point x_0 in [x_1,x_n] such that
f(x_0) = w_1 f(x_1) + w_2 f(x_2) + ... + w_n f(x_n).
We are going to study how long it takes to solve a linear algebra
problem using matlab.
First, do "help slash". Read this. Now define "A = rand(10,10),
b = rand(10,1), x = A\b, A*x-b". How do you know whether you've
successfully solved A*x = b? We'll dicuss solving the problem
this way versus solving it with x = inv(A)*b later.
Now take n = 50, 100, 150, 200, 250, 300, 350, and 400. Create a
vector N with those values. For each value of n, create a random
matrix A, a random vector b and solve A*x = b. Find how long this
took, using "flops", "cputime", and "tic, toc". Use this information
to create three vectors T1, T2, and T3 that have the running time.
Plot them versus N on separate plots using "subplot(3,1,1)",
"subplot(3,1,2)", and "subplot(3,1,3)" ("help subplot"). Do you have
a conjecture on how these functions are as a function of n? Can you
defend your conjecture by plotting the functions differently? (hint:
think logarithm). Can you defend your conjecture by fitting the
vectors T1, T2, and T3 with appropriate functions of n?
Repeat the above, but solving it using x = inv(A)*b; (Hint, you can
do all of them simultaneously, and just define the extra three vectors
as S1, S2, and S3.