Homework 3 Solutions



Σχετικά έγγραφα
CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

2 Composition. Invertible Mappings

EE512: Error Control Coding

Exercises 10. Find a fundamental matrix of the given system of equations. Also find the fundamental matrix Φ(t) satisfying Φ(0) = I. 1.

Example Sheet 3 Solutions

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

Matrices and Determinants

Second Order Partial Differential Equations

Inverse trigonometric functions & General Solution of Trigonometric Equations

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

Areas and Lengths in Polar Coordinates

Section 8.3 Trigonometric Equations

Second Order RLC Filters

( ) 2 and compare to M.

Areas and Lengths in Polar Coordinates

2. THEORY OF EQUATIONS. PREVIOUS EAMCET Bits.

Section 7.6 Double and Half Angle Formulas

Chapter 6: Systems of Linear Differential. be continuous functions on the interval

6.3 Forecasting ARMA processes

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R +

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

Quadratic Expressions

CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS

Partial Differential Equations in Biology The boundary element method. March 26, 2013

Math221: HW# 1 solutions

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

2. Μηχανικό Μαύρο Κουτί: κύλινδρος με μια μπάλα μέσα σε αυτόν.

The Simply Typed Lambda Calculus

Problem Set 3: Solutions

Srednicki Chapter 55

derivation of the Laplacian from rectangular to spherical coordinates

ST5224: Advanced Statistical Theory II

C.S. 430 Assignment 6, Sample Solutions

Concrete Mathematics Exercises from 30 September 2016

Other Test Constructions: Likelihood Ratio & Bayes Tests

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

Differentiation exercise show differential equation

4.6 Autoregressive Moving Average Model ARMA(1,1)

Finite Field Problems: Solutions

Chapter 6: Systems of Linear Differential. be continuous functions on the interval

Approximation of distance between locations on earth given by latitude and longitude

w o = R 1 p. (1) R = p =. = 1

CRASH COURSE IN PRECALCULUS

( y) Partial Differential Equations

Trigonometric Formula Sheet

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

Solution to Review Problems for Midterm III

Homework 8 Model Solution Section

Tridiagonal matrices. Gérard MEURANT. October, 2008

Solution Series 9. i=1 x i and i=1 x i.

SOLVING CUBICS AND QUARTICS BY RADICALS

Statistical Inference I Locally most powerful tests

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

ECE Spring Prof. David R. Jackson ECE Dept. Notes 2

Review Test 3. MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics

6.1. Dirac Equation. Hamiltonian. Dirac Eq.

MathCity.org Merging man and maths

Lecture 2: Dirac notation and a review of linear algebra Read Sakurai chapter 1, Baym chatper 3

forms This gives Remark 1. How to remember the above formulas: Substituting these into the equation we obtain with

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

5.4 The Poisson Distribution.

Math 446 Homework 3 Solutions. (1). (i): Reverse triangle inequality for metrics: Let (X, d) be a metric space and let x, y, z X.

Solutions to Exercise Sheet 5

PARTIAL NOTES for 6.1 Trigonometric Identities

Appendix to On the stability of a compressible axisymmetric rotating flow in a pipe. By Z. Rusak & J. H. Lee

Problem Set 9 Solutions. θ + 1. θ 2 + cotθ ( ) sinθ e iφ is an eigenfunction of the ˆ L 2 operator. / θ 2. φ 2. sin 2 θ φ 2. ( ) = e iφ. = e iφ cosθ.

DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.

Lecture 34 Bootstrap confidence intervals

Lecture 2. Soundness and completeness of propositional logic

ANSWERSHEET (TOPIC = DIFFERENTIAL CALCULUS) COLLECTION #2. h 0 h h 0 h h 0 ( ) g k = g 0 + g 1 + g g 2009 =?

Practice Exam 2. Conceptual Questions. 1. State a Basic identity and then verify it. (a) Identity: Solution: One identity is csc(θ) = 1

Exercises to Statistics of Material Fatigue No. 5

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω

MATH423 String Theory Solutions 4. = 0 τ = f(s). (1) dτ ds = dxµ dτ f (s) (2) dτ 2 [f (s)] 2 + dxµ. dτ f (s) (3)

Numerical Analysis FMN011

CHAPTER 101 FOURIER SERIES FOR PERIODIC FUNCTIONS OF PERIOD

Pg The perimeter is P = 3x The area of a triangle is. where b is the base, h is the height. In our case b = x, then the area is

Strain gauge and rosettes

A Note on Intuitionistic Fuzzy. Equivalence Relation

Lecture 13 - Root Space Decomposition II

9.09. # 1. Area inside the oval limaçon r = cos θ. To graph, start with θ = 0 so r = 6. Compute dr

Trigonometry 1.TRIGONOMETRIC RATIOS

Math 6 SL Probability Distributions Practice Test Mark Scheme

New bounds for spherical two-distance sets and equiangular lines

ENGR 691/692 Section 66 (Fall 06): Machine Learning Assigned: August 30 Homework 1: Bayesian Decision Theory (solutions) Due: September 13

5. Choice under Uncertainty

Bayesian statistics. DS GA 1002 Probability and Statistics for Data Science.

EQUATIONS OF DEGREE 3 AND 4.

TRIGONOMETRIC FUNCTIONS

Notes on the Open Economy

b. Use the parametrization from (a) to compute the area of S a as S a ds. Be sure to substitute for ds!

Μηχανική Μάθηση Hypothesis Testing

Parametrized Surfaces

On a four-dimensional hyperbolic manifold with finite volume

Congruence Classes of Invertible Matrices of Order 3 over F 2

= λ 1 1 e. = λ 1 =12. has the properties e 1. e 3,V(Y

Reminders: linear functions

Transcript:

Homework 3 Solutions Igor Yanovsky (Math 151A TA) Problem 1: Compute the absolute error and relative error in approximations of p by p. (Use calculator!) a) p π, p 22/7; b) p π, p 3.141. Solution: For this exercise, you can use either calculator or Matlab. a) Absolute error: p p π 22/7 0.001245. Relative error: π 22/7 π 4.0250 10 4. p p p b) Absolute error: p p π 3.141 7.344 10. Relative error: π 3.141 π 2.3384 10. p p p Problem 2: Find the largest interval in which p must lie to approximate 2 with relative error at most 10 5 for each value for p. Solution: The relative error is defined as p p p, where in our case, p 2. We have Therefore, or 2 p 2 10 5. 2 p 2 10 5, 2 10 5 2 p 2 10 5, 2 2 10 5 p 2+ 2 10 5, 2+ 2 10 5 p 2 2 10 5. Hence, 2 2 10 5 p 2+ 2 10 5. This interval can be written in decimal notation as [1.41419942...,1.41422770...]. 1

Problem 3: Use the 4-bit long real format to find the decimal equivalent of the following floating-point machine numbers. a) 0 10000001010 10010011000000 0 b) 1 10000001010 01010011000000 0 Solution: a) Given a binary number (also known as a machine number) 0 }{{} s 10000001010 } {{ } c 10010011000000 } {{ 0}, f a decimal number (also known as a floating-point decimal number) is of the form: ( 1) s 2 c 1023 (1 + f). Therefore, in order to find a decimal representation of a binary number, we need to find s, c, and f. The leftmost bit is zero, i.e. s 0, which indicates that the number is positive. The next 11 bits, 10000001010, giving the characteristic, are equivalent to the decimal number: c 1 2 10 +0 2 9 + +0 2 4 +1 2 3 +0 2 2 +1 2 1 +0 2 0 1024 + 8 + 2 1034. The exponent part of the number is therefore 2 1034 1023 2 11. The final 52 bits specify that the mantissa is f ( ) 1 ( ) 4 ( ) 7 ( ) 8 1 1 1 1 1 +1 +1 +1 2 2 2 2 0.57421875. Therefore, this binary number represents the decimal number ( 1) s 2 c 1023 (1 + f) ( 1) 0 2 1034 1023 (1 + 0.57421875) 2 11 1.57421875 3224. 2

b) Given a binary number 1 }{{} s 10000001010 } {{ } c a decimal number is of the form: ( 1) s 2 c 1023 (1 + f). 01010011000000 } {{ 0}, f Therefore, in order to find a decimal representation of a binary number, we need to find s, c, and f. The leftmost bit is zero, i.e. s 1, which indicates that the number is negative. The next 11 bits, 10000001010, giving the characteristic, are equivalent to the decimal number: c 1 2 10 +0 2 9 + +0 2 4 +1 2 3 +0 2 2 +1 2 1 +0 2 0 1024 + 8 + 2 1034. The exponent part of the number is therefore 2 1034 1023 2 11. The final 52 bits specify that the mantissa is f ( ) 1 2 ( ) 1 4 ( ) 1 7 ( ) 1 8 1 +1 +1 +1 2 2 2 2 0.32421875. Therefore, this binary number represents the decimal number ( 1) s 2 c 1023 (1 + f) ( 1) 1 2 1034 1023 (1 + 0.32421875) 2 11 1.32421875 2712. 3

Problem 4: Find the next largest and smallest machine numbers in decimal form for the numbers given in the above problem. Solution: a) Consider a binary number (also known as a machine number) 0 10000001010 10010011000000 00, The next largest machine number is 0 10000001010 10010011000000 01. (1) From problem 3(a), we know that s 0 and c 1034. We need to find f: f ( ) 1 1 ( ) 1 4 ( ) 1 7 ( ) 1 8 ( ) 1 52 1 +1 +1 +1 +1 2 2 2 2 2 0.57421875 + 2.22044049250313... 10 1 0.57421875 + 0.000000000000000222044... 0.574218750000000222044... Therefore, this binary number (in (1)) represents the decimal number ( 1) s 2 c 1023 (1 + f) ( 1) 0 2 1034 1023 (1+0.57421875 + 0.000000000000000222044...) 2 11 (1.57421875 + 2.22044049250313... 10 1 ) 3224 + 4.5474735088441 10 13 3224.00000000000045474735... The next smallest machine number is 0 10000001010 10010010111111 11. (2) From problem 3(a), we know that s 0 and c 1034. We need to find f: 1 ( ) 1 1 ( ) 1 4 ( ) 1 7 52 ( ) 1 n f 1 +1 +1 + 1 2 2 2 2 n9 ( ) 1 1 ( ) 1 4 ( ) 1 7 ( ) 1 8 ( ) 1 52 + + + 2 2 2 2 2 0.57421875 2.22044049250313... 10 1 0.57421875 0.000000000000000222044... 0.57421874999999977795539... 1 Note that N 2 n 2 N+1 1. n0 The formula above is a specific case of the following more general equation: N 2 n 2 N+1 2 M. nm Similarly, we also have a formula: N ( ) n ( ) M 1 ( ) N 1 1 1. 2 2 2 nm To get some intuition about these formulas, consider an example with M 2 and N 5, for instance. 4

Therefore, this binary number (in (2)) represents the decimal number ( 1) s 2 c 1023 (1 + f) ( 1) 0 2 1034 1023 (1+0.57421875 0.000000000000000222044...) 2 11 (1.57421875 2.22044... 10 1 ) 3224 4.547473508 10 13 3224 0.0000000000004547473508 3223.9999999999995452527... b) Consider a binary number 1 10000001010 01010011000000 0 The next largest (in magnitude) machine number is 1 10000001010 01010011000000 1 (3) From problem 3(b), we know that s 1 and c 1034. We need to find f: f ( ) 1 2 ( ) 1 4 ( ) 1 7 ( ) 1 8 ( ) 1 52 1 +1 +1 +1 +1 2 2 2 2 2 0.32421875 + 2.22044049250313... 10 1 0.32421875 + 0.000000000000000222044... 0.324218750000000222044... Therefore, this binary number (in (3)) represents the decimal number ( 1) s 2 c 1023 (1 + f) ( 1) 1 2 1034 1023 (1+0.32421875 + 0.000000000000000222044...) 2 11 (1.32421875 + 2.22044049250313... 10 1 ) 2712 4.5474735088441 10 13 2712 0.0000000000004547473508 2712.00000000000045474735... The next smallest (in magnitude) machine number is 1 10000001010 01010010111111 1 (4) From problem 3(b), we know that s 1 and c 1034. We need to find f: ( ) 1 2 ( ) 1 4 ( ) 1 7 52 ( ) 1 n f 1 +1 +1 + 1 2 2 2 2 n9 ( ) 1 2 ( ) 1 4 ( ) 1 7 ( ) 1 8 ( ) 1 52 + + + 2 2 2 2 2 0.32421875 2.22044049250313... 10 1 0.32421875 0.000000000000000222044... 0.32421874999999977795539... Therefore, this binary number (in (4)) represents the decimal number ( 1) s 2 c 1023 (1 + f) ( 1) 1 2 1034 1023 (1+0.32421875 0.000000000000000222044...) 2 11 (1.32421875 2.22044049250313... 10 1 ) 2712 + 4.5474735088441 10 13 2712 + 0.0000000000004547473508 2711.9999999999995452527... 5

Problem 5: Use four-digit rounding arithmetic and the formulas to find the most accurate approximations to the roots of the following quadratic equations. Compute the relative error. a) 1 3 x2 123 4 x + 1 0; b) 1.002x 2 +11.01x +0.0125 0. Solution: The quadratic formula states that the roots of ax 2 + bx + c 0 are x 1,2 b ± b 2 4ac. 2a 1 a) The roots of 3 x2 123 4 x + 1 0 are approximately x 1 92.2445792731231, x 2 0.0054203728770. We use four-digit rounding arithmetic to find approximations to the roots. We find the first root: 123 ( x 4 1 + ) 123 2 4 4 1 3 1 2 1 30.75 + 30.75 2 4 0.3333 0.17 2 0.3333 3 30.75 + 945. 1.333 0.17 30.75 + 945. 0.2222 30.75 + 945.4 30.75 + 30.75 1.50 92.2, x 1 x 1 x 1 92.2445792731231 92.2 92.2445792731231 1.72 10 4. 123 ( x 4 2 ) 123 2 4 4 1 3 1 2 13 30.75 30.75 2 4 0.3333 0.17 2 0.3333 30.75 945. 1.333 0.17 30.75 945. 0.2222 30.75 945.4 30.75 30.75 0. has the following relative error: x 2 x 2 0.0054203728770 0 1.0. x 2 0.0054203728770 We obtained a very large relative error, since the calculation for x 2 involved the subtraction of nearly equal numbers. In order to get a more accurate approximation to x 2, we need to use an alternate quadratic formula, namely 2c x 1,2 b ± b 2 4ac. Using four-digit rounding arithmetic, we obtain: x 2 2 1 ( 123 4 ) 123 2 4 4 1 3 1 x 2 x 2 x 2 0.0054203728770 0.005420 0.0054203728770 fl(0.00541951) 0.005420,.87 10 5.

b) The roots of 1.002x 2 +11.01x +0.0125 0 are approximately x 1 0.0011490755991, x 2 10.988748743590. We use four-digit rounding arithmetic to find approximations to the roots. If we use the generic quadratic formula for the calculation of x 1, we will encounter the subtraction of nearly equal numbers (you may check). Therefore, we use the alternate quadratic formula to find x 1 : 2c x 1 b + b 2 4ac 2 0.0125 11.01 11.01 2 +4 1.002 0.0125 0.02530 11.01 + 11.00 0.02530 0.001149, 22.01 x 1 x 1 x 1 0.0011490755991 ( 0.001149) 0.0011490755991 We find the second root using the generic quadratic formula: x 2 11.01 ( 11.01) 2 4 1.002 0.0125 2 1.002 11.01 121.2 0.05070 22.01 10.98, x 2 x 2 x 2 11.01 121.1 10.988748743590 ( 10.98) 10.988748743590.584 10 5. 11.01 121.2 4.008 0.0125 11.01 11.00.257 10 4. 7

Similar Problem The roots of 1.002x 2 11.01x +0.0125 0 are approximately x 1 10.988748743590, x 2 0.0011490755991. We use four-digit rounding arithmetic to find approximations to the roots. We find the first root: x 1 11.01 + ( 11.01) 2 4 1.002 0.0125 11.01 + 121.2 4.008 0.0125 2 1.002 11.01 + 121.2 0.05070 22.01 10.98, x 1 x 1 x 1 11.01 + 121.1 10.988748743590 10.98 10.9887 11.01 + 11.00.257 10 4. If we use the generic quadratic formula for the calculation of x 2, we will encounter the subtraction of nearly equal numbers. Therefore, we use the alternate quadratic formula to find x 2 : 2c x 2 b b 2 4ac 2 0.0125 11.01 ( 11.01) 2 4 1.002 0.0125 0.02530 11.01 11.00 0.02530 0.001149, 22.01 x 2 x 2 x 2 0.0011490755991 0.001149 0.0011490755991.584 10 5. 8

Problem : Suppose that fl(y) isak-digit rounding approximation to y. Show that y fl(y) y 0.5 10 k+1. (Hint: If d k+1 < 5, then fl(y)0.d 1...d k 10 n. If d k+1 5, then fl(y)0.d 1...d k 10 n +10 n k.) Solution: We have to look at two cases separately. Case ➀ : d k+1 < 5. y fl(y) y 0.d 1...d k d k+1... 10 n 0.d 1...d k 10 n 0.d 1...d k d k+1... 10 n k zeros { }} { 0. 0...0 d k+1... 10 n 0.d 1...d k d k+1... 10 n 0.d k+1 d k+2... 10 n k 0.d 1 d 2... 10 n 0.d k+1 d k+2... 0.d 1 d 2... 10 k 0.d k+1d k+2... 10 k 0.d 1 d 2... 0.d k+1d k+2... 10 k 0.1 since d 1 1, so 0.d 1 d 2... 0.1 0.5 0.1 10 k since d k+1 5, by assumption 5 10 k 0.5 10 k+1. Case ➁ : d k+1 5. y fl(y) y 0.d 1...d k d k+1... 10 n (0.d 1...d k 10 n +10 n k ) 0.d 1...d k d k+1... 10 n 0.d 1...d k d k+1... 10 n (0.d 1...d k +10 k ) 10 n 0.d 1 d 2... 10 n 0.d 1...d k d k+1... 10 n 0.d 1...δ k 10 n 0.d 1 d 2... 10 n where δ k d k +1 0.d 1...d k d k+1... 0.d 1...δ k 0.d 1 d 2... k 1 0 s 0. { }} { 0...0 d k d k+1... 0. k 1 0 s { }} { 0...0 δ k 0.d 1 d 2... Note that 0.0...0 δ k > 0.0...0 d k d k+1..., and δ k d k +1,d k+1 5. For example, d k 1, d k+1,δ k 2. k 1 0 s 0. { }} { 0...005 0.5 0.d 1 d 2... 0.d 1 d 2... 10 k since d 1 1, so 0.d 1 d 2... 0.1 0.5 0.1 10 k 5 10 k 0.5 10 k+1. 9