L1 - Error Analysis

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

ESO 208A/ 218

Computational Methods in Engineering


Summer Semester 2014-15 I
L1 Error Analysis
Dr. Anubha Goel
anubha@iitk.ac.in; x 7027

Mathematical model
A mathematical model can be broadly defined
as a formulation or equation that expresses
the essential features of a physical system or
process in mathematical terms.

5/20/2015

L1 - Error Analysis

Numerical Methods
Numerical methods are scientific in the sense that they
represent systematic techniques for solving mathematical
problems.
IMPORTANT They are approximations and hence involve errors
Out of several methods available choice of numerical
methods for solving a problem reduces to one of cost and
accuracy.

5/20/2015

L1 - Error Analysis

Accuracy and Precision


Definitions
Accuracy refers to how
closely a computed or
measured value agrees with
the true value.
Precision refers to how
closely individual computed
or measured values agree
with each other.
An

example from marksmanship illustrating the


concepts of accuracy and precision. (a) Inaccurate
and imprecise; (b) accurate and imprecise; (c)
inaccurate and precise; (d) accurate and precise.

5/20/2015

L1 - Error Analysis

Lecture contents
1. Numerical Methods and Numerical Analysis
When they are methods of choice, objective

3. Approximation
4. Concept of convergence
Cauchy sequence

4. Error Type

- Model and Data Error


- Round Off and Truncation Error Taylor, Mc Laurin series

5. Error Analysis

5/20/2015

Forward, Backward
Error propagation in a function
Condition number of a problem Cp
Norms of a vector
Round off error, Machine precision unit (u)
Condition number of an algorithm Ca
Floating Point error
Total Relative error
L1 - Error Analysis

Significant Figures
Basic rules for significant digits:1) All nonzero digits are significant.
2) All zeroes between significant
digits are significant.
3) All zeroes which are both
(a) to the right of the decimal point
and,
(b) to the right of all non-zero
significant digits are themselves
significant.

5/20/2015

L1 - Error Analysis

Example:
Number
1.234
0.001
0.100
0.00100
100
100.0
1.23
1.230

Significant
Digit
4
1
3
3
1
4
3
4

1.

Concept of Numerical Methods and


Numerical Analysis

Numerical method is an APPROXIMATION


Error exists
Define Numerical Method
The branch of mathematics that deals with transformation
of the mathematical problems to numerical calculations
Need for Computation/ Numerical Methods in Engineering
Handling large datasets, repeated calculations,
Examine result of variation in parameters
5/20/2015

L1 - Error Analysis

The solutions often quick and is easily adapted for parametric


sensitivity studies.
Objective
To obtain a reasonably accurate solution with optimum use of
resources

5/20/2015

L1 - Error Analysis

Numerical Analysis
Mathematical analysis conducted to determine whether the
computational scheme converges or not is called numerical
analysis.
Involves
convergence analysis and
Error Analysis
Problem - among the options available to solve a
problem, what is a numerical method?
Answer - The computational scheme that converges to
the true solution can be termed as a numerical
method for computing the square root of a number.
5/20/2015

L1 - Error Analysis

Situations when numerical methods would be


the method of choice
1. integration of a function for which either the integral cannot
be expressed as analytical expressions or it is too
cumbersome and time consuming to evaluate,
2. solution of differential equations for complicated geometry,
and/or boundary conditions,
3. Large systems of equations, repeated solution of the same
system under changing conditions, etc.
Need to know how the numerical methods work on
computers to trouble shoot or design new algorithms
5/20/2015

L1 - Error Analysis

10

Concept of convergence Cauchy sequence


Function CONVERGES Limit exists
Convergence
monotonically decreasing sequence,
lower bound,
Cauchy sequence

5/20/2015

L1 - Error Analysis

11

Error
Error = True value approximation

3 basic kinds
1. Data and Model Error
2. Round off/ Chop off
3. Truncation

5/20/2015

L1 - Error Analysis

12

Model and Data Error


Description

Related to

Model error

due to assumptions made


Precision
in arriving at an algorithm refers to how closely individual
describing a process
computed or measured values
agree with each other.

Data error

due to approximation of
values such as value of g
as 9.81 (may actually be
9.8088)

accuracy
refers to how closely a
computed or measured value
agrees with the true value.

Ex. Data error : in case of function y = 5 ekx


Different values of k can lead to error in values of y.
5/20/2015

L1 - Error Analysis

13

Truncation and Round off error


Error = True value approximation
Two types truncation and round off
Error Type

Truncation
Round-off

Description
Result when approximations are used to
represent exact mathematical procedures
Result when numbers having limited significant
figures are used to represent exact numbers.
E.g. value of g is used as 9.81 (may actually
be 9.8088)

Question: Chopping vs. Round off ?


5/20/2015

L1 - Error Analysis

14

Note on value of g
Although the precise strength of Earth's gravity varies
depending on location, the nominal "average" value at
the Earth's surface, known as standard gravity is, by
definition, 9.80665 m/s2
Parameters affecting the apparent or actual strength of
Earth's gravity include latitude, altitude, and the local
topography and geology.
Gravity decreases with altitude, since greater altitude
means greater distance from the Earth's centre
5/20/2015

L1 - Error Analysis

15

What causes Truncation error (TE)?


This error is due to approximation of an infinite series by a
finite number of terms or in other words, due to
truncation of the series after some points. Error
encountered in this way is termed as truncation error.

e.g. Taylor Series

Mc Laurin series (Taylor series with a = 0)

5/20/2015

L1 - Error Analysis

16

Truncation Error in Series


Taylor Series

Mc Laurin series (Taylor series with a = 0)

For more details on these series revise MTH 101, Thomas and Finney

5/20/2015

L1 - Error Analysis

17

Round Off error, Machine precision unit u


Concept of significant figures and link to round off error
The concept of significant figures has two important
implications for our study of numerical methods:
1. numerical methods yield approximate results.
We must, therefore, develop criteria to specify how confident
we are in our approximate result.
One way to do this is in terms of significant figures.

5/20/2015

L1 - Error Analysis

18

For example, we might decide that our approximation is


acceptable if it is correct to four significant figures.

2. All computing machines have finite maximum length for


storing a number, they are always rounded-off after a few
significant digits following decimal.
This brings us to Floating Point representation. Lets revise.

5/20/2015

L1 - Error Analysis

19

Floating Point representation of a number


Fractional quantities are typically represented in computers
using floating-point form.
In this approach, the number is expressed as a fractional part,
called a mantissa or significant. and an integer part, called an
exponent or characteristic, as in
m . be
where m = the mantissa, b = the base of the number system
being used, and e = the exponent.
b=2 binary, 10 decimal, 16 - hexadecimal

5/20/2015

L1 - Error Analysis

20

For instance, the number 156.78 could be represented as


0.15678 x 103 in a floating point base-I0 system.

Mantissa normalization
Mantissa is usually normalized if it has leading zero digits.
The consequence of normalization is that the absolute value
of m is limited. That is,
I/b < = m < 1

where b = the base.

5/20/2015

L1 - Error Analysis

21

Example
for a base-l0 system, m would range between 0. I and I,
for a base-2 system, between 0.5 and I.
Important: Normalization introduces a source of error
why? because the mantissa holds only a finite number of
significant figures.
Thus, a round-off error is introduced.
Self Study:
Derivation of machine precision unit (u)
Calculation of Backward error
5/20/2015

L1 - Error Analysis

22

Error Analysis
CONTENT
Forward, Backward Error Analysis
Error propagation in a function
Condition number of a problem Cp
Condition number of an algorithm Ca
Total Error

5/20/2015

L1 - Error Analysis

23

Forward, Backward Error Analysis


Given error at the beginning (x), determine how much error
will be caused in final result (y).
More relevant Data Error

Backward error analysis:


Given an error incurred, determine what it is equivalent to
in parameter values
OR process of estimating perturbation () required in the
input variable (x) to explain the final result

5/20/2015

L1 - Error Analysis

24

Backward Error Analysis


In short: you know final error (y)
You predict what change/adjustment is needed to
cause/ remove the final error
Advantage of Backward error analysis over Forward Error
we do not need to know the true value of the result, which
was needed in a forward error analysis

5/20/2015

L1 - Error Analysis

25

Error propagation in a function


Question: How the error in input data is translated to output
(even when no other error type such as truncation/ round off)
is encountered?
Answer:
We know that Error in y is a function of data itself.
Hence, objective is estimating the error introduced in the final
computation of the functional value as a result of these errors
in the variables (due to errors discussed above data, model,
truncation, round off)
Error Bounds:
In general, error is estimated using - Linear forward analysis
Retain only the first order approximation term
Question: Why only first order?
Answer - Generally value x is small and higher order analysis makes it
even smaller

26

True, and Relative Error

True error (e) = True value - Approximate value


True Relative error

Why do we calculate Relative error?


Answer:
To give a better idea of size of error vs. value concerned.
Sometimes the error may be large, but only say 1% of True value.
Example:
TV = 1000, Calculated 950.
Absolute error = 50,
Relative error = 50/1000 = 0.05)

Note: It is always better to use Relative Error than True Error


When TV is not known and needs to be approximated by a sequence:

5/20/2015

L1 - Error Analysis

27

Error Estimates for Iterative Methods


Approximate Error
Approximate error (e) = Current approximation - Previous
approximation
Approximate relative error

Tutorial 1 problem: Ex. 3.2 Chapra Ed. 6

5/20/2015

L1 - Error Analysis

28

Condition number of a problem (Cp)


Definition: ratio of the relative change in the function f(x), to
the relative change in the variable x for a small perturbation
dx,
Ill conditioned vs. well conditioned

derive values of Cp for each


How can each type of problem be handled
p
USE higher precision
i.e. reduce truncation error (include higher order terms)
Use different algorithm

5/20/2015

L1 - Error Analysis

29

Condition number of an algorithm (Ca)


Definition: A measure of the change required in the input data to
explain the errors in the output result is termed the condition
number of the algorithm (C4).
How can this be obtained?
Answer: This is done through a backward error analysis, which
determines the change necessary in the input variable (or data) to
explain the final error in the output (or result) obtained through
errors introduced at various stages of calculation.
Importance/ Usefulness: among several algorithms available for a
problem, use the one with lowest value of Ca.
Actual error in a computation
combines Cp and Ca
5/20/2015

L1 - Error Analysis

30

Total Numerical Error

A graphical depiction of the trade-off between round-off and truncation error that
sometimes comes into play in the course of a numerical method. The point of diminishing
returns is shown, where round-off error begins to negate the benefits of step-size
reduction.
5/20/2015

L1 - Error Analysis

31

Error Analysis of Numerical Differentiation

5/20/2015

L1 - Error Analysis

32

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy