Download presentation
Presentation is loading. Please wait.
Published byPatrick Lewis Modified over 9 years ago
1
1 Approximation
2
2 Taylor Series
3
3 Truncation Error In general, the nth order Taylor series expansion will be exact for an nth order polynomial In other cases, the remainder term R n is of the order of h n+1, meaning: The more terms are used, the smaller the error, and The smaller the spacing, the smaller the error for a given number of terms
4
Numerical Differentiation Problem: approximate the derivative of the function f(x) knowing the values of the function at discrete values of x First order Taylor series can be used to calculate approximations to derivatives: Given: Then: This is termed a “forward” difference because it utilizes data at i and i+1 to estimate the derivative 4
5
Numerical Differentiation ( 續 ) There are also backward difference and centered difference approx., depending on the points used: Forward Backward Centered 5
6
Truncation and Round-off Errors Truncation error ( 截斷誤差 ): method dependent Results from ignoring all but a finite number of terms of an infinite series Results from using an approximation rather than an exact procedure Round-off error ( 捨入誤差 ): machine dependent Difference between an approximation of a number used in computation and its exact (correct) value Results from not being able to adequately represent the true value 6
7
Truncation and Round-off Errors Round-off error ( 捨入誤差 ): machine dependent An example of round-off error is provided by an index devised at the Vancouver stock exchange. At its inception in 1982, the index was given a value of 1000.000. After 22 months of recomputing the index and truncating to three decimal places at each change in market value, the index stood at 524.881, despite the fact that its "true" value should have been 1009.811 Another example is the fate of the Ariane rocket launched on June 4, 1996 (European Space Agency 1996). In the 37th second of flight, the inertial reference system attempted to convert a 64-bit floating-point number to a 16-bit number, but instead triggered an overflow error which was interpreted by the guidance system as flight data, causing the rocket to veer off course and be destroyed. 7
8
function sum = exp(x) % Evaluate exponential function exp(x) % by Taylor series expansion % f(x)=1 + x + x^2/2! + x^3/3! + … + x^n/n! clear all x = input(‘enter the value of x = ’); n = input(‘enter the order n = ’); term =1 ; sum= term; for i = 1 : n term = term*x/i; sum = sum + term; end Truncation Error Example
9
function sum = exp(x) % Evaluate exponential function exp(x) % by Taylor series expansion % f(x)=1 + x + x^2/2! + x^3/3! + … + x^n/n! x = input(‘enter the value of x =’); n = input(‘enter the order n = ’); term(1) =1 ; sum(1)= term(1); for i = 1 : n term(i+1) = term(i)*x/i; sum(i+1) = sum(i) + term(i+1); end % Display the results disp(‘i term(i) sum(i)’) a = 1:n+1; [a’ term’ sum’] Truncation Error Example
10
n term sum Truncation Error
11
n term sum Truncation Error How to reduce error?
13
Accuracy and Precision Accuracy - How closely a measured or computed value agrees with the true value Precision - How closely individual measured or computed values agree with each other Accuracy is getting all your shots near the target Precision is getting them close together. 13 More Accurate More Precise
14
Effect of the Step Size on the Total Error Truncation and round-off errors behave differently as functions of the step size h: Truncation error increases as the step size increases Round-off error decreases as the step size increases Total numerical error = truncation + round-off error There is an optimum step size which minimizes the total error 14
15
Effect of the Step Size The smaller the step size The larger the number of calculations, thus the larger the round-off error The smaller the error made when approximation the value of the function at the intermediate points 15
16
16 Other Errors Blunders Errors caused by malfunctions of the computer or human imperfection Model errors Errors resulting from incomplete mathematical models Data uncertainty Errors resulting from the accuracy and/or precision of the data
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.