'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 103L Fall Test 2 Solutions. Michael R. Gustafson II

Similar documents
'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 103L Fall Test 2. Michael R. Gustafson II

Test 2 Solutions - Python Edition

Test 2 - Python Edition

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 53L Fall Test III. Rebecca A. Simmons & Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 224 Spring Test II. Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. ECE 110 Fall Test I. Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 224 Spring Test II. Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. EGR 53L Fall Test I. Rebecca A. Simmons & Michael R. Gustafson II

Test II Michael R. Gustafson II

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ. ECE 110 Fall Test II. Michael R. Gustafson II

Lynch 2017 Page 1 of 5. Math 150, Fall 2017 Exam 1 Form A Multiple Choice

ENGR Spring Exam 2

Lynch 2017 Page 1 of 5. Math 150, Fall 2017 Exam 2 Form A Multiple Choice

Lynch, October 2016 Page 1 of 5. Math 150, Fall 2016 Exam 2 Form A Multiple Choice Sections 3A-5A

MATH 1040 Test 2 Spring 2016 Version A QP 16, 17, 20, 25, Calc 1.5, 1.6, , App D. Student s Printed Name:

Student s Printed Name:

MA 262, Fall 2017, Final Version 01(Green)

Assignment 6, Math 575A

Version B QP1-14,18-24, Calc ,App B-D

STUDENT NAME: STUDENT SIGNATURE: STUDENT ID NUMBER: SECTION NUMBER RECITATION INSTRUCTOR:

Student s Printed Name: _Key_& Grading Guidelines CUID:

Math 308 Spring Midterm Answers May 6, 2013

Math 51 Second Exam May 18, 2017

ECE 204 Numerical Methods for Computer Engineers MIDTERM EXAMINATION /8:00-9:30

MthSc 107 Test 1 Spring 2013 Version A Student s Printed Name: CUID:

Student s Printed Name: _KEY Grading Guidelines CUID:

MthSc 103 Test 3 Spring 2009 Version A UC , 3.1, 3.2. Student s Printed Name:

Please do not start working until instructed to do so. You have 50 minutes. You must show your work to receive full credit. Calculators are OK.

MAT 145 Test #4: 100 points

Temperature measurement

STUDENT NAME: STUDENT SIGNATURE: STUDENT ID NUMBER: SECTION NUMBER RECITATION INSTRUCTOR:

Lab 13: Ordinary Differential Equations

1.1 Functions and Their Representations

Computer Applications in Engineering and Construction Programming Assignment #9 Principle Stresses and Flow Nets in Geotechnical Design

Chapter 1 Review of Equations and Inequalities

Student s Printed Name: KEY_&_Grading Guidelines_CUID:

452 FINAL- VERSION E Do not open this exam until you are told. Read these instructions:

Math 51 Midterm 1 July 6, 2016

Physics Exam I

LIMITS AND DERIVATIVES

AMSC/CMSC 466 Problem set 3

Math 308 Midterm Answers and Comments July 18, Part A. Short answer questions

1 Introduction & Objective

MATH 1070 Test 1 Spring 2014 Version A Calc Student s Printed Name: Key & Grading Guidelines CUID:

Physics Grading Sheet.

Student s Printed Name: _Key

Without fully opening the exam, check that you have pages 1 through 11.

Math 1: Calculus with Algebra Midterm 2 Thursday, October 29. Circle your section number: 1 Freund 2 DeFord

Test 3 - Answer Key Version B

Test 3 Version A. On my honor, I have neither given nor received inappropriate or unauthorized information at any time before or during this test.

MATH 099 Name (please print) FINAL EXAM - FORM A Winter 2015 Instructor Score

Part I 5. Part II 2. Part III 8. Part IV 10. Part V 5 TOTAL 30


Math 41 Second Exam November 4, 2010

Test 4 also includes review problems from earlier sections so study test reviews 1, 2, and 3 also.

Lab 6: Linear Algebra

Homework 1 Solutions

MthSc 107 Test 1 Spring 2013 Version A Student s Printed Name: CUID:

Math 1020 TEST 3 VERSION A Spring 2017

Without fully opening the exam, check that you have pages 1 through 11.

Math 1020 ANSWER KEY TEST 3 VERSION A Fall 2016

Project 2: Using linear systems for numerical solution of boundary value problems

Total 100

Lab 11 Simple Harmonic Motion A study of the kind of motion that results from the force applied to an object by a spring

Student s Printed Name:

Math 41 First Exam October 12, 2010

A polynomial expression is the addition or subtraction of many algebraic terms with positive integer powers.

Physics Exam I

11 /2 12 /2 13 /6 14 /14 15 /8 16 /8 17 /25 18 /2 19 /4 20 /8

2D Plotting with Matlab

Experiment 1: Linear Regression

Summer Packet A Math Refresher For Students Entering IB Mathematics SL

Without fully opening the exam, check that you have pages 1 through 12.

Math 19 Practice Exam 2B, Winter 2011

MTH 234 Exam 1 February 20th, Without fully opening the exam, check that you have pages 1 through 11.

Pre-Calculus Exam 2009 University of Houston Math Contest. Name: School: There is no penalty for guessing.

Test 2 - Answer Key Version A

Department of Mathematics, University of California, Berkeley. GRADUATE PRELIMINARY EXAMINATION, Part A Spring Semester 2019

Maple for Math Majors. 3. Solving Equations

STUDENT NAME: STUDENT SIGNATURE: STUDENT ID NUMBER: SECTION NUMBER AND RECITATION INSTRUCTOR:

Companion. Jeffrey E. Jones

Without fully opening the exam, check that you have pages 1 through 11.

CS 221 Lecture 9. Tuesday, 1 November 2011

Lecture 7. Root finding I. 1 Introduction. 2 Graphical solution

Computational Foundations of Cognitive Science

1 TIME OF ARRIVAL LOCATION TECHNIQUE

PHYSICS 221 Fall 2013 EXAM 2: November 6, :15pm 10:15pm. Name (printed): Recitation Instructor: Section #:

Chapter 2: Inequalities, Functions, and Linear Functions

Math 51 First Exam October 19, 2017

Preliminary Examination in Numerical Analysis

Test 3 Version A. On my honor, I have neither given nor received inappropriate or unauthorized information at any time before or during this test.

MATH 1070 Test 3 Spring 2015 Version A , 5.1, 5.2. Student s Printed Name: Key_&_Grading Guidelines CUID:

Page Points Score Total: 100

Name: Date: 3. Which is more concentrated (circle one.): 14.0 ppm CO 2 OR ppb CO 2?

Fall 2016 Test 1 with Solutions

Name: Instructor: 1. a b c d e. 15. a b c d e. 2. a b c d e a b c d e. 16. a b c d e a b c d e. 4. a b c d e... 5.

MATH 112 Final Exam, Spring Honor Statement

Manipulating Radicals

MATH: A2. ADE Summer Item Writing Institute. Performance-Based Assessment. x f(x) g(x)

Student s Printed Name:

Transcription:

'XNH8QLYHUVLW\ (GPXQG73UDWW-U6FKRRORI(QJLQHHULQJ EGR 103L Fall 2017 Test 2 Solutions Michael R. Gustafson II Name (please print) NET ID (please print): In keeping with the Community Standard, I have neither provided nor received any assistance on this test. I understand if it is later determined that I gave or received assistance, I will be brought before the Undergraduate Conduct Board and, if found responsible for academic dishonesty or academic contempt, fail the class. I also understand that I am not allowed to speak to anyone except the instructor about any aspect of this test until the instructor announces it is allowed. I understand if it is later determined that I did speak to another person about the test before the instructor said it was allowed, I will be brought before the Undergraduate Conduct Board and, if found responsible for academic dishonesty or academic contempt, fail the class. Signature: Notes You will be turning in each problem in a separate pile. Most of these problems will require working on separate pieces of paper - Make sure that you do not put work for more than any one problem on any one piece of paper. For this test, you will be turning in four different sets of work. Again, Please do not work on multiple problems on the same sheet of paper. Also - please do not put work for one problem on the back of another problem. Be sure your name and NET ID show up on every page of the test. If you are including work on extra sheets of paper, put your name and NET ID on each and be sure to staple them to the appropriate problem. Problems without names will incur at least a 25% penalty for the problem. This first page should have your name, NET ID, and signature on it. It should be stapled on top of and turned in with your submission for Problem I. You will not need and can not use a calculator on this test. For hand calculations you will instead show the set-up of the calculation you need to perform but will not reduce it. You can leave powers, roots, products, sums, differences, and quotients unevaluated - for example, (3)(2) + (8)(11) (6)(24) A (8) 2 (4) 2 + (2) 2 (7) 2 should be left just like that. You will be asked to write several lines of code on this test. Make sure what you write is MATLAB code and not mathematics. Be very careful with any symbols you use. You do not need to put the honor code statement in your codes. The honor code statement on this page and your NET ID on each problem stands in for that. You do not need to number your lines of code. Please staple in the top left corner of the page. Also, please do not put work too close to the top left corner of the page!

Name (please print): Community Standard (print NET ID): Problem I: [25 pts.] This again? (1) Given the following matrices: M [ ] +4 +6 3 2 +5 +1 N [ ] +3 +4 0 +1 1 +1 Oh +1 +1 +1 1 Write the results of the following MATLAB commands in the spaces below. (a) A M*Oh (f) F M>1 (b) B N. 2 (g) G find(m>1) (c) C N 2 (h) H M(find(M>1)) (d) D N(:) (i) I [N N] (e) E sum(oh) (j) J N & N (2) Show what P and R would be after the following command: [P, R] meshgrid([1 2 3], [4 5]) (3) Show what S, T, U, and V and would be after the following commands: S [5 2 3; 1 6 8] T 2; for US TT+1; S(T)T; V(T)max(U); end

1 A 2-1 13 3 8 2 4 B 5 9 16 6 0 1 7 C 8 9 16 9 0 1 10 D 11 3 12 0 13 4 14 1 15 E 16 1 1 17 F 18 1 1 0 19 0 1 0 20 G 21 1 22 3 23 4 24 H 25 4 26 6 27 5 28 I 29 3 4 3 4 30 0 1 0 1 31 J 32 1 1 33 0 1 34 P 35 1 2 3 36 1 2 3 37 R 38 4 4 4 39 5 5 5 40 S 41 5 3 5 42 1 4 8 43 T 44 5 45 U 46 3 47 8 48 V 49 0 0 5 6 8

Name (please print): Community Standard (print NET ID): Problem II: [25 pts.] Where is everything? (1) Given the equation: and the two graphs: y(x) e x x 2 + 8x 5 x 1 1.5 6 5 1 4 y 0.5 0 y 3 2 1 0.5 0 1 1 0 0.2 0.4 0.6 0.8 1 x 2 0 1 2 3 4 5 6 x which are of the same function but with two different domains, write MATLAB code to accomplish the tasks below. (a) Write code guaranteed to find the two positive values of x where y(x) 0. Note that the root at x 0 is not included in these two. Call these values x1 and x2 (b) Write code guaranteed to find the value and location of the local minimum of the function on the left side of each graph. Assign the value of the minimum to ymin and the location of the minimum to xminloc. (c) Write code guaranteed to find the value and location real global maximum value of the function. Assign the value of the minimum to ymax and the location of the minimum to xmaxloc. (d) From the graphs, you can see that y(x) 2 at two locations. Write code guaranteed to find both and assign the locations to x2a and x2b from left to right, respectively. (2) Given the function of a surface: f(x,y) x 2 + x y + y 2 3x + 2y + cos(x) + sin(y) (a) Generate a surface plot of f(x,y) as a function of x and y. x and y should span the domain from -8 to 8 and there should be 50 nodes in each direction. You do not need to label, title, or save this plot. (b) Determine which of the 2500 modes is closest to and find the x, y, f(x,y), and element values at that grid point. Display this information in a manner similar to the following (numerically incorrect) example (which uses %+0.3e for all scientific notation numbers and %0.0f for all integers, as do all in this problem): Max node: f(-7.674e+00,-7.347e+00) +1.089e+02 at node 17 (c) Determine which of the 2500 nodes is closest to and find the x, y, and f(x,y) values at that grid point. Display this information in a manner similar to the following (numerically incorrect) example: Min node: f(+2.976e+00,-2.022e+00) -8.091e+00 at node 1841 (d) Determine the exact location of the minimum of the f(x, y) function. Use the information gained above in (c) as an initial guess. Display this information in a manner similar to the following (numerically incorrect) example: Min val: f(+2.849e+00,-2.015e+00) -8.402e+00 (e) Determine the S t value for the 2500 values of f(x,y) and store it in a variable called St.

(1)1 % not required 2 clear; format short e 3 y@(x) exp(-x)-x.^2+8*x-5*sqrt(x)-1 4 5 % a - multiple bracket possibilities 6 x1 fzero(@(x) y(x), [0.5 0.6]) 7 x2 fzero(@(x) y(x), [5 6]) 8 9 % b - multiple bounday possibilities 10 [xminloc, ymin] fminbnd(@(x) y(x), 0, 1) 11 12 % c - mutiple bracket possibilities; be sure to flip sign! 13 [xmaxloc, ymaxneg] fminbnd(@(x) -y(x), 2, 4) 14 ymax -ymaxneg 15 % or ymax y(xmaxloc) 16 17 % d - mutiple bracket possibilities 18 x2a fzero(@(x) y(x)-2, [1 2]) 19 x2b fzero(@(x) y(x)-2, [5 6]) (2)1 % Not required 2 clear; format short e 3 4 % (a) - OK if function definition not included... I guess... 5 f @(x,y) x.^2+x.*y+y.^2-3*x+2*y+cos(x)+sin(y) 6 [x, y] meshgrid(linspace(-8, 8, 50)); 7 surfc(x, y, f(x,y)) 8 9 % (b) - must have columns or use max(max(f(x,y))) 10 fvals f(x,y); 11 maxdex find(fvalsmax(fvals(:))); 12 fprintf( Max node: f(%+0.3e,%+0.3e) %+0.3e at node %0.0f\n,... 13 x(maxdex), y(maxdex), fvals(maxdex), maxdex) 14 15 % (c) - must have columns or use min(min(f(x,y))) 16 mindex find(fvalsmin(fvals(:))); 17 fprintf( Min node: f(%+0.3e,%0.3e) %+0.3e at node %0.0f\n,... 18 x(mindex), y(mindex), fvals(mindex), mindex) 19 20 % (d) 21 [rloc, fval] fminsearch(@(r) f(r(1),r(2)),... 22 [x(mindex), y(mindex)]) 23 fprintf( Min val: f(%+0.3e,%0.3e) %+0.3e\n,... 24 rloc, fval) 25 26 % (e) - must have columns or use sum(sum((f(x,y)-mean(mean(f(x,y)))).^2)) 27 St sum((fvals(:)-mean(fvals(:))).^2)

Name (please print): Community Standard (print NET ID): Problem III: [25 pts.] Fall & Spring(s) (1) Assume you have the following equations for a system: Hr Is + J Kr + Ls + M 0 and assuming H through M are known constants while r and s are your unknowns, (a) Fill in the following framework for a linear algebra system (there are six total blanks): [A]{x} {b} [ ]{ } { } r s (b) By hand, determine a formula for the determinant of the coefficient matrix, A. (c) By hand, determine a formula for the determinant of the inverse of the coefficient matrix, A 1. (d) By hand, determine solutions to the vector of unknowns r and s in terms of known values H through M. (2) Three masses M i are held apart at (unknown) positions x i between two walls by a series of large springs with known spring constants K 1 through K 4. There are known external forces F i acting on each of the masses. x 1 x 2 x 3 F 1 F 2 F 3 M 1 M 2 M 3 K 1 K 2 K 3 K 4 The equilibrium equations for the positions of the masses as functions of the applied forces are: (K 1 + K 2 )x 1 F 1 + K 2 x 2 (K 2 + K 3 )x 2 F 2 + K 2 x 1 + K 3 x 3 (K 3 + K 4 )x 3 F 3 + K 3 x 2 (a) Fill in the following framework for a linear algebra system that could be used to solve for the positions (x 1, x 2, and x 3 ); there are 12 total blanks: x 1 x 2 x 3 (b) Assuming you know that K 1 K 2 K 3 1000 and F 1 F 2 F 3 2000, write code that will allow you to solve for and plot the values of x 2 for 200 linearly spaced values of K 4 between 500 and 2500. Give your graph proper axis labels and use a dashed blue line. You may assume the code clear; K1 1000; K21000; K31000; F12000; F22000; F32000; is already written. (c) Assume your system measurements have six significant figures. It turns out the condition number of your coefficient matrix, based on the 2-norm, is 5.05 when K 4 2000. What does this mean for the solutions to your linear algebra problem when K 4 2000?

(1) (a) [ ] { } H I r K L s { } J M (b) A (H)(L) (K)( I) (c) Note the prompt - By hand, determine a formula for the determinant of the inverse of the coefficient matrix, A 1. I meant to ask for the inverse...if people gave the determinant of the inverse, that works, but ends up being more complicated [ ] L I [ A 1 K H L I ] K H A 1 [ L K I H ] ( L ) ( H ) ( I )( ) K 1 (d) { } [ r L s K I H ] { } { J LJ IM } JK HM M (2) (a) K 1 + K 2 K 2 0 x 1 K 2 K 2 + K 3 K 3 x 2 0 K 3 K 3 + K 4 x 3 F 1 F 2 F 3 (b)1 % Not required 2 clear; 3 K1 1000; K21000; K31000; F12000; F22000; F32000; 4 5 % Start here 6 K4 linspace(500, 2500, 200); 7 for k1:length(k4) 8 A [K1+K2 -K2 0;... 9 -K2 K2+K3 -K3;... 10 0 -K3 K3+K4(k)]; 11 b [F1; F2; F3]; % fine if calculated before loop since constant 12 MyPos A\b; 13 x2(k) MyPos(2); % fine if other values also stored elsewhere 14 end 15 16 plot(k4, x2, b-- ) 17 xlabel( K_4 ) 18 ylabel( x_2 ) (c) Since log 10 (5.05)is between 0 and 1, the solutions will have between 0 and 1 fewer digits of precision, so between 5 and 6 digits.

Name (please print): Community Standard (print NET ID): Problem IV: [25 pts.] Under Pressure This problem is adapted from Chapra 15.29. The dependent variable has been transformed to something called LP versus the original p. The Antoine equation describes the relation between vapor pressure and temperature for pure components as LP A B C + T where LP is related to the pressure, T is temperature, and A, B, and C are component-specific constants. Use MATLAB to determine the best values for the constants for carbon monoxide based on the following measurements where you may assume the following lines of code are given: T [50.00 60.00 70.00 80.00 90.00 100.00 110.00 120.00 130.00]; LP [ 4.40 7.74 9.82 11.29 12.34 13.12 13.77 14.22 14.69]; Write the rest of the code to: (1) Determine the coefficients A, B, and C that give the mathematically best version of the Antoine equation for this data set. At the end of this part of the code, you should have variables named A, B, and C. Of the three coefficients, in looking at how the formula changes with T, you should be able to come up with a guess for A based on the data. Describe your process for making a guess of A. Use 50 as an initial guess for B and -2 as an initial guess for C. (2) Determine the r 2 value for this fit and call it r2a for Antoine. (3) Ask the user for a single integer called Ord between 1 and 8. Keep asking the user for an input until the user correctly gives a single integer with a value between 1 and 8 (inclusive). (4) Determine the coefficients for a polynomial fit or order Ord. Store them in a variable called Coefs2. (5) Determine the r 2 value for this polynomial fit and call it r2p for Polynomial. (6) Make a graph that has the original data points as black circles, the Antoine equation model as a solid blue line that uses 200 values of T that span the domain of the original data set, and the polynomial fit as a dashed red line that also uses 200 values of T that span the domain of the original data set. Put proper axis labels on this graph along with a meaningful legend. (7) Print a statement about which fit was mathematically better. Your program should either say: Antoine fit is better: r29.993e-01 vs. 9.864e-01 or Order 4 polynomial fit is better: r29.997e-01 vs. 9.993e-01 where you need to indicate the order of the polynomial, or Fits have same r29.993e-01 depending on which is better or if they are the same. Use %0.0f for integers and %0.3e for other numbers.

1 % Not required 2 clear; format short e 3 T [50.00 60.00 70.00 80.00 90.00 100.00 110.00 120.00 130.00]; 4 LP [ 4.40 7.74 9.82 11.29 12.34 13.12 13.77 14.22 14.69]; 5 6 % (1) 7 yeqn @(coefs, x) coefs(1)-coefs(2)./(coefs(3)+x) 8 cinit [15 50-2] 9 fssr @(coefs, x, y) sum((y-yeqn(coefs,x)).^2) 10 mycoefs fminsearch(@(c) fssr(c, T, LP), cinit) 11 % OK if Amycoefs(1); Bmycoefs(2); Cmycoefs(3) follows 12 13 % (2) 14 St sum((lp-mean(lp)).^2) 15 Sr sum((lp-yeqn(mycoefs,t)).^2) 16 r2 (St-Sr) / St 17 18 % (3) 19 Ord input( Order: ) 20 while length(ord)~1 Ord<1 Ord>8 round(ord)~ord 21 Ord input( Order: ) 22 end 23 24 % (4) 25 P polyfit(t, LP, Ord); 26 27 % (5) 28 Sr2 sum((lp-polyval(p, T)).^2) 29 r22 (St-Sr2) / St 30 31 % (6) 32 Tm linspace(t(1),t(end),1000); 33 LPm yeqn(mycoefs, Tm); 34 35 plot(t, LP, ko,... 36 Tm, yeqn(mycoefs, Tm), b-,... 37 Tm, polyval(p, Tm), r-- ) 38 39 % (7) 40 if r2>r22 41 fprintf( Antoine fit is better: r2%0.3e vs. %0.3e\n,... 42 r2, r22) 43 elseif r22>r2 44 fprintf( Order %0.0f polynomial fit is better: r2%0.3e vs. %0.3e\n,... 45 Ord, r22, r2) 46 else 47 fprintf( Fits have same r2%0.3e\n, r2) 48 end