This preview shows pages 1–4. 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 Document
Unformatted text preview: ® 1
/: 0 Exam 1
ME 218Engineering Computational Methods
Spring 2008 Name” Lab Time ‘/ Directions: This exam is closed book, closed note. You may only use a V2 page cheat and a non
graphing calculator. Show all work and write neatly. Since the algorithms are what you are being tested on, be sure to show all steps in a clear and orderly fashion. Budget your time. Good luck! Problem 1 (50 points): To ﬁnd the ﬂoating depth of a wooden ball of radius 1 foot and a density
that is 1/3 that of water, we can solve the equation f (x) = x3 — 3x2 +§ = O for the appropriate root. ﬁetermine which of the following are mathematically valid initial brackets for the bisection
rmethod: [1 0], [1 1], [0 2], and {1 3]. (8 pts.)
@ Even if more than one of the above brackets is mathematically valid, only one bracket makes
hysical sense. State which one and why. (2 pts)
c) What is a valid function g(x) to use if we wanted to solve this problem using ﬁxedpoint ,iteration? (4 pts)
/@ Complete one iteration of the ﬁxed point iteration method using your answer in (c) with an
initial starting point of x=2. (6 pts)
/07 ( sing an initial guess of x0: 1, complete one iteration of the Newton—Raphson Method. (10 pts)
L Mathematically determine two bad initial guesses to avoid when using the Newton Raphson
Me 0d. (5 pts)
(g sing the bracket you selected in part (b) complete one iteration of the falseposition method. What would be the correct bracket for the second iteration? (10 pts)
sing the bracket found in part (b), how many iterations of t ' ection method must be ’l completed in order to know the solution within at least $0.5 'nche [.15 pts) Problem 1 workspace. Izgfw, ﬁxxj‘: "L A455} m2 r :w m "t Problem 2 (30 points): Consider each of the following mﬁles or short c programs. In the column
on the right, recreate the console output for the given code snippet. If there is an error in the code,
simply write ERROR, and circle the error in the code. Optionally, you may use the scratch column
to show intermediate steps not printed to the console for partial credit. If the code snippet is in c, assume all the necessary #include ﬁles are included. clear all;
t(1) = 3 for k=2z4 t (k) =t (kl) +1;
end
t main(){
int i=0;
for( i=0; i<2; i++ )
printf(“%d\n",i*i); Cﬁector = [l 2 3];
sum( 3vector ) Problem 3: (20 Points) ‘ T 4 Consider the following matrices: ! _ l 0 2 L g, 1 3 2 0 4 3 3 H
A: ,B= ,C= 2 —1 3 ,d= ,e= ~ ‘ ' a 2 —1 3 2 6 —1 2 418 Which of the following MATLAB onerations are valid will not return an error? (do not solve,
just mark YES or NO. If NO, brieﬂy explain your answer.) (2 pts each) ‘ cm \/ l r 3" \. ,z t l ,
B’ . *B A] l'jJF' » W4C " , c  :zrj‘x‘Er‘a‘ttr («Meg A. “ is r W" carWynn
VV\:ncfi.\.;a‘1'rté~izr.h Q “ inf .» " '~ ‘( 9"];75‘ (if: r A e.*d+e det(B) N a & (A(2,=
Ci )’ +d ‘V
) A] ) . ‘“ mi: «ct/3? *"“ c::‘,~,;m“. ...
View
Full
Document
 Spring '08
 Unknown

Click to edit the document details