Homework 2. Matthew Jin. April 10, 2014

Size: px
Start display at page:

Download "Homework 2. Matthew Jin. April 10, 2014"

Transcription

1 Homework Matthew Jin April 10, 014 1a) The relative error is given by ŷ y y, where ŷ represents the observed output value, and y represents the theoretical output value. In this case, the observed output value is 0, as shown in the following code: format long a=sqrt(1+10^(-16)); b=a-1 % b represents the actual function output Output: b = 0 Therefore, ŷ y y = 0 y y = y y = 1. So the relative error of a naive implementation of f(x) is 1. 1b) The first four terms of the Taylor series for f about zero may be determined by writing out the first 5 terms of the binomial expansion of (1 + x ) 1/, and then subtracting 1: (1 + x ) 1/ = 1 + ( ) n x + 1 ( ) n x 4 + ( ) n x ( ) n x 8, where n = 1/. 4 Note that although combinatorials do not make sense for fractional n, the formula for combinatorics still applies as a shorthand way of writing the coefficients of the binomial expansion. After plugging in n appropriately, the expression comes out to 1

2 f(x) = 1 + x! x4 8 + x6 16 5x = x! x4 8 + x6 16 5x8 18 1c) For this part, focus on which of the operations could result in catastrophic cancellation, which would in turn result in a magnified relative error. Consider separately the operation 1 + x ; in the computer, 1 + x is evaluated as 1 + x (1 + ɛ 1 ) = 1 + x + ɛ x 1 + x + ɛ 1, because x is very small. Overall, the machine would evaluate the expression 1 + x 1 and output (excluding the other, less significant errors present among the entire operation) 1 + x + ɛ 1 1. The relative error of the machine would overall be, letting the first term of the Taylor series of f(x) centered at 0 to be the theoretical value of 1 + x, 1+x +ɛ x +1 x = ɛ1 x ɛ mach x. To find the x c for which the relative error is about 10 1 for all x > x c, evaluate 10 1 = x, which yields an x c of about x c is on the order of 10. 1d) One would need the first three terms of the expression. One allows the absolute error to be dominated by the first omitted Taylor series term and lets x to be the approximation of the theoretical answer. The absolute error of the 4th Taylor series term is the one that most nearly results in a 1 digit accuracy: ɛ relative = , which indeed implies roughly 1 digits of.0141 accuracy, if one uses a three-term Taylor series approximation. 1e) Letting x c =.0141, one implements the following MATLAB code: format long x=.0141; %this value represents the calculated x_c a=(x^)/-(x^4)/8+(x^6)/16 % a represents the three-term taylor % approximation of the function at x_c

3 b=sqrt(1+x^)-1 % b represents the naive implementation s %approximation of the function at x_c reldiff=abs((a-b))/b %reldiff represents the relative %difference between the taylor approximation and the naive implementation Output: a = e-05 b = e-05 reldiff = e-1 One can see that indeed, the two outputs from the two methods differ relatively only on the order of a) Using the function goodnewton developed by Dan Cianci, I run the following script: f Df=@(x) 3*x^; goodnewton(f,df,1i,1*10^(-8)) Output: x0 = i x0 = 3

4 i x0 = i x0 = i x0 = i ans = i So one can see that the Newton iteration converges on The third root is 1 3. The three roots appear as follows: The angle between the three roots is π 3. To calculate this, let the root be re iθ. Then to determine the roots of f(z) = z 3 1, evaluate z 3 = 1. For some r and θ, r 3 e 3iθ = 1. In order for this to be true, 3iθ must be equal to some integer multiple of π, and r 3 must be equal to 1, becuase re iθ = r(cos(θ) + isin(θ)). 4

5 Thus, r=1 and θɛ[0, π 3, 4π 3 ], for three solutions: 0, π 3, 4π 3. Note that the angle between consecutive roots is π 3. This is because θ is equal to n π 3, for integer n. As one increments n by one, the angle between the roots increases by π 3. Finally, one knows that there are only three unique roots because the increments of π 3 for θ larger than 4π 3 will just cause the roots to cycle back to the ones already noted. b) The problem requires one to find all z of the form re iθ such that z 5 = r 5 e 5iθ =. As in part (a), this implies that r = 1 5 and θɛ[0, π 5, 4π 5, 6π 5, 8π 5 ]. Overall, the solutions are 1 5 e 0i, 1 5 e i π 5, 1 5 e i 4π 5, 1 5 e i 6π 5, and 1 5 e i 8π 5. c) The following code was used to determine in which of the three basins each point in the complex plane lies: a=-:.01:; [X,Y]=meshgrid(a,a); %set up the grid of values over the range and increment of a f=@(x) x.^3-1; Df=@(x) 3*x.^; tol=.01; Z=goodnewton(f,Df,X+Y*1i,tol); %call goodnewton, a modified version of Dan Cianci s % goodnewton, to output the value on which newton s iteration converges Z=sign(angle(Z)); %if the angle is pi/3, return "1", %if angle is 0, return "0" %if angle is -pi/3, return "-1" surf(x,y,z) imagesc(a,a,z); The code for goodnewton is as follows: function [ r ] = goodnewton( f,df,x0,tol ) %goodnewton uses Newton iteration to find a root of f with initial %guess x0 to the specified tolerance tol % % %Inputs: 5

6 %f,df are the function and derivative of the function respectively %x0 the initial starting point of the iteration %tol specifies the relative error of the first iterate and the last %iterate % % %Outputs: %r- the computed root % %Cianci 4/1/014, edited by Matthew Jin 4/9/014 x1 = x0 - f(x0)./df(x0); i=0; %implement the iteration 100 times for k=1:100 x0=x1; x1 = x0 - f(x0)./df(x0); end r=x1; end The resulting plot appears as follows: If one decreases the range of the meshgrid parameter, one can zoom in on smaller portions of the plot: 6

7 Decreasing the range of the meshgrid parameter by 10x and then by 100x, one can see that the shape of the original graph is still retained, indeed confirming that this figure is a fractal: 7

8 3a) κ = f (x)x f(x), so for the function sin 1 (x), κ(x) = x 1 x sin 1 (x), which eval uated at x= yields κ( ) = sin 1 ( ) b) Applying the same formula for κ as above to ln(x), one finds κ(x) = x 1 x ln(x) = 1 ln(x). This expression is large when ln(x) is small, which occurs in the neighborhood of x=1. 3c) The roots of the function f(x) = x x + c are given by the quadratic formula: r = ± 4 4c = 1 ± 1 c. Again applying the formula for κ to r, one finds κ(c) = ±c 1 (1 c) 1 1± 1 c c = (1± 1 c) = c 1 c (. If c = 1 c±(1 c)) , then κ( ) = 16 ( = ±( )) (10 8 ± This yields κ( ) = or The roots are a distance of 10 8 apart. 3d) A backwards stable algorithm will evaluate sin(10 10 ) as sin(10 10 ) = sin(10 10 (1 + ɛ)) = sin( ɛ) = sin(10 10 )cos(10 10 ɛ) + cos(10 10 )sin(10 10 ɛ) Let ɛ = Then sin(10 10 ) = sin(10 10 )cos(10 6 ) + cos(10 10 )sin(10 6 ). To further simplify this problem, consider the Taylor series expansions of cos(x) and sin(x). For small x, sin(x) x. On the other hand, for small x, cos(x) 1 x. Therefore, sin(10 6 ) 10 6, and cos(10 6 ) 1. 8

9 From here, one can see that sin(10 10 ) = sin(10 10 ) + cos(10 10 )sin(10 6 ). The latter term clearly indicates the absolute error; to find the relative error, we evaluate cos(1010 )sin(10 6 ) sin(10 10 ) The backwards-stable algorithm would therefore probably be accurate to about 6 digits when computing sin(10 10 ). 4) First, use Taylor s theorem to expand f(x + h) and f(x h) around x. f(x + h) = f(x) + f (x)(x + h x) + f (x) (x + h x) + f (x) 3! (x + h x) 3 + f (q) (x + h x) 4 = f(x) + f (x)(h) + f (x) (h ) + f (x) 3! (h 3 ) + f (q) (h 4 ), for some q between x and x+h. Similarly, substituting in x-h instead of x+h to the Taylor series, one gets f(x h) = f(x) + f (x)( h) + f (x) ( h) + f (x) 3! ( h) 3 + f (p) ( h) 4 for some p between x and x-h Thus, f(x+h) f(x)+f(x h) h evaluates to (after cancelling out the odd powered terms, due to them having equal magnitude and opposite sign), f(x)+f (x)(h )+ f f (x)+( f (q) + f (p) )(h ). Notice that the latter term represents the difference between f (x) and the computer s execution of the finite difference formula it is the error. Also, notice that f (q) + f (p) is a constant. Therefore, it immediately follows that the error for the finite difference formula for f (x) is O(h ). To use this formula to approximate the second derivative of sin(5x) at x=1, I created the following function: (q) (h 4 )+ f (p) (h 4 ) f(x) h = % This function accepts an input of h, and implements the finite difference % formula for f (x) for sin(5x) at x=1. It then computes the relative error of % this approximation against the theoretical value. % result=hp4(h) % Matthew Jin April 08, 014 function result=hp4(h) approx=(sin(5+5*h)-*sin(5)+sin(5-5*h))./(h.^); %implement the finite difference formula fo result=abs((approx-(-5*sin(5))))/(-5*sin(5)); %compute the relative error end I then implemented this function in a separate test script as follows: 9

10 format long x=10.^[-16:.05:0]; hp4(x),x); %apply function hp4 to each element in array x loglog(x,myanswer) The output graph of epsilon with respect to h on a logarithmic scale for epsilon on h appears as follows: This graph is reasonable. The error due to rounding is approximately going to be on the order of O( ɛ mach h ). This is because the computational errors in the numerator of the finite difference approximation may in the worst-case scenario constructively add machine error, which would then be divided by h. Furthermore, as proved just above, the error caused by the formula for finite difference approximation is on the order of O(h ). To find an approximation for the h at which error is minimal, one might thus set h = ( ɛ mach h ). This implies that h 10 4 will result in the minimal error, which is indeed what we see on the graph, after allowing for the effect of constant multipliers on the relative significance of the error due to the formula vs. rounding error the bottom of the V occurs in the neighborhood of One can see that for h larger than approximately 10 4, the Taylor series error takes over, with a slope on the log-scale graph of approximately (in that region, the relative error increases approximately 10 orders of magnitude over an increase of approximately 5 orders of magnitude of h). This corroborates the result proven just above, in which the formulaic error was proven to be O(h ). For h smaller than roughly 10 4, the rounding error takes over, with the error increasing with a slope of roughly as h shrinks (again, the error increases about 10 orders of magnitude over a decrease of about 5 orders of magnitude of h). This corroborates the idea that the rounding error occurs on the order O( ɛ mach h ). For h smaller than one can see that the graph becomes somewhat unpredictable, yet still appears 10

11 to maintain the slope of -. 5a) This MATLAB code would ideally run 10 times, and then terminate. In reality, it is an infinite loop. This is because decimals fractions, such as 0.1, cannot be expressed precisely in the floating point system. The computer therefore introduces some rounding error with each addition of 0.1. By the 10th addition, the error is large enough that the value that the computer should compute to be 1 is not, in fact, precisely equal to 1. This can be shown by running through the loop ten times in debug mode and then checking the difference between the output that should be 1 and 1. Below is the slightly modified code: format long x=0; while x~=1 keyboard x=x+.1 end Here is the output and the check: \begin{verbatim}

12 K>> x-1 ans = e-16 Clearly, the computer perceives some difference between what is displayed as 1 and 1, due to the error compounded with each addition of 0.1. To make this code go a precise number of times, one might use integer values rather than decimals in the code. Because integers are elements of the floating point system, the rounding error would be avoided. format long 1

13 x=0; while x~=10 x=x+1 end b) The relative error can be computed by evaluating Plugging this directly into MATLAB, one finds a relative error ɛ Because log (19 1 ) is about 130.9, it immediately follows that one would need about 130 digits of binary to precisely handle integers of this size. I evaluate 19 1 because it is slightly larger than c) Matrix multiplication of n-by-n matrices involves n multiplications and n-1 additions for each of the product matrix elements (for a total of n-1 operations per element), due to the nature of the dot product. In the product matrix there are n elements, so to perform the entire matrix multiplication n (n 1) operations must be done. By the same argument, to multiply an n-by-n matrix with a column vector of length n, one must perform n(n-1) operations (n elements in the product, n-1 operations to compute each element). To compute the product ABx, one can either compute (AB)x or A(Bx). Computing (AB)x would require n (n 1) + n(n 1) operations, whereas computing A(Bx) would require n(n 1) operations. For any n > 1, A(Bx) requires fewer operations, thus reducing the chance for error and reducing the amount of time the program might take to perform the multiplication. Therefore, it is the better way of computing ABx. Attribution: I worked with Michael Downs and Matt Marcus to reach some of the solutions in this homework. I also adapted Dan Cianci s Newton s method code for problem. 13

Homework and Computer Problems for Math*2130 (W17).

Homework and Computer Problems for Math*2130 (W17). Homework and Computer Problems for Math*2130 (W17). MARCUS R. GARVIE 1 December 21, 2016 1 Department of Mathematics & Statistics, University of Guelph NOTES: These questions are a bare minimum. You should

More information

Lecture 28 The Main Sources of Error

Lecture 28 The Main Sources of Error Lecture 28 The Main Sources of Error Truncation Error Truncation error is defined as the error caused directly by an approximation method For instance, all numerical integration methods are approximations

More information

Chapter 1: Preliminaries and Error Analysis

Chapter 1: Preliminaries and Error Analysis Chapter 1: Error Analysis Peter W. White white@tarleton.edu Department of Tarleton State University Summer 2015 / Numerical Analysis Overview We All Remember Calculus Derivatives: limit definition, sum

More information

One-Sided Difference Formula for the First Derivative

One-Sided Difference Formula for the First Derivative POLYTECHNIC UNIVERSITY Department of Computer and Information Science One-Sided Difference Formula for the First Derivative K. Ming Leung Abstract: Derive a one-sided formula for the first derive of a

More information

Introduction to Finite Di erence Methods

Introduction to Finite Di erence Methods Introduction to Finite Di erence Methods ME 448/548 Notes Gerald Recktenwald Portland State University Department of Mechanical Engineering gerry@pdx.edu ME 448/548: Introduction to Finite Di erence Approximation

More information

SET 1. (1) Solve for x: (a) e 2x = 5 3x

SET 1. (1) Solve for x: (a) e 2x = 5 3x () Solve for x: (a) e x = 5 3x SET We take natural log on both sides: ln(e x ) = ln(5 3x ) x = 3 x ln(5) Now we take log base on both sides: log ( x ) = log (3 x ln 5) x = log (3 x ) + log (ln(5)) x x

More information

1 Solutions to selected problems

1 Solutions to selected problems Solutions to selected problems Section., #a,c,d. a. p x = n for i = n : 0 p x = xp x + i end b. z = x, y = x for i = : n y = y + x i z = zy end c. y = (t x ), p t = a for i = : n y = y(t x i ) p t = p

More information

Numerical Derivatives in Scilab

Numerical Derivatives in Scilab Numerical Derivatives in Scilab Michaël Baudin February 2017 Abstract This document present the use of numerical derivatives in Scilab. In the first part, we present a result which is surprising when we

More information

Solution of Algebric & Transcendental Equations

Solution of Algebric & Transcendental Equations Page15 Solution of Algebric & Transcendental Equations Contents: o Introduction o Evaluation of Polynomials by Horner s Method o Methods of solving non linear equations o Bracketing Methods o Bisection

More information

1 What is numerical analysis and scientific computing?

1 What is numerical analysis and scientific computing? Mathematical preliminaries 1 What is numerical analysis and scientific computing? Numerical analysis is the study of algorithms that use numerical approximation (as opposed to general symbolic manipulations)

More information

Numerical Derivatives in Scilab

Numerical Derivatives in Scilab Numerical Derivatives in Scilab Michaël Baudin May 2009 Abstract This document present the use of numerical derivatives in Scilab. In the first part, we present a result which is surprising when we are

More information

1 Solutions to selected problems

1 Solutions to selected problems Solutions to selected problems Section., #a,c,d. a. p x = n for i = n : 0 p x = xp x + i end b. z = x, y = x for i = : n y = y + x i z = zy end c. y = (t x ), p t = a for i = : n y = y(t x i ) p t = p

More information

Elements of Floating-point Arithmetic

Elements of Floating-point Arithmetic Elements of Floating-point Arithmetic Sanzheng Qiao Department of Computing and Software McMaster University July, 2012 Outline 1 Floating-point Numbers Representations IEEE Floating-point Standards Underflow

More information

Math 128A: Homework 2 Solutions

Math 128A: Homework 2 Solutions Math 128A: Homework 2 Solutions Due: June 28 1. In problems where high precision is not needed, the IEEE standard provides a specification for single precision numbers, which occupy 32 bits of storage.

More information

Outline. Math Numerical Analysis. Intermediate Value Theorem. Lecture Notes Zeros and Roots. Joseph M. Mahaffy,

Outline. Math Numerical Analysis. Intermediate Value Theorem. Lecture Notes Zeros and Roots. Joseph M. Mahaffy, Outline Math 541 - Numerical Analysis Lecture Notes Zeros and Roots Joseph M. Mahaffy, jmahaffy@mail.sdsu.edu Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research

More information

The answer in each case is the error in evaluating the taylor series for ln(1 x) for x = which is 6.9.

The answer in each case is the error in evaluating the taylor series for ln(1 x) for x = which is 6.9. Brad Nelson Math 26 Homework #2 /23/2. a MATLAB outputs: >> a=(+3.4e-6)-.e-6;a- ans = 4.449e-6 >> a=+(3.4e-6-.e-6);a- ans = 2.224e-6 And the exact answer for both operations is 2.3e-6. The reason why way

More information

Math Numerical Analysis

Math Numerical Analysis Math 541 - Numerical Analysis Lecture Notes Zeros and Roots Joseph M. Mahaffy, jmahaffy@mail.sdsu.edu Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research Center

More information

Math 56 Homework 1 Michael Downs. ne n 10 + ne n (1)

Math 56 Homework 1 Michael Downs. ne n 10 + ne n (1) . Problem (a) Yes. The following equation: ne n + ne n () holds for all n R but, since we re only concerned with the asymptotic behavior as n, let us only consider n >. Dividing both sides by n( + ne n

More information

Summer Review for Students Entering AP Calculus AB

Summer Review for Students Entering AP Calculus AB Summer Review for Students Entering AP Calculus AB Class: Date: AP Calculus AB Summer Packet Please show all work in the spaces provided The answers are provided at the end of the packet Algebraic Manipulation

More information

Midterm Review. Igor Yanovsky (Math 151A TA)

Midterm Review. Igor Yanovsky (Math 151A TA) Midterm Review Igor Yanovsky (Math 5A TA) Root-Finding Methods Rootfinding methods are designed to find a zero of a function f, that is, to find a value of x such that f(x) =0 Bisection Method To apply

More information

Elements of Floating-point Arithmetic

Elements of Floating-point Arithmetic Elements of Floating-point Arithmetic Sanzheng Qiao Department of Computing and Software McMaster University July, 2012 Outline 1 Floating-point Numbers Representations IEEE Floating-point Standards Underflow

More information

1 Backward and Forward Error

1 Backward and Forward Error Math 515 Fall, 2008 Brief Notes on Conditioning, Stability and Finite Precision Arithmetic Most books on numerical analysis, numerical linear algebra, and matrix computations have a lot of material covering

More information

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

Lecture 7. Root finding I. 1 Introduction. 2 Graphical solution 1 Introduction Lecture 7 Root finding I For our present purposes, root finding is the process of finding a real value of x which solves the equation f (x)=0. Since the equation g x =h x can be rewritten

More information

INTRODUCTION, FOUNDATIONS

INTRODUCTION, FOUNDATIONS 1 INTRODUCTION, FOUNDATIONS ELM1222 Numerical Analysis Some of the contents are adopted from Laurene V. Fausett, Applied Numerical Analysis using MATLAB. Prentice Hall Inc., 1999 2 Today s lecture Information

More information

NUMERICAL MATHEMATICS & COMPUTING 6th Edition

NUMERICAL MATHEMATICS & COMPUTING 6th Edition NUMERICAL MATHEMATICS & COMPUTING 6th Edition Ward Cheney/David Kincaid c UT Austin Engage Learning: Thomson-Brooks/Cole www.engage.com www.ma.utexas.edu/cna/nmc6 September 1, 2011 2011 1 / 42 1.1 Mathematical

More information

PLC Papers. Created For:

PLC Papers. Created For: PLC Papers Created For: Algebra and proof 2 Grade 8 Objective: Use algebra to construct proofs Question 1 a) If n is a positive integer explain why the expression 2n + 1 is always an odd number. b) Use

More information

Problem ) Sample implementation of chaos.m

Problem ) Sample implementation of chaos.m PHYS 2: Intro. Computational Physics Fall 22 Homework 3 Key Note: The same observation made in the key to Homework 2 obviously applies here: there will always be many ways to solve problems that involve

More information

SECTION A. f(x) = ln(x). Sketch the graph of y = f(x), indicating the coordinates of any points where the graph crosses the axes.

SECTION A. f(x) = ln(x). Sketch the graph of y = f(x), indicating the coordinates of any points where the graph crosses the axes. SECTION A 1. State the maximal domain and range of the function f(x) = ln(x). Sketch the graph of y = f(x), indicating the coordinates of any points where the graph crosses the axes. 2. By evaluating f(0),

More information

Binary floating point

Binary floating point Binary floating point Notes for 2017-02-03 Why do we study conditioning of problems? One reason is that we may have input data contaminated by noise, resulting in a bad solution even if the intermediate

More information

CS 221 Lecture 9. Tuesday, 1 November 2011

CS 221 Lecture 9. Tuesday, 1 November 2011 CS 221 Lecture 9 Tuesday, 1 November 2011 Some slides in this lecture are from the publisher s slides for Engineering Computation: An Introduction Using MATLAB and Excel 2009 McGraw-Hill Today s Agenda

More information

Floating-point Computation

Floating-point Computation Chapter 2 Floating-point Computation 21 Positional Number System An integer N in a number system of base (or radix) β may be written as N = a n β n + a n 1 β n 1 + + a 1 β + a 0 = P n (β) where a i are

More information

JUST THE MATHS UNIT NUMBER DIFFERENTIATION APPLICATIONS 5 (Maclaurin s and Taylor s series) A.J.Hobson

JUST THE MATHS UNIT NUMBER DIFFERENTIATION APPLICATIONS 5 (Maclaurin s and Taylor s series) A.J.Hobson JUST THE MATHS UNIT NUMBER.5 DIFFERENTIATION APPLICATIONS 5 (Maclaurin s and Taylor s series) by A.J.Hobson.5. Maclaurin s series.5. Standard series.5.3 Taylor s series.5.4 Exercises.5.5 Answers to exercises

More information

Notes for Chapter 1 of. Scientific Computing with Case Studies

Notes for Chapter 1 of. Scientific Computing with Case Studies Notes for Chapter 1 of Scientific Computing with Case Studies Dianne P. O Leary SIAM Press, 2008 Mathematical modeling Computer arithmetic Errors 1999-2008 Dianne P. O'Leary 1 Arithmetic and Error What

More information

MATH ASSIGNMENT 03 SOLUTIONS

MATH ASSIGNMENT 03 SOLUTIONS MATH444.0 ASSIGNMENT 03 SOLUTIONS 4.3 Newton s method can be used to compute reciprocals, without division. To compute /R, let fx) = x R so that fx) = 0 when x = /R. Write down the Newton iteration for

More information

Tu: 9/3/13 Math 471, Fall 2013, Section 001 Lecture 1

Tu: 9/3/13 Math 471, Fall 2013, Section 001 Lecture 1 Tu: 9/3/13 Math 71, Fall 2013, Section 001 Lecture 1 1 Course intro Notes : Take attendance. Instructor introduction. Handout : Course description. Note the exam days (and don t be absent). Bookmark the

More information

Halley s Method: A Cubically Converging. Method of Root Approximation

Halley s Method: A Cubically Converging. Method of Root Approximation Halley s Method: A Cubically Converging Method of Root Approximation Gabriel Kramer Brittany Sypin December 3, 2011 Abstract This paper will discuss numerical ways of approximating the solutions to the

More information

CMSC Discrete Mathematics SOLUTIONS TO SECOND MIDTERM EXAM November, 2005

CMSC Discrete Mathematics SOLUTIONS TO SECOND MIDTERM EXAM November, 2005 CMSC-37110 Discrete Mathematics SOLUTIONS TO SECOND MIDTERM EXAM November, 2005 Instructor: László Babai Ryerson 164 e-mail: laci@cs This exam contributes 20% to your course grade. 1. (6 points) Let a

More information

Math Practice Exam 3 - solutions

Math Practice Exam 3 - solutions Math 181 - Practice Exam 3 - solutions Problem 1 Consider the function h(x) = (9x 2 33x 25)e 3x+1. a) Find h (x). b) Find all values of x where h (x) is zero ( critical values ). c) Using the sign pattern

More information

Arithmetic and Error. How does error arise? How does error arise? Notes for Part 1 of CMSC 460

Arithmetic and Error. How does error arise? How does error arise? Notes for Part 1 of CMSC 460 Notes for Part 1 of CMSC 460 Dianne P. O Leary Preliminaries: Mathematical modeling Computer arithmetic Errors 1999-2006 Dianne P. O'Leary 1 Arithmetic and Error What we need to know about error: -- how

More information

Section x7 +

Section x7 + Difference Equations to Differential Equations Section 5. Polynomial Approximations In Chapter 3 we discussed the problem of finding the affine function which best approximates a given function about some

More information

Problem 1 Kaplan, p. 436: 2c,i

Problem 1 Kaplan, p. 436: 2c,i Mathematical Methods I - Fall 03 Homework Solutions Page Problem Kaplan, p 36: c,i Find the first three nonzero terms of the following Taylor series: c) ln + x) about x = 0 i) arctanh x about x = 0 The

More information

Numerical Mathematical Analysis

Numerical Mathematical Analysis Numerical Mathematical Analysis Numerical Mathematical Analysis Catalin Trenchea Department of Mathematics University of Pittsburgh September 20, 2010 Numerical Mathematical Analysis Math 1070 Numerical

More information

Introduction to Techniques for Counting

Introduction to Techniques for Counting Introduction to Techniques for Counting A generating function is a device somewhat similar to a bag. Instead of carrying many little objects detachedly, which could be embarrassing, we put them all in

More information

1 Solving Algebraic Equations

1 Solving Algebraic Equations Arkansas Tech University MATH 1203: Trigonometry Dr. Marcel B. Finan 1 Solving Algebraic Equations This section illustrates the processes of solving linear and quadratic equations. The Geometry of Real

More information

Notes on floating point number, numerical computations and pitfalls

Notes on floating point number, numerical computations and pitfalls Notes on floating point number, numerical computations and pitfalls November 6, 212 1 Floating point numbers An n-digit floating point number in base β has the form x = ±(.d 1 d 2 d n ) β β e where.d 1

More information

Homework 2 - Solutions MA/CS 375, Fall 2005

Homework 2 - Solutions MA/CS 375, Fall 2005 Homework 2 - Solutions MA/CS 375, Fall 2005 1. Use the bisection method, Newton s method, and the Matlab R function fzero to compute a positive real number x satisfying: sinh x = cos x. For each of the

More information

1. Method 1: bisection. The bisection methods starts from two points a 0 and b 0 such that

1. Method 1: bisection. The bisection methods starts from two points a 0 and b 0 such that Chapter 4 Nonlinear equations 4.1 Root finding Consider the problem of solving any nonlinear relation g(x) = h(x) in the real variable x. We rephrase this problem as one of finding the zero (root) of a

More information

Chapter 1: Introduction and mathematical preliminaries

Chapter 1: Introduction and mathematical preliminaries Chapter 1: Introduction and mathematical preliminaries Evy Kersalé September 26, 2011 Motivation Most of the mathematical problems you have encountered so far can be solved analytically. However, in real-life,

More information

Math 113 HW #10 Solutions

Math 113 HW #10 Solutions Math HW #0 Solutions 4.5 4. Use the guidelines of this section to sketch the curve Answer: Using the quotient rule, y = x x + 9. y = (x + 9)(x) x (x) (x + 9) = 8x (x + 9). Since the denominator is always

More information

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b) Numerical Methods - PROBLEMS. The Taylor series, about the origin, for log( + x) is x x2 2 + x3 3 x4 4 + Find an upper bound on the magnitude of the truncation error on the interval x.5 when log( + x)

More information

Homework 2 Foundations of Computational Math 1 Fall 2018

Homework 2 Foundations of Computational Math 1 Fall 2018 Homework 2 Foundations of Computational Math 1 Fall 2018 Note that Problems 2 and 8 have coding in them. Problem 2 is a simple task while Problem 8 is very involved (and has in fact been given as a programming

More information

MATH 31B: MIDTERM 2 REVIEW. sin 2 x = 1 cos(2x) dx = x 2 sin(2x) 4. + C = x 2. dx = x sin(2x) + C = x sin x cos x

MATH 31B: MIDTERM 2 REVIEW. sin 2 x = 1 cos(2x) dx = x 2 sin(2x) 4. + C = x 2. dx = x sin(2x) + C = x sin x cos x MATH 3B: MIDTERM REVIEW JOE HUGHES. Evaluate sin x and cos x. Solution: Recall the identities cos x = + cos(x) Using these formulas gives cos(x) sin x =. Trigonometric Integrals = x sin(x) sin x = cos(x)

More information

Numerical Methods. King Saud University

Numerical Methods. King Saud University Numerical Methods King Saud University Aims In this lecture, we will... Introduce the topic of numerical methods Consider the Error analysis and sources of errors Introduction A numerical method which

More information

Subtract 16 from both sides. Divide both sides by 9. b. Will the swing touch the ground? Explain how you know.

Subtract 16 from both sides. Divide both sides by 9. b. Will the swing touch the ground? Explain how you know. REVIEW EXAMPLES 1) Solve 9x + 16 = 0 for x. 9x + 16 = 0 9x = 16 Original equation. Subtract 16 from both sides. 16 x 9 Divide both sides by 9. 16 x Take the square root of both sides. 9 4 x i 3 Evaluate.

More information

2. Determine the domain of the function. Verify your result with a graph. f(x) = 25 x 2

2. Determine the domain of the function. Verify your result with a graph. f(x) = 25 x 2 29 April PreCalculus Final Review 1. Find the slope and y-intercept (if possible) of the equation of the line. Sketch the line: y = 3x + 13 2. Determine the domain of the function. Verify your result with

More information

Math Introduction to Numerical Methods - Winter 2011 Homework 2 Assigned: Friday, January 14, Due: Thursday, January 27,

Math Introduction to Numerical Methods - Winter 2011 Homework 2 Assigned: Friday, January 14, Due: Thursday, January 27, Math 371 - Introduction to Numerical Methods - Winter 2011 Homework 2 Assigned: Friday, January 14, 2011. Due: Thursday, January 27, 2011.. Include a cover page. You do not need to hand in a problem sheet.

More information

MAT128A: Numerical Analysis Lecture Three: Condition Numbers

MAT128A: Numerical Analysis Lecture Three: Condition Numbers MAT128A: Numerical Analysis Lecture Three: Condition Numbers October 1, 2018 Lecture 1 October 1, 2018 1 / 26 An auspicious example Last time, we saw that the naive evaluation of the function f (x) = 1

More information

Power Series Solutions We use power series to solve second order differential equations

Power Series Solutions We use power series to solve second order differential equations Objectives Power Series Solutions We use power series to solve second order differential equations We use power series expansions to find solutions to second order, linear, variable coefficient equations

More information

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel

LECTURE NOTES ELEMENTARY NUMERICAL METHODS. Eusebius Doedel LECTURE NOTES on ELEMENTARY NUMERICAL METHODS Eusebius Doedel TABLE OF CONTENTS Vector and Matrix Norms 1 Banach Lemma 20 The Numerical Solution of Linear Systems 25 Gauss Elimination 25 Operation Count

More information

Section 11.1: Sequences

Section 11.1: Sequences Section 11.1: Sequences In this section, we shall study something of which is conceptually simple mathematically, but has far reaching results in so many different areas of mathematics - sequences. 1.

More information

Preliminary Examination, Numerical Analysis, August 2016

Preliminary Examination, Numerical Analysis, August 2016 Preliminary Examination, Numerical Analysis, August 2016 Instructions: This exam is closed books and notes. The time allowed is three hours and you need to work on any three out of questions 1-4 and any

More information

Ch 7 Summary - POLYNOMIAL FUNCTIONS

Ch 7 Summary - POLYNOMIAL FUNCTIONS Ch 7 Summary - POLYNOMIAL FUNCTIONS 1. An open-top box is to be made by cutting congruent squares of side length x from the corners of a 8.5- by 11-inch sheet of cardboard and bending up the sides. a)

More information

Floating Point Number Systems. Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le

Floating Point Number Systems. Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le Floating Point Number Systems Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le 1 Overview Real number system Examples Absolute and relative errors Floating point numbers Roundoff

More information

5. Hand in the entire exam booklet and your computer score sheet.

5. Hand in the entire exam booklet and your computer score sheet. WINTER 2016 MATH*2130 Final Exam Last name: (PRINT) First name: Student #: Instructor: M. R. Garvie 19 April, 2016 INSTRUCTIONS: 1. This is a closed book examination, but a calculator is allowed. The test

More information

(c) Find the equation of the degree 3 polynomial that has the same y-value, slope, curvature, and third derivative as ln(x + 1) at x = 0.

(c) Find the equation of the degree 3 polynomial that has the same y-value, slope, curvature, and third derivative as ln(x + 1) at x = 0. Chapter 7 Challenge problems Example. (a) Find the equation of the tangent line for ln(x + ) at x = 0. (b) Find the equation of the parabola that is tangent to ln(x + ) at x = 0 (i.e. the parabola has

More information

UNC Charlotte 2004 Algebra with solutions

UNC Charlotte 2004 Algebra with solutions with solutions March 8, 2004 1. Let z denote the real number solution to of the digits of z? (A) 13 (B) 14 (C) 15 (D) 16 (E) 17 3 + x 1 = 5. What is the sum Solution: E. Square both sides twice to get

More information

1 ERROR ANALYSIS IN COMPUTATION

1 ERROR ANALYSIS IN COMPUTATION 1 ERROR ANALYSIS IN COMPUTATION 1.2 Round-Off Errors & Computer Arithmetic (a) Computer Representation of Numbers Two types: integer mode (not used in MATLAB) floating-point mode x R ˆx F(β, t, l, u),

More information

Homework #4 Solutions

Homework #4 Solutions Homework #4 Solutions 1. f(x) = e x + e 1+sin(x) + cos (x) f (x) = e x + cos(x) e 1+sin(x) sin (x) f (x) = e x + e 1+sin(x) (cos (x) sin(x)) cos (x) f (x) = (1 3e 1+sin(x) cos(x)) sin(x) + e 1+sin(x) (cos

More information

Computer Arithmetic. MATH 375 Numerical Analysis. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Computer Arithmetic

Computer Arithmetic. MATH 375 Numerical Analysis. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Computer Arithmetic Computer Arithmetic MATH 375 Numerical Analysis J. Robert Buchanan Department of Mathematics Fall 2013 Machine Numbers When performing arithmetic on a computer (laptop, desktop, mainframe, cell phone,

More information

Number Systems III MA1S1. Tristan McLoughlin. December 4, 2013

Number Systems III MA1S1. Tristan McLoughlin. December 4, 2013 Number Systems III MA1S1 Tristan McLoughlin December 4, 2013 http://en.wikipedia.org/wiki/binary numeral system http://accu.org/index.php/articles/1558 http://www.binaryconvert.com http://en.wikipedia.org/wiki/ascii

More information

Some notes on applying computational divided differencing in optimization

Some notes on applying computational divided differencing in optimization Some notes on applying computational divided differencing in optimization Stephen A. Vavasis arxiv:1307.4097v1 [math.oc] 15 Jul 2013 May 7, 2014 Abstract We consider the problem of accurate computation

More information

MATH 163 HOMEWORK Week 13, due Monday April 26 TOPICS. c n (x a) n then c n = f(n) (a) n!

MATH 163 HOMEWORK Week 13, due Monday April 26 TOPICS. c n (x a) n then c n = f(n) (a) n! MATH 63 HOMEWORK Week 3, due Monday April 6 TOPICS 4. Taylor series Reading:.0, pages 770-77 Taylor series. If a function f(x) has a power series representation f(x) = c n (x a) n then c n = f(n) (a) ()

More information

Example 1 Which of these functions are polynomials in x? In the case(s) where f is a polynomial,

Example 1 Which of these functions are polynomials in x? In the case(s) where f is a polynomial, 1. Polynomials A polynomial in x is a function of the form p(x) = a 0 + a 1 x + a 2 x 2 +... a n x n (a n 0, n a non-negative integer) where a 0, a 1, a 2,..., a n are constants. We say that this polynomial

More information

Introduction CSE 541

Introduction CSE 541 Introduction CSE 541 1 Numerical methods Solving scientific/engineering problems using computers. Root finding, Chapter 3 Polynomial Interpolation, Chapter 4 Differentiation, Chapter 4 Integration, Chapters

More information

27 Wyner Math 2 Spring 2019

27 Wyner Math 2 Spring 2019 27 Wyner Math 2 Spring 2019 CHAPTER SIX: POLYNOMIALS Review January 25 Test February 8 Thorough understanding and fluency of the concepts and methods in this chapter is a cornerstone to success in the

More information

First and Last Name: 2. Correct The Mistake Determine whether these equations are false, and if so write the correct answer.

First and Last Name: 2. Correct The Mistake Determine whether these equations are false, and if so write the correct answer. . Correct The Mistake Determine whether these equations are false, and if so write the correct answer. ( x ( x (a ln + ln = ln(x (b e x e y = e xy (c (d d dx cos(4x = sin(4x 0 dx xe x = (a This is an incorrect

More information

SOLUTION OF ALGEBRAIC AND TRANSCENDENTAL EQUATIONS BISECTION METHOD

SOLUTION OF ALGEBRAIC AND TRANSCENDENTAL EQUATIONS BISECTION METHOD BISECTION METHOD If a function f(x) is continuous between a and b, and f(a) and f(b) are of opposite signs, then there exists at least one root between a and b. It is shown graphically as, Let f a be negative

More information

Subtract 6 to both sides Divide by 2 on both sides. Cross Multiply. Answer: x = -9

Subtract 6 to both sides Divide by 2 on both sides. Cross Multiply. Answer: x = -9 Subtract 6 to both sides Divide by 2 on both sides Answer: x = -9 Cross Multiply. = 3 Distribute 2 to parenthesis Combine like terms Subtract 4x to both sides Subtract 10 from both sides x = -20 Subtract

More information

Chapter 1 Mathematical Preliminaries and Error Analysis

Chapter 1 Mathematical Preliminaries and Error Analysis Chapter 1 Mathematical Preliminaries and Error Analysis Per-Olof Persson persson@berkeley.edu Department of Mathematics University of California, Berkeley Math 128A Numerical Analysis Limits and Continuity

More information

Section 1.3 Evaluating Limits Analytically

Section 1.3 Evaluating Limits Analytically Section 1.3 Evaluating Limits Analytically Welcome to BC Calculus Wed August 7 th Use Graph and Table to find limits: BC: 1.1-1.4 Due Monday night (extension) CalcChat WolframAlpha Bin not black hole Epsilon

More information

Who am I? Math 1080: Numerical Linear Algebra. Books. Format

Who am I? Math 1080: Numerical Linear Algebra. Books. Format Who am I? Math 18: Numerical Linear Algebra M M Sussman sussmanm@mathpittedu Office Hours: MW 1:45PM-2:45PM, Thack 622 Part-time faculty in Math Dept Experience at Bettis lab Administer 27/271 Numerical

More information

Root Finding Convergence Analysis

Root Finding Convergence Analysis Root Finding Convergence Analysis Justin Ross & Matthew Kwitowski November 5, 2012 There are many different ways to calculate the root of a function. Some methods are direct and can be done by simply solving

More information

Math 471. Numerical methods Introduction

Math 471. Numerical methods Introduction Math 471. Numerical methods Introduction Section 1.1 1.4 of Bradie 1.1 Algorithms Here is an analogy between Numerical Methods and Gastronomy: Calculus, Lin Alg., Diff. eq. Ingredients Algorithm Recipe

More information

5.3. Polynomials and Polynomial Functions

5.3. Polynomials and Polynomial Functions 5.3 Polynomials and Polynomial Functions Polynomial Vocabulary Term a number or a product of a number and variables raised to powers Coefficient numerical factor of a term Constant term which is only a

More information

Introductory Numerical Analysis

Introductory Numerical Analysis Introductory Numerical Analysis Lecture Notes December 16, 017 Contents 1 Introduction to 1 11 Floating Point Numbers 1 1 Computational Errors 13 Algorithm 3 14 Calculus Review 3 Root Finding 5 1 Bisection

More information

Lecture 44. Better and successive approximations x2, x3,, xn to the root are obtained from

Lecture 44. Better and successive approximations x2, x3,, xn to the root are obtained from Lecture 44 Solution of Non-Linear Equations Regula-Falsi Method Method of iteration Newton - Raphson Method Muller s Method Graeffe s Root Squaring Method Newton -Raphson Method An approximation to the

More information

Numerical Solution of Differential

Numerical Solution of Differential Chapter 14 Numerical Solution of Differential Equations We have considered numerical solution procedures for two kinds of equations: In chapter 10 the unknown was a real number; in chapter 6 the unknown

More information

Homework No. 2 Solutions TA: Theo Drivas

Homework No. 2 Solutions TA: Theo Drivas 550.386 Homework No. Solutions TA: Theo Drivas Problem 1. (a) Consider the initial-value problems for the following two differential equations: (i) dy/dt = y, y(0) = y 0, (ii) dy/dt = y, y(0) = y 0. Use

More information

Section September 6, If n = 3, 4, 5,..., the polynomial is called a cubic, quartic, quintic, etc.

Section September 6, If n = 3, 4, 5,..., the polynomial is called a cubic, quartic, quintic, etc. Section 2.1-2.2 September 6, 2017 1 Polynomials Definition. A polynomial is an expression of the form a n x n + a n 1 x n 1 + + a 1 x + a 0 where each a 0, a 1,, a n are real numbers, a n 0, and n is a

More information

Today s class. Numerical differentiation Roots of equation Bracketing methods. Numerical Methods, Fall 2011 Lecture 4. Prof. Jinbo Bi CSE, UConn

Today s class. Numerical differentiation Roots of equation Bracketing methods. Numerical Methods, Fall 2011 Lecture 4. Prof. Jinbo Bi CSE, UConn Today s class Numerical differentiation Roots of equation Bracketing methods 1 Numerical Differentiation Finite divided difference First forward difference First backward difference Lecture 3 2 Numerical

More information

STEP Support Programme. Pure STEP 1 Questions

STEP Support Programme. Pure STEP 1 Questions STEP Support Programme Pure STEP 1 Questions 2012 S1 Q4 1 Preparation Find the equation of the tangent to the curve y = x at the point where x = 4. Recall that x means the positive square root. Solve the

More information

MATH141: Calculus II Exam #4 review solutions 7/20/2017 Page 1

MATH141: Calculus II Exam #4 review solutions 7/20/2017 Page 1 MATH4: Calculus II Exam #4 review solutions 7/0/07 Page. The limaçon r = + sin θ came up on Quiz. Find the area inside the loop of it. Solution. The loop is the section of the graph in between its two

More information

Chapter 4. Solution of Non-linear Equation. Module No. 1. Newton s Method to Solve Transcendental Equation

Chapter 4. Solution of Non-linear Equation. Module No. 1. Newton s Method to Solve Transcendental Equation Numerical Analysis by Dr. Anita Pal Assistant Professor Department of Mathematics National Institute of Technology Durgapur Durgapur-713209 email: anita.buie@gmail.com 1 . Chapter 4 Solution of Non-linear

More information

x 2 x n r n J(x + t(x x ))(x x )dt. For warming-up we start with methods for solving a single equation of one variable.

x 2 x n r n J(x + t(x x ))(x x )dt. For warming-up we start with methods for solving a single equation of one variable. Maria Cameron 1. Fixed point methods for solving nonlinear equations We address the problem of solving an equation of the form (1) r(x) = 0, where F (x) : R n R n is a vector-function. Eq. (1) can be written

More information

1 + lim. n n+1. f(x) = x + 1, x 1. and we check that f is increasing, instead. Using the quotient rule, we easily find that. 1 (x + 1) 1 x (x + 1) 2 =

1 + lim. n n+1. f(x) = x + 1, x 1. and we check that f is increasing, instead. Using the quotient rule, we easily find that. 1 (x + 1) 1 x (x + 1) 2 = Chapter 5 Sequences and series 5. Sequences Definition 5. (Sequence). A sequence is a function which is defined on the set N of natural numbers. Since such a function is uniquely determined by its values

More information

Errors. Intensive Computation. Annalisa Massini 2017/2018

Errors. Intensive Computation. Annalisa Massini 2017/2018 Errors Intensive Computation Annalisa Massini 2017/2018 Intensive Computation - 2017/2018 2 References Scientific Computing: An Introductory Survey - Chapter 1 M.T. Heath http://heath.cs.illinois.edu/scicomp/notes/index.html

More information

Math 578: Assignment 2

Math 578: Assignment 2 Math 578: Assignment 2 13. Determine whether the natural cubic spline that interpolates the table is or is not the x 0 1 2 3 y 1 1 0 10 function 1 + x x 3 x [0, 1] f(x) = 1 2(x 1) 3(x 1) 2 + 4(x 1) 3 x

More information

5.6 Logarithmic and Exponential Equations

5.6 Logarithmic and Exponential Equations SECTION 5.6 Logarithmic and Exponential Equations 305 5.6 Logarithmic and Exponential Equations PREPARING FOR THIS SECTION Before getting started, review the following: Solving Equations Using a Graphing

More information

Section 4.1: Polynomial Functions and Models

Section 4.1: Polynomial Functions and Models Section 4.1: Polynomial Functions and Models Learning Objectives: 1. Identify Polynomial Functions and Their Degree 2. Graph Polynomial Functions Using Transformations 3. Identify the Real Zeros of a Polynomial

More information

Numerical Algorithms. IE 496 Lecture 20

Numerical Algorithms. IE 496 Lecture 20 Numerical Algorithms IE 496 Lecture 20 Reading for This Lecture Primary Miller and Boxer, Pages 124-128 Forsythe and Mohler, Sections 1 and 2 Numerical Algorithms Numerical Analysis So far, we have looked

More information