This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: TEST #ZB (November 13, 2008) PGE 310
Name: Solutions
Signature:
UT EID: NOTES: 1. You have 1 hour and 15 minutes. Points will be deducted for
tests turned in after 12: 15 2. Write your name on all pages of the test 3. SHOW ALL WORK. Partial (or any credit) cannot be given
for problems without work shown . Qualitative Questions (30 points) (a) I want to solve some nonlinear equation f(x) = 0 using x=1 and x=2 as guess
values. If the ﬁrst 3 iterations of the Bisection and FalsePosition Method are
given below, what would I get for “x” in the FIRST iteration of the Secant method? , Iteration x_new (Bisection) x_new (False Position)
1 1.5 1.6914
2 1.75 1.7272 g 3 ' 1.875 1.7317 1.6914: The ﬁrst iteration of False Position is the same as the ﬁrst iteration of
Secant (b) Consider the nonlinear function below; f(x)=0. Using an initial guess of x =
0.5, On the curve, show GRAPHICALLY the ﬁrst step of the Newton
Raphson method. X (c) I have to solve a system of equations Ax=b several times (maybe hundreds).
The matrix A never changes, but the vector b changes every time. Should I
use Gauss Elimination or LU decomposition? Brieﬂy explain (and be speciﬁc) LU decomposition. If you have already created L and U in LU decomposition,
you can backward substitute right away for d and then x. If you use Gauss
Elimination, you will have to create an upper triangular matrix many times
and thus increasing your computation (by a very large amount if you have a .
large A! I). (d) Consider the following system of equations. As written, is convergence
guaranteed for an iterative method like I acobi/ Gauss Seidel. If not, rewrite the equations so that convergence is guaranteed.
My} BMW ‘5x1 +2352 +353 :15 1+ {5 not dé‘aﬁoaaly (imminent x—6x +3x =9 WWW/w
whit/us; 1/
mmmw x1 +3x2 —8x3 =7 (e) Brieﬂy explain the disadvantage of measuring error in curve ﬁtting by the sum
of the absolute values of the residuals as opposed to the“sum of the squares”
of the residuals. By summing the absolute value of the errors, you may have multiple solutions
for a data set. (i) Experimental data is gathered for the growth of certain bacteria. A theoretical
model for bacteria grth is given by the equation below. Rewrite in such a
way that linear least squares regression can be used. _ (1/1):
P — Poe 1n(P) = 1n(Po) + (l/r)t where ln(Po) = intercept = a0
(l/r) = slope = a1 2. Solve using 2 iterations of the secant method and guesses x1=1 and xz = 2 ( 15
points) f(x)==2x2 +336“2 —6=O
Seamf Me—HWA: XkH: XK ((ka " (UM) Iferanio/x '3 $<x25:;(4)+_§,g:ma H ﬂaw—am 36?! x = 9 ”W"W“‘>x\ HS
3 943w(ﬂ) [::::] 3137 XL! : Hqg_(‘.3‘137)(\.l‘15*<l3 :Eﬂg7ﬂﬁﬂa : LQQG‘ o
1 3. Solve using Gauss Elimination. SHOW ALL WORK (15 points) x2+3x3 =11 x1+2x2 +4x3 =17
23c1+3x2 =8 1 3 XI; 56¢?ka Rid—’Rza
a ‘1 X .2: I7 :7 '
3 X; b C) 4. Solve using ONE iteration of the multidimensional NewtonRaphson method.
Use initial guesses of x = y = 1 (15 points) 3x+ln(y)=—3 1533M My +3
y+2y3=—4 g: wag»: ‘7’ 5. Write a MATLAB function ﬁle call PolynomialFit.m that went sent input vectors x and y of data, the coefﬁcients of a 2"d order polynomial that best ﬁts the data,
a0, a1, and a2, are returned Assume that there already exists another function ﬁle in your directory called
“GaussElim.m” that when sent a matrix A and vector b, the solution to the system
of equations, x, is returned. Do not use builtin functions max, average, sum, or
MATLAB’s backslash operator. (25 points) function [a0,a1,a2] = PolynomialFit(x,y) sumx = 0; sumxy = 0; sumx2 = 0; sumx3 = 0; sumx4 = O; sumy = 0;
sumx2y = 0; n = length(x);
for i = 1m
sumx = sumx + x(i);
sumx2 = sumx2 + (x(i))’\2;
sumx3 = sumx3 + (x(i))"3;
sumx4 = sumx4 + (x(i))"4;
sumy = sumy + y(i);
sumxy = sumxy + x(i)*y(i);
sumx2y = sumx2y + (x(i)"2)*y(i);
end A(1,l) = n; A(1,2) = sumx; A(1,3) = sumx2; A(2,1) = sumx; A(2,2) = sumx2;
A(2,3) = sumx3; A(3,1) = sumx2; A(3,2) = sumx3; A(3,3) = sumx4; b(1,l) = sumy; b(2,1) = sumxy; b(3,l) = sumx2y;
x = GaussElim(A,b)
a0 = x(l); a1 = x(2);
a2 = x(3); ...
View
Full
Document
 Spring '06
 Klaus

Click to edit the document details