Introduction to Finite Di erence Methods
|
|
- Virginia Gwen Lloyd
- 6 years ago
- Views:
Transcription
1 Introduction to Finite Di erence Methods ME 448/548 Notes Gerald Recktenwald Portland State University Department of Mechanical Engineering ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation Overview 1. Review of basic numerical analysis 2. Finite di erence notation 3. Finite di erence approximations ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 1
2 Preliminary Considerations from Numerical Analysis ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 2 Important Ideas from Numerical Analysis 1. Symbolic versus numeric calculation 2. Numerical arithmetic and the floating point number line 3. Catastrophic cancellation errors 4. Machine precision and roundo 5. Truncation error Note: Examples in these slides will use Matlab. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 3
3 Symbolic versus Numeric Calculation Commercial software for symbolic computation Derive TM MACSYMA TM Maple TM Mathematica TM Symbolic calculations are exact. No rounding occurs because symbols and algebraic relationships are manipulated without storing numerical values. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 4 Symbolic versus Numeric Calculation Example: Evaluate f( ) =1 sin 2 cos 2 with Matlab >> theta = 30*pi/180; >> f = 1 - sin(theta)^2 - cos(theta)^2 f = e-16 f is close to, but not exactly equal to zero because of roundo. Also note that f is a single value, not a formula. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 5
4 Numerical Arithmetic Engineering analysis is usually done with real numbers. Infinite in range. Infinite in precision Computer architecture imposes limits on numerical values. Finite range. Finite precision Finite precision is significantly more problematic than finite range. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 6 Integer Arithmetic Operation Result 2+2=4 integer 9 7=63 integer 12 =4 3 integer 29 =2 13 exact result is not an integer 29 = exact result is not an integer ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 7
5 Floating Point Arithmetic Operation Floating Point Value is =4 exact =63 exact 12.0 =4 exact = approximate = approximate ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 8 Floating Point Number Line Compare floating point numbers to real numbers. Range Precision Real numbers Infinite: arbitrarily large and arbitrarily small real numbers exist. Infinite: Thereisaninfiniteset of real numbers between any two real numbers. Floating point numbers Finite: the number of bits allocated to the exponent limit the magnitude of floating point values. Finite: thereisafinitenumber (perhaps zero) of floating point values between any two floating point values. In other words: The floating point number line is a subset of the real number line. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 9
6 Floating Point Number Line denormal overflow usable range underflow underflow usable range overflow realmax realmin realmin realmax zoom-in view ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 10 Catastrophic Cancellation Errors (1) The errors in c = a + b and c = a b will be large when a b or a b. Consider c = a + b with a = x.xxx b = y.yyy where x and y are decimal digits. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 11
7 Catastrophic Cancellation Errors (1) Evaluate c = a + b with a = x.xxx and b = y.yyy Assume for convenience of exposition that z = x + y < 10. z available precision } { x.xxx xxxx xxxx xxxx yyyy yyyy yyyy yyyy = x.xxx xxxx zzzz zzzz yyyy yyyy {z } lost digits The most significant digits of a are retained, but the least significant digits of b are lost because of the mismatch in magnitude of a and b. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 12 Catastrophic Cancellation Errors (2) For subtraction: Theerrorin will be large when a b. c = a b Consider c = a b with a = x.xxxxxxxxxxx1ssssss b = x.xxxxxxxxxxx0tttttt where x, y, s and t are decimal digits. The digits sss... and ttt... are lost when a and b are stored in double-precision, floating point format. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 13
8 Catastrophic Cancellation Errors (3) Evaluate a b in double precision floating point arithmetic when a = x.xxx xxxx xxxx 1 and b = x.xxx xxxx xxxx 0 z available precision } { x.xxx xxxx xxxx 1 x.xxx xxxx xxxx 0 = uuuu uuuu uuuu {z } unassigned digits = 1.uuuu uuuu uuuu The result has only one significant digit. Values for the uuuu digits are not necessarily zero. The absolute error in the result is small compared to either a or b. Therelative error in the result is large because ssssss tttttt 6= uuuuuu (except by chance). ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 14 Catastrophic Cancellation Errors (4) Summary: Cancellation errors Occur in addition + or subtraction when or Occur in subtraction: when Are caused by a single operation (hence the term catastrophic ) not a slow accumulation of errors. Can often be minimized by algebraic rearrangement of the troublesome formula. (Cf. improved quadratic formula.) Note: roundo errors that are not catastrophic can also cause problems. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 15
9 Machine Precision The magnitude of roundo errors is quantified by machine precision " m. There is a number, " m > 0, suchthat whenever < " m. 1+ =1 In exact arithmetic 1+ =1only when =0,soinexactarithmetic" m is identically zero. Matlab uses double precision (64 bit) arithmetic. The built-in variable eps stores the value of " m. eps = ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 16 Implications for Routine Calculations Floating point comparisons should test for close enough instead of exact equality. Express close in terms of or absolute di erence, x y x y relative di erence, x ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 17
10 Floating Point Comparison Don t ask, is x equal to y?. if x==y % Don t do this... end Instead ask, are x and y close enough in value? if abs(x-y) < tol... end ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 18 Practical Implications: Absolute and Relative Error (1) Close enough can be measured with absolute di erence or relative di erence, or both. Let = an exact or reference value, and b = the value we have computed Absolute error Relative error E abs (b ) = b E rel (b ) = b ref Often we choose ref = so that E rel (b ) = b ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 19
11 Absolute and Relative Error (2) Example: Approximating sin(x) for small x Since sin(x) =x x 3 3! + x5 5!... we can approximate sin(x) with for small enough x < 1 sin(x) x ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 20 Absolute and Relative Error (3) The absolute error in approximating sin(x) x for small x is E abs = x sin(x) = x3 3! x 5 5! +... And the relative error is E abs = x sin(x) sin(x) = x sin(x) 1 ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 21
12 Absolute and Relative Error (4) Plot relative and absolute error in approximating sin(x) with x. Although the absolute error is relatively flat around x =0,the relative error grows more quickly. 20 x Error in approximating sin(x) with x Absolute Error Relative Error The relative error grows quickly because the absolute value of sin(x) is small near x =0. Error x (radians) ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 22 Practical Implications: Iteration termination (1) An iteration generates a sequence of scalar values x k, k =1, 2, 3,... The sequence converges to a limit,, if x k <, for all k>n, where is a small. In practice, the test is usually expressed as x k+1 x k <, when k>n. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 23
13 Absolute convergence criterion Iteration termination (2) Iterate until x x old < a where a is the absolute convergence tolerance. In Matlab: x =... % initialize xold =... while abs(x-xold) > deltaa xold = x; update x end ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 24 Relative convergence criterion Iteration termination (3) Iterate until x x old x ref < r where r is the absolute convergence tolerance. In Matlab: x =... % initialize xold =... xref =... while abs((x-xold)/xref) > deltar xold = x; update x end ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 25
14 Truncation Error: Distinct from Roundo Error Consider the series for sin(x) sin(x) =x x 3 3! + x5 5! For small x, only a few terms are needed to get a good approximation to sin(x). The terms are truncated f true = f sum + truncation error The size of the truncation error depends on x and the number of terms included in f sum. For typical work we can only estimate the truncation error. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 26 Truncation error in the series approximation of sin(x) (1) function ssum = sinser(x,tol,n) % sinser Evaluate the series representation of the sine function % % Input: x = argument of the sine function, i.e., compute sin(x) % tol = tolerance on accumulated sum. % n = maximum number of terms. % % Output: ssum = value of series sum after nterms or tolerance is met term = x; ssum = term; % Initialize series fprintf( Series approximation to sin(%f)\n\n k term ssum\n,x); fprintf( %3d %11.3e %12.8f\n,1,term,ssum); for k=3:2:(2*n-1) term = -term * x*x/(k*(k-1)); % Next term in the series ssum = ssum + term; fprintf( %3d %11.3e %12.8f\n,k,term,ssum); if abs(term/ssum)<tol, break; end % True at convergence end fprintf( \ntruncation error after %d terms is %g\n\n,(k+1)/2,abs(ssum-sin(x))); ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 27
15 Truncation error in the series approximation of sin(x) (2) For small x, theseriesforsin(x) converges in a few terms >> s = sinser(pi/6,5e-9,15); Series approximation to sin( ) k term ssum e e e e e e Truncation error after 6 terms is e-014 ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 28 Truncation error in the series approximation of sin(x) (3) The truncation error in the series is small relative to the true value of sin( /6) >> s = sinser(pi/6,5e-9,15);. >> err = (s-sin(pi/6))/sin(pi/6) err = e-014 ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 29
16 Truncation error in the series approximation of sin(x) (4) For larger x, the series for sin(x) converges more slowly >> s = sinser(15*pi/6,5e-9,15); Series approximation to sin( ) k term ssum e e e e e e Truncation error after 15 terms is e-007 More terms are needed to reach a converge tolerance of ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 30 Taylor Series: a tool for analyzing truncation error For a su ciently continuous function f(x) defined on the interval x 2 [a, b] we define the n th order Taylor Series approximation P n (x) P n (x) =f(x 0 )+(x x 0 ) df + (x x 0) 2 dx x=x0 2 d 2 f + + (x dx 2 x=x 0 n! x 0) n d n f dx n x=x 0 Then there exists with x 0 apple apple x such that f(x) =P n (x) +R n (x) where R n (x) = (x x 0) (n+1) (n + 1)! d (n+1) f dx (n+1) x= ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 31
17 Big O notation Big O notation f(x) =P n (x) +O (x x! 0) (n+1) (n + 1)! or, for x x 0 = h we say f(x) =P n (x) +O h (n+1) The Big O lumps multiplicative factors (like 1/(n + 1)!) into constants which are (usually) ignored. When working with Big O notation, we focus on the power of the term inside the parenthesis. Since h! 0 as we refine the computations, larger powers are more beneficial. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 32 Taylor Series Example Consider the function f(x) = 1 1 x The Taylor Series approximations to f(x) of order 1, 2 and 3 are P 1 (x) = P 2 (x) = P 3 (x) = 1 1 x 0 + x x 0 (1 x 0 ) x x 0 1 x 0 (1 x 0 ) + (x x 0) 2 2 (1 x 0 ) x x 0 1 x 0 (1 x 0 ) + (x x 0) 2 2 (1 x 0 ) + (x x 0) 3 3 (1 x 0 ) 4 ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 33
18 Taylor Series: P i (x) near x =1.6 (5) Approximations to f(x) = 1/(1 x) exact P 1 (x) P 2 (x) P 3 (x) x ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 34 Roundo and Truncation Errors (1) Both roundo and truncation errors occur in numerical computation. Example: Finite di erence approximation to f 0 (x) =df /dx f 0 f(x + h) (x) = f(x) h h 2 f 00 (x) +... This approximation is said to be first order because the leading term in the truncation error is linear in h. Dropping the truncation error terms we obtain f 0 fd + h) (x) =f(x f(x) h or f 0 fd (x) =f 0 (x) +O(h) ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 35
19 Roundo and Truncation Errors (2) To study the roles of roundo and truncation errors, compute the finite di erence 1 approximation to f 0 (x) when f(x) =e x. The relative error in the f 0 d fd (x) approximation to dx ex is E rel = f 0 fd (x) f 0 (x) f 0 (x) = f 0 fd (x) ex e x 1 The finite di erence approximation is used to obtain numerical solutions to ordinary and partial di erentials equations where f(x) and hence f 0 (x) is unknown. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 36 Roundo and Truncation Errors (3) Evaluate E rel at x =1for a range of h. Truncation error dominates at large h Roundo error in f(x + h) f(h) dominates as h! 0. Relative error Roundoff error dominates Truncation error dominates Stepsize, h ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 37
20 Finite Di erence Approximations to the Heat Equation ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 38 Model Problem: 1D 0 apple x apple L (1) u(0,t)=0, u(l, t) =0 (2) u(x, 0) = u 0 (x) (3) ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 39
21 Example: Place a hot pot on a table. What is the transient temperature distribution in the table? t < 0 t > 0 L x 0 x T L T T 0 increasing time L ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 40 Model Problem: 1D Heat Equation Exact Solution u(x, t) = 1X 1X u n (x, t) = A n exp( n=1 n=1 A n = 2 L Z L 0 n x n 2 2 t/l 2 )sin (4) L n x u 0 (x)sin dx. (5) L ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 41
22 Example: Decay of u 0 (x) =sin( x/l) We will use the following problem to test our finite-di 0 apple x apple L, t 0 (6.a) u(0,t)=u(l, t) =0 (6.b) x u(x, 0) = sin. L (6.c) This model problem has a simple solution that is convenient as a benchmark for numerical schemes for the heat equation. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 42 Example: Analytical solution to decay of u 0 (x) =sin( x/l) Substituting Equation (6.c) into Equation (5) gives A n = 2 L Z L 0 x n x sin sin L L dx. The sine function is orthogonal in the following sense Z L ( x n x L/2 if n =1 sin sin dx = L L 0 otherwise so that 0 A 1 =1, A n =0, n =2, 3,... ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 43
23 Example: Analytical solution to decay of u 0 (x) =sin( x/l) Therefore, the analytical solution to the toy problem is u(x, t) =exp! 2 t x sin. (7) L 2 L The solution is just an exponential decay of the initial condition for this problem and problems with Dirichlet BC and no source term. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 44 Example: Analytical solution to decay of a square pulse 8 >< 0, if 0 apple x<x l u 0 (x) = u c, if x l apple x apple x r >: 0, if x r <xapple L. u c 0 x l x r L An infinite number of A n terms are needed to match the initial condition. A n = 2 Z x r n x u c sin dx L L x l = 2u apple c cos n n =0, 1, 2,... n xl L n xr cos L ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 45
24 Example: Analytical solution to decay of a square pulse t = 1.0e 04 t = 1.0e 03 t = 1.0e 02 t = 5.0e 02 T(x,t) x ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 46 Numerical Model Continuous PDE for u(x,t) Finite difference or Finite volume or Finite element or Boundar element or... Discrete difference equation Algebraic solution u i k approximation to u(x i,t k ) ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 47
25 Finite Di erence Mesh The finite di erence solution is obtained at a finite set of points. These points are called nodes and the network of these nodes is called a mesh or grid. On a uniform mesh, the x-direction nodes are located at x i =(i 1) x, i =1, 2,...,n x, x = L n x 1 (8) where n x is the total number of spatial nodes, including those on the boundary. i = 1 x = 0... i 1 i i 1 x i 1 x i x i i = n x x = L x x ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 48 Finite Di erence Mesh Analogous to the x-direction mesh, there are nodes at discrete times. For uniform time steps t k =(k 1) t, k =1, 2,...,n t, t = t max n t 1 (9) where n t is the number of time steps. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 49
26 Finite Di erence Mesh The x and t direction nodes form a finite version of a semi-infinite strip t k+1 k k Interior node: u(x,t) is initially unknown. Boundary node: u(0,t) and u(0,t) are known or computable from additional data. Initial condition: u(x,0) must be specified. t=0, k=1 i=1 i 1 i i+1 n x x=0 x=l ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 50 Nomenclature For the one-dimensional mesh, we define Symbol Meaning u(x, t) Analytical solution (true solution). u(x i,t k ) Analytical solution evaluated at x = x i, t = t k. u k i Approximate numerical solution at x = x i, t = t k. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 51
27 First order forward finite di erence Use a Taylor series expansion about the point x i u(x i + x) =u(x i xi + x2 2 2 x i + x3 3 3 x i + where x is a small distance, and x 2 and x 3 are shorthand for ( x) 2 and ( x) 3. Solve = u(x i + x) u(x i xi x x 2 u x 2 3! x 3 3 x i + In the limit as x! 0 the coe cients of the higher order derivative terms vanish, and the first term on the right hand side becomes equal to the derivative on the left hand side. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 52 First order forward finite di erence Replace x with x = x i+1 x i,andsubstituteu i u(x xi u i+1 x u i 2 2 u x 2 3! x 3 3 x i + (10) The mean value theorem can be used to replace the higher order derivatives (exactly) 2 2 u + ( 2 3! x 3 3 x i + = where x i apple apple xi u i+1 x u i + x 2 2 u i+1 u xi x (11) ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 53
28 First order forward finite di erence In general, is not known. Since x is the only parameter under the user s control that determines the error, the truncation error is simply written = O( x) This expression means that the left hand side is bounded by a product of an unknown constant times x. Although the expression does not give us the exact magnitude of ( x/2) (@ 2 u/@x 2 ), it indicates how quickly that term approaches zero as x is reduced. Recall that the point of Big O notation is to look at the exponent of the truncation error term. We conclude that the error in the first order forward di erence formula is linear in the mesh spacing. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 54 First order forward finite di erence Using big O notation, Equation (10) xi = u i+1 x u i + O( x). (12) Equation (12) is called the forward di erence formula xi because it involves nodes x i and x i+1. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 55
29 First order backward finite di erence Repeat the preceding analysis with a Taylor series expansion for u(x i x) u i 1 = u xi + x2 2 u ( x) 2 x i 3 3 x i + (13) Solve xi to = u i u i u ( x) xi x 2 3! x 3 3 x i + = u i u i 1 + O( x). xi x This is called the backward di erence formula because it involves the values of u at x i and x i 1. ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 56 First order central di erence Combine Taylor Series expansions for u i+1 and u i 1 to = u i+1 u i 1 + O( x 2 ) xi 2 x ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 57
30 Summary of first order di erence xi = u i+1 x u i + O( x) Backward: = u i u i 1 + O( xi = u i+1 u i 1 + O( x 2 xi 2 x ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 58 Second Order Central Di erence The Taylor series expansion for u i+1 is u i+1 = u i xi + x2 2 u + ( 2 3! x 3 3 x i + (16) Adding Equation (13) and Equation (16) yields u i+1 + u i 1 =2u i + x 2 2 x i + 2 4! 4 4 x i + Notice that all odd derivatives cancel because of the alternating signs of terms on the right hand side of Equation (13). ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 59
31 Second Order Central Di erence Solving 2 x i gives 2 u = u i 1 2u i + u i x 2 6 x 4 4 x i 2 2 x i = u i 1 2u i + u i+1 x 2 + O( x 2 ). (17) ME 448/548: Introduction to Finite Di erence Approximation of the Heat Equation page 60
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 informationFloating 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 informationNumerical Analysis and Computing
Numerical Analysis and Computing Lecture Notes #02 Calculus Review; Computer Artihmetic and Finite Precision; and Convergence; Joe Mahaffy, mahaffy@math.sdsu.edu Department of Mathematics Dynamical Systems
More informationLecture 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 informationArithmetic 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 informationChapter 1 Mathematical Preliminaries and Error Analysis
Numerical Analysis (Math 3313) 2019-2018 Chapter 1 Mathematical Preliminaries and Error Analysis Intended learning outcomes: Upon successful completion of this chapter, a student will be able to (1) list
More informationMathematical preliminaries and error analysis
Mathematical preliminaries and error analysis Tsung-Ming Huang Department of Mathematics National Taiwan Normal University, Taiwan September 12, 2015 Outline 1 Round-off errors and computer arithmetic
More informationElements 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 informationNotes 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 informationElements 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 information1 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 informationJim Lambers MAT 610 Summer Session Lecture 2 Notes
Jim Lambers MAT 610 Summer Session 2009-10 Lecture 2 Notes These notes correspond to Sections 2.2-2.4 in the text. Vector Norms Given vectors x and y of length one, which are simply scalars x and y, the
More informationHomework 2. Matthew Jin. April 10, 2014
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
More informationChapter 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 informationNotes 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 informationPowerPoints organized by Dr. Michael R. Gustafson II, Duke University
Part 1 Chapter 4 Roundoff and Truncation Errors PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction
More informationChapter 1 Computer Arithmetic
Numerical Analysis (Math 9372) 2017-2016 Chapter 1 Computer Arithmetic 1.1 Introduction Numerical analysis is a way to solve mathematical problems by special procedures which use arithmetic operations
More information1 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 informationChapter 1 Error Analysis
Chapter 1 Error Analysis Several sources of errors are important for numerical data processing: Experimental uncertainty: Input data from an experiment have a limited precision. Instead of the vector of
More informationChapter 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 informationNumerical 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 informationMath 411 Preliminaries
Math 411 Preliminaries Provide a list of preliminary vocabulary and concepts Preliminary Basic Netwon s method, Taylor series expansion (for single and multiple variables), Eigenvalue, Eigenvector, Vector
More informationBinary 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 informationMath 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 informationCompute the behavior of reality even if it is impossible to observe the processes (for example a black hole in astrophysics).
1 Introduction Read sections 1.1, 1.2.1 1.2.4, 1.2.6, 1.3.8, 1.3.9, 1.4. Review questions 1.1 1.6, 1.12 1.21, 1.37. The subject of Scientific Computing is to simulate the reality. Simulation is the representation
More information1 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 informationLecture 7. Floating point arithmetic and stability
Lecture 7 Floating point arithmetic and stability 2.5 Machine representation of numbers Scientific notation: 23 }{{} }{{} } 3.14159265 {{} }{{} 10 sign mantissa base exponent (significand) s m β e A floating
More informationNumerical Solution of f(x) = 0
Numerical Solution of f(x) = 0 Gerald W. Recktenwald Department of Mechanical Engineering Portland State University gerry@pdx.edu ME 350: Finding roots of f(x) = 0 Overview Topics covered in these slides
More informationMath 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 informationFinite Difference Methods for Boundary Value Problems
Finite Difference Methods for Boundary Value Problems October 2, 2013 () Finite Differences October 2, 2013 1 / 52 Goals Learn steps to approximate BVPs using the Finite Difference Method Start with two-point
More informationNumerical Methods in Physics and Astrophysics
Kostas Kokkotas 2 November 6, 2007 2 kostas.kokkotas@uni-tuebingen.de http://www.tat.physik.uni-tuebingen.de/kokkotas Kostas Kokkotas 3 Error Analysis Definition : Suppose that x is an approximation to
More informationCS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation
Lecture slides based on the textbook Scientific Computing: An Introductory Survey by Michael T. Heath, copyright c 2018 by the Society for Industrial and Applied Mathematics. http://www.siam.org/books/cl80
More informationProblem ) 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 informationNumber 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 informationOne-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 informationIntroduction to Numerical Analysis
Introduction to Numerical Analysis S. Baskar and S. Sivaji Ganesh Department of Mathematics Indian Institute of Technology Bombay Powai, Mumbai 400 076. Introduction to Numerical Analysis Lecture Notes
More informationEAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science
EAD 115 Numerical Solution of Engineering and Scientific Problems David M. Rocke Department of Applied Science Computer Representation of Numbers Counting numbers (unsigned integers) are the numbers 0,
More information2. Review of Calculus Notation. C(X) all functions continuous on the set X. C[a, b] all functions continuous on the interval [a, b].
CHAPTER Mathematical Preliminaries and Error Analysis. Review of Calculus Notation. C(X) all functions continuous on the set X. C[a, b] all functions continuous on the interval [a, b]. C n(x) all functions
More informationFloating-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 informationNumerical Methods - Preliminaries
Numerical Methods - Preliminaries Y. K. Goh Universiti Tunku Abdul Rahman 2013 Y. K. Goh (UTAR) Numerical Methods - Preliminaries 2013 1 / 58 Table of Contents 1 Introduction to Numerical Methods Numerical
More informationAlternative Boundary Condition Implementations for Crank Nicolson Solution to the Heat Equation
Alternative Boundary Condition Implementations for Crank Nicolson Solution to the Heat Equation ME 448/548 Notes Gerald Recktenwald Portland State University Department of Mechanical Engineering gerry@pdx.edu
More informationMath 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 informationChapter 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 informationHomework 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 informationLies My Calculator and Computer Told Me
Lies My Calculator and Computer Told Me 2 LIES MY CALCULATOR AND COMPUTER TOLD ME Lies My Calculator and Computer Told Me See Section.4 for a discussion of graphing calculators and computers with graphing
More informationOutline. 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 informationMAT 460: Numerical Analysis I. James V. Lambers
MAT 460: Numerical Analysis I James V. Lambers January 31, 2013 2 Contents 1 Mathematical Preliminaries and Error Analysis 7 1.1 Introduction............................ 7 1.1.1 Error Analysis......................
More informationMath 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 informationA Brief Introduction to Numerical Methods for Differential Equations
A Brief Introduction to Numerical Methods for Differential Equations January 10, 2011 This tutorial introduces some basic numerical computation techniques that are useful for the simulation and analysis
More informationComputing Taylor series
TOPIC 9 Computing Taylor series Exercise 9.. Memorize the following x X e x cos x sin x X X X +x + x + x 3 +... xk +x + x + 6 x3 +... ( ) k (k)! xk ( ) k (k + )! xk+ x x +! x... For which values of x do
More informationNUMERICAL 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 informationNumerical integration and differentiation. Unit IV. Numerical Integration and Differentiation. Plan of attack. Numerical integration.
Unit IV Numerical Integration and Differentiation Numerical integration and differentiation quadrature classical formulas for equally spaced nodes improper integrals Gaussian quadrature and orthogonal
More informationFinding the Roots of f(x) = 0. Gerald W. Recktenwald Department of Mechanical Engineering Portland State University
Finding the Roots of f(x) = 0 Gerald W. Recktenwald Department of Mechanical Engineering Portland State University gerry@me.pdx.edu These slides are a supplement to the book Numerical Methods with Matlab:
More informationFinding the Roots of f(x) = 0
Finding the Roots of f(x) = 0 Gerald W. Recktenwald Department of Mechanical Engineering Portland State University gerry@me.pdx.edu These slides are a supplement to the book Numerical Methods with Matlab:
More informationSolution 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 informationComputer 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 informationPartial Differential Equations Separation of Variables. 1 Partial Differential Equations and Operators
PDE-SEP-HEAT-1 Partial Differential Equations Separation of Variables 1 Partial Differential Equations and Operators et C = C(R 2 ) be the collection of infinitely differentiable functions from the plane
More informationIntroduction and mathematical preliminaries
Chapter Introduction and mathematical preliminaries Contents. Motivation..................................2 Finite-digit arithmetic.......................... 2.3 Errors in numerical calculations.....................
More informationNumerical Analysis Preliminary Exam 10 am to 1 pm, August 20, 2018
Numerical Analysis Preliminary Exam 1 am to 1 pm, August 2, 218 Instructions. You have three hours to complete this exam. Submit solutions to four (and no more) of the following six problems. Please start
More informationNumerical Methods. King Saud University
Numerical Methods King Saud University Aims In this lecture, we will... find the approximate solutions of derivative (first- and second-order) and antiderivative (definite integral only). Numerical Differentiation
More informationErrors. 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 informationWaves on 2 and 3 dimensional domains
Chapter 14 Waves on 2 and 3 dimensional domains We now turn to the studying the initial boundary value problem for the wave equation in two and three dimensions. In this chapter we focus on the situation
More informationNumerical Analysis. Yutian LI. 2018/19 Term 1 CUHKSZ. Yutian LI (CUHKSZ) Numerical Analysis 2018/19 1 / 41
Numerical Analysis Yutian LI CUHKSZ 2018/19 Term 1 Yutian LI (CUHKSZ) Numerical Analysis 2018/19 1 / 41 Reference Books BF R. L. Burden and J. D. Faires, Numerical Analysis, 9th edition, Thomsom Brooks/Cole,
More information1 Finding and fixing floating point problems
Notes for 2016-09-09 1 Finding and fixing floating point problems Floating point arithmetic is not the same as real arithmetic. Even simple properties like associativity or distributivity of addition and
More informationNumerical Analysis Exam with Solutions
Numerical Analysis Exam with Solutions Richard T. Bumby Fall 000 June 13, 001 You are expected to have books, notes and calculators available, but computers of telephones are not to be used during the
More informationOrder of convergence. MA3232 Numerical Analysis Week 3 Jack Carl Kiefer ( ) Question: How fast does x n
Week 3 Jack Carl Kiefer (94-98) Jack Kiefer was an American statistician. Much of his research was on the optimal design of eperiments. However, he also made significant contributions to other areas of
More informationThe method of lines (MOL) for the diffusion equation
Chapter 1 The method of lines (MOL) for the diffusion equation The method of lines refers to an approximation of one or more partial differential equations with ordinary differential equations in just
More informationAn Introduction to Differential Algebra
An Introduction to Differential Algebra Alexander Wittig1, P. Di Lizia, R. Armellin, et al. 1 ESA Advanced Concepts Team (TEC-SF) SRL, Milan Dinamica Outline 1 Overview Five Views of Differential Algebra
More informationSCHOOL OF MATHEMATICS MATHEMATICS FOR PART I ENGINEERING. Self-paced Course
SCHOOL OF MATHEMATICS MATHEMATICS FOR PART I ENGINEERING Self-paced Course MODULE ALGEBRA Module Topics Simplifying expressions and algebraic functions Rearranging formulae Indices 4 Rationalising a denominator
More information1 Floating point arithmetic
Introduction to Floating Point Arithmetic Floating point arithmetic Floating point representation (scientific notation) of numbers, for example, takes the following form.346 0 sign fraction base exponent
More informationBasic Aspects of Discretization
Basic Aspects of Discretization Solution Methods Singularity Methods Panel method and VLM Simple, very powerful, can be used on PC Nonlinear flow effects were excluded Direct numerical Methods (Field Methods)
More informationINTRODUCTION TO COMPUTATIONAL MATHEMATICS
INTRODUCTION TO COMPUTATIONAL MATHEMATICS Course Notes for CM 271 / AMATH 341 / CS 371 Fall 2007 Instructor: Prof. Justin Wan School of Computer Science University of Waterloo Course notes by Prof. Hans
More informationApplied Mathematics 205. Unit 0: Overview of Scientific Computing. Lecturer: Dr. David Knezevic
Applied Mathematics 205 Unit 0: Overview of Scientific Computing Lecturer: Dr. David Knezevic Scientific Computing Computation is now recognized as the third pillar of science (along with theory and experiment)
More information2.2. Methods for Obtaining FD Expressions. There are several methods, and we will look at a few:
.. Methods for Obtaining FD Expressions There are several methods, and we will look at a few: ) Taylor series expansion the most common, but purely mathematical. ) Polynomial fitting or interpolation the
More informationNumerical 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 information1.2 Finite Precision Arithmetic
MACM Assignment Solutions.2 Finite Precision Arithmetic.2:e Rounding Arithmetic Use four-digit rounding arithmetic to perform the following calculation. Compute the absolute error and relative error with
More informationMATH 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 informationJUST 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 informationMTH303. Section 1.3: Error Analysis. R.Touma
MTH303 Section 1.3: Error Analysis R.Touma These lecture slides are not enough to understand the topics of the course; they could be used along with the textbook The numerical solution of a mathematical
More informationNumerical 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 informationFixed point iteration and root finding
Fixed point iteration and root finding The sign function is defined as x > 0 sign(x) = 0 x = 0 x < 0. It can be evaluated via an iteration which is useful for some problems. One such iteration is given
More informationFinal year project. Methods for solving differential equations
Final year project Methods for solving differential equations Author: Tej Shah Supervisor: Dr. Milan Mihajlovic Date: 5 th May 2010 School of Computer Science: BSc. in Computer Science and Mathematics
More informationApproximations of diffusions. Mathématiques appliquées (MATH0504-1) B. Dewals, Ch. Geuzaine
Lecture 3b Approximations of diffusions Mathématiques appliquées (MATH0504-1) B. Dewals, Ch. Geuzaine V1.1 04/10/2018 1 Learning objectives Become aware of the existence of stability conditions for the
More informationSECTION 5: POWER FLOW. ESE 470 Energy Distribution Systems
SECTION 5: POWER FLOW ESE 470 Energy Distribution Systems 2 Introduction Nodal Analysis 3 Consider the following circuit Three voltage sources VV sss, VV sss, VV sss Generic branch impedances Could be
More informationOne Dimensional Convection: Interpolation Models for CFD
One Dimensional Convection: Interpolation Models for CFD ME 448/548 Notes Gerald Recktenwald Portland State University Department of Mechanical Engineering gerry@pdx.edu ME 448/548: 1D Convection-Diffusion
More informationMath 411 Preliminaries
Math 411 Preliminaries Provide a list of preliminary vocabulary and concepts Preliminary Basic Netwon's method, Taylor series expansion (for single and multiple variables), Eigenvalue, Eigenvector, Vector
More informationNumerical Solutions to Partial Differential Equations
Numerical Solutions to Partial Differential Equations Zhiping Li LMAM and School of Mathematical Sciences Peking University Numerical Methods for Partial Differential Equations Finite Difference Methods
More information01 Harmonic Oscillations
Utah State University DigitalCommons@USU Foundations of Wave Phenomena Library Digital Monographs 8-2014 01 Harmonic Oscillations Charles G. Torre Department of Physics, Utah State University, Charles.Torre@usu.edu
More informationNumerical 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 informationChapter 5 HIGH ACCURACY CUBIC SPLINE APPROXIMATION FOR TWO DIMENSIONAL QUASI-LINEAR ELLIPTIC BOUNDARY VALUE PROBLEMS
Chapter 5 HIGH ACCURACY CUBIC SPLINE APPROXIMATION FOR TWO DIMENSIONAL QUASI-LINEAR ELLIPTIC BOUNDARY VALUE PROBLEMS 5.1 Introduction When a physical system depends on more than one variable a general
More informationInfinite series, improper integrals, and Taylor series
Chapter 2 Infinite series, improper integrals, and Taylor series 2. Introduction to series In studying calculus, we have explored a variety of functions. Among the most basic are polynomials, i.e. functions
More informationSolving Linear Systems of Equations
Solving Linear Systems of Equations Gerald Recktenwald Portland State University Mechanical Engineering Department gerry@me.pdx.edu These slides are a supplement to the book Numerical Methods with Matlab:
More informationThe Not-Formula Book for C2 Everything you need to know for Core 2 that won t be in the formula book Examination Board: AQA
Not The Not-Formula Book for C Everything you need to know for Core that won t be in the formula book Examination Board: AQA Brief This document is intended as an aid for revision. Although it includes
More informationECS 231 Computer Arithmetic 1 / 27
ECS 231 Computer Arithmetic 1 / 27 Outline 1 Floating-point numbers and representations 2 Floating-point arithmetic 3 Floating-point error analysis 4 Further reading 2 / 27 Outline 1 Floating-point numbers
More information1 Separation of Variables
Jim ambers ENERGY 281 Spring Quarter 27-8 ecture 2 Notes 1 Separation of Variables In the previous lecture, we learned how to derive a PDE that describes fluid flow. Now, we will learn a number of analytical
More informationChapter 1. Numerical Errors. Module No. 1. Errors in Numerical Computations
Numerical Analysis by Dr. Anita Pal Assistant Professor Department of Mathematics National Institute of Technology Durgapur Durgapur-73209 email: anita.buie@gmail.com . Chapter Numerical Errors Module
More informationPreliminary Examination in Numerical Analysis
Department of Applied Mathematics Preliminary Examination in Numerical Analysis August 7, 06, 0 am pm. Submit solutions to four (and no more) of the following six problems. Show all your work, and justify
More informationMATH 350: Introduction to Computational Mathematics
MATH 350: Introduction to Computational Mathematics Chapter IV: Locating Roots of Equations Greg Fasshauer Department of Applied Mathematics Illinois Institute of Technology Spring 2011 fasshauer@iit.edu
More informationHomework 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 informationLinear Algebra March 16, 2019
Linear Algebra March 16, 2019 2 Contents 0.1 Notation................................ 4 1 Systems of linear equations, and matrices 5 1.1 Systems of linear equations..................... 5 1.2 Augmented
More information