This preview shows pages 1–7. Sign up to view the full content.
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 #2A (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.6667 2 1.75 1.72727 3 1 .875 1 .73 17 1.6667: 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! l). ((1) Consider the following system of equations. As written, is convergence
guaranteed for an iterative method like J acobi/Gauss Seidel. If not, rewrite the equations so that convergence is guaranteed. § § x1+3x2——6x3=4 )Il/ Bl 41,; _4x1+2x2+x3:6 1+ my? l : x1‘5x3 . . . 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. _ (l/z‘)t P — Poe . ln(P) = ln(PO) + (l/r)t where ln(Po) = intercept = a0
(1/1) = slope = a1 2. Solve using 2 iterations of the secant method and guesses x1=1 and x; = 2 (15 points) f(x)=2x3+x'1/2—4=0 f‘fzmﬂoa 1: 15cm: M + F; J1: 0.707
«CW: 96 Ni :4 Ya: ;_ ‘9»*707<3~“U
9.70%”! 23A 9:“ \X: 3+; m@}3’,gé"/
.ﬂy’zﬁ" MW W533» 15W — 12.707 Seam/ﬂ Meﬁxcxli '
Xm: X‘: ‘3“ (XIX Xk~f>
‘HX’J ~ $(xkﬂ) ‘W.WMWW.W_V“W.__W_a w._m._wwwwwmw...M.u‘.m.ﬂm.wm._v......_.m.,.m “we. 3. Solve using Gauss Elimination. SHOW ALL WORK (15 points)
x2 + 3x3 = 10
x1+2x2 +4x3 =16
2xl + 3x2 = 7 \ ; Limo 9L4; \ ; W/é
OI 3 IO :7 013110
O! 8&5 0 O”5\"\5 4. Solve using ONE iteration of the multidimensional NewtonRaphson method.
Use initial guesses of x = y = 1 (15 points) 2x+21n(y) = —3 5. Write a MATLAB function ﬁle call PolynomialFitm that went sent input vectors
x and y of data, the coefﬁcients of a 2nd 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 “GaussElimm” 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,al,a2] = PolynomialFit(x,y) sumx = 0; sumxy = 0; sumx2 = O; sumx3 = O; sumx4 = 0; sumy = O;
sumx2y = 0; n = length(x); for i = 1:11
sumx = sumx + x(i);_
sumx2 = sumx2 + (x(i))"2;
sumx3 = sumx3 + (x(i))"3;
sumx4 = sumx4 + (x(i))"4; l
sumy = sumy + y(i); sumxy = sumxy + x(i)*y(i);
sumx2y = sumx2y + (x(i)’\2)*y(i); end A(l,1) = n; A(1,2) = sumx;'A(l,3) = sumx2; A(2,l) = sumx; A(2,2) = sumx2;
A(2,3) = sumx3; A(3,1) = sumx2; A(3,2) = sumx3; A(3,3) = sumx4; l' b(1,l) = sumy; b(2,l) = sumxy; b(3,1) = sumx2y; x = GaussElim(A,b) E
a0 = x(l); l
a1 = x(2); a2 = x(3); ...
View
Full
Document
This note was uploaded on 01/19/2012 for the course PGE 310 taught by Professor Klaus during the Spring '06 term at University of Texas at Austin.
 Spring '06
 Klaus

Click to edit the document details