SlideShare a Scribd company logo
www.openeering.com
powered by
NUMERICAL ANALYSIS USING SCILAB:
ERROR ANALYSIS AND PROPAGATION
This tutorial provides a collection of numerical examples and advises on error
analysis and its propagation. All examples are developed in Scilab.
Level
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
Error analysis and propagation www.openeering.com page 2/10
Step 1: The purpose of this tutorial
The purpose of this Scilab tutorial is to provide a collection of numerical
examples that are typically part of numerical analysis courses.
This tutorial is intended to help readers familiarize with numerical methods
and their implementations, keeping under control the error propagation.
Here we provide some classical examples on error analysis and
propagation.
An introduction to
NUMERICAL ANALYSIS USING SCILAB
(Error study in Numerical Analysis)
Step 2: Roadmap
In this tutorial, after a brief introduction to the concept of numerical errors,
we analyze some examples in which numerical errors occur. These
examples are useful to understand how important is to pay attention to
error propagation when implementing numerical methods.
Descriptions Steps
Numerical errors 3-5
Examples 6-10
Conclusions and remarks 11-12
Error analysis and propagation www.openeering.com page 3/10
Step 3: Numerical error
What is allocated in a computer is only a subset of real number (using
IEEE 754 standard) and hence, a real number is represented in the
computer as , a fixed strings of digits. This limited amount of storage
introduces a rounding error (or round-off error). It is possible to prove the
following relation
with
| |
where is a constant that depends on the floating point system used to
represent the number (for double precision arithmetic is equal to
).
// Scilab command to obtain eps
// ----------------------------
%eps
Step 4: Truncation error
The next step is to study what happens when the basic arithmetic
operations are used.
We denote the computer arithmetic as , , , to distinguish them
from real arithmetic , , and respectively.
A part from the numerical error due to limited length in bits of registers, the
computer arithmetic introduces a further truncation error when results are
transfer from CPU to the memory. This error is caused by the fact that the
length in bits of the CPU register is greater than the one used to store
numbers.
As an example, if we sum two numbers and (to compute )
the corresponding machine operation can be written as
( )
with | | . The sum of two numbers involves the sum of the
two floating point operands. Since this operation is done in a register
of the computer, it is necessary to consider a further floating point
representation when the number is transferred to be stored into the
memory.
Error analysis and propagation www.openeering.com page 4/10
Step 5: Cancellation error
It is interesting to analyze the arithmetic operations when we consider
relative errors. For example, we want to analyze the sum operation:
| |
| |
in terms of the relative error of the input operands and . The relative
error for is defined as
| |
| |
A computer operation is considered numerically stable when
where and and are two input operands.
It is possible to prove that the computer operations and are the only
stable operations with respect to the rounding error. Conversely, for
addition we have:
(
| |
| |
| |
| |
)
A similar inequality holds for subtraction.
When , the right hand side of the inequality may be very high and
hence may generate a high relative error (cancellation error).
Cancellation error should be avoided whenever possible!
Example of cancellation error for subtraction operation
In this example we consider a decimal arithmetic with floating point where a
number is expressed in the following way:
with . is the exponent (or characteristic) of the representation while
is the mantissa of the representation. The mantissa has always a
fixed number of digits, in this case m.
For example, we can compute using a system with a mantissa of
4 digits for the number, while we use a mantissa of 8 digits for the internal
representations in the CPU register.
The example is done using .
From memory to registers:
Memory (mantissa = 4) Register (mantissa = 8)


Arithmetic operation with alignment of the exponent:
Register (mantissa = 8) Register with aligned exp.


+

From register to memory:
Register (mantissa = 8) Memory (mantissa = 4)

It is easy to compute the final step in which we subtract again 1 to evaluate
. As a result we obtain that is not equal to x.
Error analysis and propagation www.openeering.com page 5/10
Step 6: Two equivalent expressions
In this example we compare the following two equivalent expressions:
These two expressions are equivalent from an algebraic point of view; the
second expression is simply obtained from the first one through
simplification.
The first function suffers of the cancellation error when goes to zero.
This phenomenon has been explained in the previous step.
In the reported figure we have plotted the error . We
may see that the cancellation error is huge when is close to zero. This
phenomenon produces a loss of significant digits.
The Scilab script for the figure on the right is available in ex01.sce. The
code can be downloaded from the Openeering website.
(Error err in the range [-1e-07;1e-07])
Error analysis and propagation www.openeering.com page 6/10
Step 7: Two equivalent polynomials
In this example, we compare the two following polynomial expressions:
where the first expression is obtained from the second by expansion.
As depicted on the right, the second expression is numerically stable while
the first one is more unstable.
The Scilab script is reported in the function ex02.sce.
(Comparison between two algebraic equivalent polynomials)
Error analysis and propagation www.openeering.com page 7/10
Step 8: Derivative example
In this step, we study the computation of a derivative from a numerical
point of view. To approximate the first derivate, we use here the difference
quotient (a.k.a. Newton’s quotient):
For example, we may analyze the formula for the function at
point varying h in the following way:
The plot on the right visualizes the results.
From a mathematical point of view, when goes to zero, the formula
should assume the value of the first derivative. Intuitively, we may expect
the smaller the , the better the approximation. Unfortunately, because of
cancellation errors, it happens that the most reliable value for the derivate
is reached in (for , the value of the derivate is the same
as ).
The Scilab script for plot and table is reported in the function ex03.sce.
(Value of the derivative changing the value of h)
(Derivative example – table of results)
Error analysis and propagation www.openeering.com page 8/10
Step 9: Error analysis and optimal step
The Newton’s quotient to approximate the derivative contains two
sources of error:
 Round-off error;
 Truncation error.
This follows from the Taylor series expansion of :
where and hence:
The first term contributes to round-off error, while the second term gives
rise to a truncation error.
As reported on the right the total error can be expressed as
̅
From the above formula it is possible to compute the optimal step size .
Taking the derivative of the total error with respect to and setting this
quantity equal to zero, we have:
√
̅
This represents the optimal value for to minimize the total error.
Evaluation of the round-off error:
The round-off error for the Newton’s quotient can be written as:
|
( ) ( )
|
| |
where | | (remember that where | | ).
Moreover we ignore error from division by .
In order to evaluate this error, with small, we replace by
We do not know the signs of and , so we replace the difference
with ̅. This leads to:
̅
| |
̅
where | |.
Evaluation of the truncation error:
The truncation error is given by:
| |
where for small values of we replace by and | |.
Error analysis and propagation www.openeering.com page 9/10
Step 10: Exercise
It is possible to compute the second derivatives of a function using the
following approximation
Apply the above formula to compute the second derivative of the function
at a given point .
Moreover, prove the following estimate for the total error:
|
( ) ( ) ( )
|
̅
where | | and | |.
The upper bound error is minimized when has the value
√
̅
Hints: Using Taylor expansion for the function and to
the fourth order paying attention to the signs.
(Relative error for second derivative approximation)
(Second derivative approximation, table of results)
Error analysis and propagation www.openeering.com page 10/10
Step 11: Concluding remarks and References
In this tutorial we have collected a series of numerical examples written in
Scilab for the study of numerical errors.
1. Scilab Web Page: Available: www.scilab.org.
2. Openeering: www.openeering.com.
3. J. Higham, accuracy and Stability of Numerical Algorithms, SIAM
4. Atkinson, An Introduction to Numerical Analysis, Wiley
Step 12: Software content
To report a bug or suggest improvements please contact Openeering
team at the web site www.openeering.com.
Thank you for your attention,
Silvia Poles and Manolo Venturin
--------------
Main directory
--------------
ex01.sce : Expression example
ex02.sce : Polynomial example
ex03.sce : Derivative example
ex04.sce : Second derivative exercise
license.txt : The license file

More Related Content

What's hot

Chap 2 classification of parralel architecture and introduction to parllel p...
Chap 2  classification of parralel architecture and introduction to parllel p...Chap 2  classification of parralel architecture and introduction to parllel p...
Chap 2 classification of parralel architecture and introduction to parllel p...
Malobe Lottin Cyrille Marcel
 
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
Danish Javed
 
Model-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & OverviewModel-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & Overview
Eelco Visser
 
Advanced Computer Architecture Chapter 123 Problems Solution
Advanced Computer Architecture Chapter 123 Problems SolutionAdvanced Computer Architecture Chapter 123 Problems Solution
Advanced Computer Architecture Chapter 123 Problems Solution
Joe Christensen
 
Chapter 8 : Memory
Chapter 8 : MemoryChapter 8 : Memory
Chapter 8 : Memory
Amin Omi
 
Distributed data processing
Distributed data processingDistributed data processing
Distributed data processing
Ayisha Kowsar
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in Compiler
Akhil Kaushik
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows VistaTrinh Phuc Tho
 
Unit 3 for st
Unit 3 for stUnit 3 for st
Unit 3 for st
Poonkodi Jayakumar
 
Debugging (Part 2)
Debugging (Part 2)Debugging (Part 2)
Debugging (Part 2)
Ajeng Savitri
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler design
Anul Chaudhary
 
Software engineering 13 software product metrics
Software engineering 13 software product metricsSoftware engineering 13 software product metrics
Software engineering 13 software product metrics
Vaibhav Khanna
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
Prof. Dr. K. Adisesha
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
Wondeson Emeye
 
ASSEMBLY LANGUAGE.pptx
ASSEMBLY LANGUAGE.pptxASSEMBLY LANGUAGE.pptx
ASSEMBLY LANGUAGE.pptx
EdFeranil
 
Distributed transaction
Distributed transactionDistributed transaction
Distributed transaction
MohitKothari26
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
Kathirvel Ayyaswamy
 
Code generation errors and recovery
Code generation errors and recoveryCode generation errors and recovery
Code generation errors and recovery
Momina Idrees
 
Chapter 3 pc
Chapter 3 pcChapter 3 pc
Chapter 3 pc
Hanif Durad
 
N-version programming
N-version programmingN-version programming
N-version programming
shabnam0102
 

What's hot (20)

Chap 2 classification of parralel architecture and introduction to parllel p...
Chap 2  classification of parralel architecture and introduction to parllel p...Chap 2  classification of parralel architecture and introduction to parllel p...
Chap 2 classification of parralel architecture and introduction to parllel p...
 
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
 
Model-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & OverviewModel-Driven Software Development - Introduction & Overview
Model-Driven Software Development - Introduction & Overview
 
Advanced Computer Architecture Chapter 123 Problems Solution
Advanced Computer Architecture Chapter 123 Problems SolutionAdvanced Computer Architecture Chapter 123 Problems Solution
Advanced Computer Architecture Chapter 123 Problems Solution
 
Chapter 8 : Memory
Chapter 8 : MemoryChapter 8 : Memory
Chapter 8 : Memory
 
Distributed data processing
Distributed data processingDistributed data processing
Distributed data processing
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in Compiler
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows Vista
 
Unit 3 for st
Unit 3 for stUnit 3 for st
Unit 3 for st
 
Debugging (Part 2)
Debugging (Part 2)Debugging (Part 2)
Debugging (Part 2)
 
Peephole optimization techniques in compiler design
Peephole optimization techniques in compiler designPeephole optimization techniques in compiler design
Peephole optimization techniques in compiler design
 
Software engineering 13 software product metrics
Software engineering 13 software product metricsSoftware engineering 13 software product metrics
Software engineering 13 software product metrics
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
 
ASSEMBLY LANGUAGE.pptx
ASSEMBLY LANGUAGE.pptxASSEMBLY LANGUAGE.pptx
ASSEMBLY LANGUAGE.pptx
 
Distributed transaction
Distributed transactionDistributed transaction
Distributed transaction
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 
Code generation errors and recovery
Code generation errors and recoveryCode generation errors and recovery
Code generation errors and recovery
 
Chapter 3 pc
Chapter 3 pcChapter 3 pc
Chapter 3 pc
 
N-version programming
N-version programmingN-version programming
N-version programming
 

Viewers also liked

Numerical analysis using Scilab: Solving nonlinear equations
Numerical analysis using Scilab: Solving nonlinear equationsNumerical analysis using Scilab: Solving nonlinear equations
Numerical analysis using Scilab: Solving nonlinear equations
Scilab
 
Numerical analysis using Scilab: Numerical stability and conditioning
Numerical analysis using Scilab: Numerical stability and conditioningNumerical analysis using Scilab: Numerical stability and conditioning
Numerical analysis using Scilab: Numerical stability and conditioning
Scilab
 
Introduction to error analysis
Introduction to error analysis Introduction to error analysis
Introduction to error analysis Muhmmad Asif
 
First steps with Scilab
First steps with ScilabFirst steps with Scilab
First steps with Scilab
Scilab
 
Aeraulic toolbox for Xcos
Aeraulic toolbox for XcosAeraulic toolbox for Xcos
Aeraulic toolbox for Xcos
Scilab
 
Data mining
Data miningData mining
Data mining
Scilab
 
Modeling an ODE: 3 different approaches - Part 1
Modeling an ODE: 3 different approaches - Part 1Modeling an ODE: 3 different approaches - Part 1
Modeling an ODE: 3 different approaches - Part 1
Scilab
 
Modeling an ODE: 3 different approaches - Part 2
Modeling an ODE: 3 different approaches - Part 2Modeling an ODE: 3 different approaches - Part 2
Modeling an ODE: 3 different approaches - Part 2
Scilab
 
Approximation and error
Approximation and errorApproximation and error
Approximation and errorrubenarismendi
 
Introduction to Control systems in scilab
Introduction to Control systems in scilabIntroduction to Control systems in scilab
Introduction to Control systems in scilab
Scilab
 
Numerical Methods
Numerical MethodsNumerical Methods
Numerical Methods
ESUG
 
Customizing Xcos with new Blocks and Palette
Customizing Xcos with new Blocks and PaletteCustomizing Xcos with new Blocks and Palette
Customizing Xcos with new Blocks and Palette
Scilab
 
Error analysis
Error analysisError analysis
Error analysis
Ahmed Hussein
 
Types of errors
Types of errorsTypes of errors
Types of errors
Rima fathi
 
Introduction to Numerical Analysis
Introduction to Numerical AnalysisIntroduction to Numerical Analysis
Introduction to Numerical Analysis
Mohammad Tawfik
 
Error analysis presentation
Error analysis presentationError analysis presentation
Error analysis presentation
Geraldine Lopez
 
Error analysis
Error  analysisError  analysis
Error analysis
fateme faryabi
 
Errors in Computing- Runtime, Semantics, Syntax and Fixed and Floating point
Errors in Computing- Runtime, Semantics, Syntax and Fixed and Floating pointErrors in Computing- Runtime, Semantics, Syntax and Fixed and Floating point
Errors in Computing- Runtime, Semantics, Syntax and Fixed and Floating point
Ryon Whyte
 
Scilab as a calculator
Scilab as a calculatorScilab as a calculator
Scilab as a calculator
Scilab
 
Example of error analysis and worked examples
Example of error analysis and worked examplesExample of error analysis and worked examples
Example of error analysis and worked examples
Lisa Thompson Sousa
 

Viewers also liked (20)

Numerical analysis using Scilab: Solving nonlinear equations
Numerical analysis using Scilab: Solving nonlinear equationsNumerical analysis using Scilab: Solving nonlinear equations
Numerical analysis using Scilab: Solving nonlinear equations
 
Numerical analysis using Scilab: Numerical stability and conditioning
Numerical analysis using Scilab: Numerical stability and conditioningNumerical analysis using Scilab: Numerical stability and conditioning
Numerical analysis using Scilab: Numerical stability and conditioning
 
Introduction to error analysis
Introduction to error analysis Introduction to error analysis
Introduction to error analysis
 
First steps with Scilab
First steps with ScilabFirst steps with Scilab
First steps with Scilab
 
Aeraulic toolbox for Xcos
Aeraulic toolbox for XcosAeraulic toolbox for Xcos
Aeraulic toolbox for Xcos
 
Data mining
Data miningData mining
Data mining
 
Modeling an ODE: 3 different approaches - Part 1
Modeling an ODE: 3 different approaches - Part 1Modeling an ODE: 3 different approaches - Part 1
Modeling an ODE: 3 different approaches - Part 1
 
Modeling an ODE: 3 different approaches - Part 2
Modeling an ODE: 3 different approaches - Part 2Modeling an ODE: 3 different approaches - Part 2
Modeling an ODE: 3 different approaches - Part 2
 
Approximation and error
Approximation and errorApproximation and error
Approximation and error
 
Introduction to Control systems in scilab
Introduction to Control systems in scilabIntroduction to Control systems in scilab
Introduction to Control systems in scilab
 
Numerical Methods
Numerical MethodsNumerical Methods
Numerical Methods
 
Customizing Xcos with new Blocks and Palette
Customizing Xcos with new Blocks and PaletteCustomizing Xcos with new Blocks and Palette
Customizing Xcos with new Blocks and Palette
 
Error analysis
Error analysisError analysis
Error analysis
 
Types of errors
Types of errorsTypes of errors
Types of errors
 
Introduction to Numerical Analysis
Introduction to Numerical AnalysisIntroduction to Numerical Analysis
Introduction to Numerical Analysis
 
Error analysis presentation
Error analysis presentationError analysis presentation
Error analysis presentation
 
Error analysis
Error  analysisError  analysis
Error analysis
 
Errors in Computing- Runtime, Semantics, Syntax and Fixed and Floating point
Errors in Computing- Runtime, Semantics, Syntax and Fixed and Floating pointErrors in Computing- Runtime, Semantics, Syntax and Fixed and Floating point
Errors in Computing- Runtime, Semantics, Syntax and Fixed and Floating point
 
Scilab as a calculator
Scilab as a calculatorScilab as a calculator
Scilab as a calculator
 
Example of error analysis and worked examples
Example of error analysis and worked examplesExample of error analysis and worked examples
Example of error analysis and worked examples
 

Similar to Numerical analysis using Scilab: Error analysis and propagation

(Slides) Efficient Evaluation Methods of Elementary Functions Suitable for SI...
(Slides) Efficient Evaluation Methods of Elementary Functions Suitable for SI...(Slides) Efficient Evaluation Methods of Elementary Functions Suitable for SI...
(Slides) Efficient Evaluation Methods of Elementary Functions Suitable for SI...
Naoki Shibata
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statements
MuhammadBakri13
 
Algoritmos
AlgoritmosAlgoritmos
Algoritmos
Fab Lab LIMA
 
Adsa u1 ver 1.0
Adsa u1 ver 1.0Adsa u1 ver 1.0
Adsa u1 ver 1.0
Dr. C.V. Suresh Babu
 
Data Transformation
Data TransformationData Transformation
Data Transformation
ArmanArafatAnik
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
TutorialsDuniya.com
 
Python_Module_2.pdf
Python_Module_2.pdfPython_Module_2.pdf
Python_Module_2.pdf
R.K.College of engg & Tech
 
House Price Estimation as a Function Fitting Problem with using ANN Approach
House Price Estimation as a Function Fitting Problem with using ANN ApproachHouse Price Estimation as a Function Fitting Problem with using ANN Approach
House Price Estimation as a Function Fitting Problem with using ANN ApproachYusuf Uzun
 
Lecture 05.pptx
Lecture 05.pptxLecture 05.pptx
Lecture 05.pptx
Mohammad Hassan
 
A study of the Behavior of Floating-Point Errors
A study of the Behavior of Floating-Point ErrorsA study of the Behavior of Floating-Point Errors
A study of the Behavior of Floating-Point Errors
ijpla
 
Curve fitting
Curve fittingCurve fitting
Curve fitting
dusan4rs
 
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATIONGENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
ijaia
 
Daa chapter 1
Daa chapter 1Daa chapter 1
Daa chapter 1
B.Kirron Reddi
 
PVS-Studio team is about to produce a technical breakthrough, but for now let...
PVS-Studio team is about to produce a technical breakthrough, but for now let...PVS-Studio team is about to produce a technical breakthrough, but for now let...
PVS-Studio team is about to produce a technical breakthrough, but for now let...
PVS-Studio
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Kurmendra Singh
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
amanabr
 

Similar to Numerical analysis using Scilab: Error analysis and propagation (20)

(Slides) Efficient Evaluation Methods of Elementary Functions Suitable for SI...
(Slides) Efficient Evaluation Methods of Elementary Functions Suitable for SI...(Slides) Efficient Evaluation Methods of Elementary Functions Suitable for SI...
(Slides) Efficient Evaluation Methods of Elementary Functions Suitable for SI...
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statements
 
Algoritmos
AlgoritmosAlgoritmos
Algoritmos
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
Adsa u1 ver 1.0
Adsa u1 ver 1.0Adsa u1 ver 1.0
Adsa u1 ver 1.0
 
Data Transformation
Data TransformationData Transformation
Data Transformation
 
Lect 3-4 Zaheer Abbas
Lect 3-4 Zaheer AbbasLect 3-4 Zaheer Abbas
Lect 3-4 Zaheer Abbas
 
Algorithms notes 2 tutorials duniya
Algorithms notes 2   tutorials duniyaAlgorithms notes 2   tutorials duniya
Algorithms notes 2 tutorials duniya
 
Python_Module_2.pdf
Python_Module_2.pdfPython_Module_2.pdf
Python_Module_2.pdf
 
House Price Estimation as a Function Fitting Problem with using ANN Approach
House Price Estimation as a Function Fitting Problem with using ANN ApproachHouse Price Estimation as a Function Fitting Problem with using ANN Approach
House Price Estimation as a Function Fitting Problem with using ANN Approach
 
Lecture 05.pptx
Lecture 05.pptxLecture 05.pptx
Lecture 05.pptx
 
A study of the Behavior of Floating-Point Errors
A study of the Behavior of Floating-Point ErrorsA study of the Behavior of Floating-Point Errors
A study of the Behavior of Floating-Point Errors
 
Curve fitting
Curve fittingCurve fitting
Curve fitting
 
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATIONGENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
GENETIC ALGORITHM FOR FUNCTION APPROXIMATION: AN EXPERIMENTAL INVESTIGATION
 
Chapitre 08
Chapitre 08Chapitre 08
Chapitre 08
 
Daa chapter 1
Daa chapter 1Daa chapter 1
Daa chapter 1
 
PVS-Studio team is about to produce a technical breakthrough, but for now let...
PVS-Studio team is about to produce a technical breakthrough, but for now let...PVS-Studio team is about to produce a technical breakthrough, but for now let...
PVS-Studio team is about to produce a technical breakthrough, but for now let...
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
 
Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
 

More from Scilab

Statistical Analysis for Robust Design
Statistical Analysis for Robust DesignStatistical Analysis for Robust Design
Statistical Analysis for Robust Design
Scilab
 
Electric motor optimization
Electric motor optimizationElectric motor optimization
Electric motor optimization
Scilab
 
Asteroidlanding - Scilab conference 2019 Keynote
Asteroidlanding - Scilab conference 2019 KeynoteAsteroidlanding - Scilab conference 2019 Keynote
Asteroidlanding - Scilab conference 2019 Keynote
Scilab
 
Faster Time to Market using Scilab/XCOS/X2C for motor control algorithm devel...
Faster Time to Market using Scilab/XCOS/X2C for motor control algorithm devel...Faster Time to Market using Scilab/XCOS/X2C for motor control algorithm devel...
Faster Time to Market using Scilab/XCOS/X2C for motor control algorithm devel...
Scilab
 
Scilab and Xcos for Very Low Earth Orbits satellites modelling
Scilab and Xcos for Very Low Earth Orbits satellites modellingScilab and Xcos for Very Low Earth Orbits satellites modelling
Scilab and Xcos for Very Low Earth Orbits satellites modelling
Scilab
 
X2C -a tool for model-based control development and automated code generation...
X2C -a tool for model-based control development and automated code generation...X2C -a tool for model-based control development and automated code generation...
X2C -a tool for model-based control development and automated code generation...
Scilab
 
A Real-Time Interface for Xcos – an illustrative demonstration using a batter...
A Real-Time Interface for Xcos – an illustrative demonstration using a batter...A Real-Time Interface for Xcos – an illustrative demonstration using a batter...
A Real-Time Interface for Xcos – an illustrative demonstration using a batter...
Scilab
 
Aircraft Simulation Model and Flight Control Laws Design Using Scilab and XCos
Aircraft Simulation Model and Flight Control Laws Design Using Scilab and XCosAircraft Simulation Model and Flight Control Laws Design Using Scilab and XCos
Aircraft Simulation Model and Flight Control Laws Design Using Scilab and XCos
Scilab
 
Scilab for real dummies j.heikell - part3
Scilab for real dummies j.heikell - part3Scilab for real dummies j.heikell - part3
Scilab for real dummies j.heikell - part3
Scilab
 
Scilab for real dummies j.heikell - part 2
Scilab for real dummies j.heikell - part 2Scilab for real dummies j.heikell - part 2
Scilab for real dummies j.heikell - part 2
Scilab
 
Scilab for real dummies j.heikell - part 1
Scilab for real dummies j.heikell - part 1Scilab for real dummies j.heikell - part 1
Scilab for real dummies j.heikell - part 1
Scilab
 
Multiobjective optimization and Genetic algorithms in Scilab
Multiobjective optimization and Genetic algorithms in ScilabMultiobjective optimization and Genetic algorithms in Scilab
Multiobjective optimization and Genetic algorithms in Scilab
Scilab
 
Scilab optimization workshop
Scilab optimization workshop Scilab optimization workshop
Scilab optimization workshop
Scilab
 
INRA @ Scilab Conference 2018
INRA @ Scilab Conference 2018INRA @ Scilab Conference 2018
INRA @ Scilab Conference 2018
Scilab
 
Qualcomm @ Scilab Conference 2018
Qualcomm @ Scilab Conference 2018Qualcomm @ Scilab Conference 2018
Qualcomm @ Scilab Conference 2018
Scilab
 
Sanofi @ Scilab Conference 2018
Sanofi @ Scilab Conference 2018Sanofi @ Scilab Conference 2018
Sanofi @ Scilab Conference 2018
Scilab
 
University of Applied Science Esslingen @ Scilab Conference 2018
University of Applied Science Esslingen @ Scilab Conference 2018University of Applied Science Esslingen @ Scilab Conference 2018
University of Applied Science Esslingen @ Scilab Conference 2018
Scilab
 
DLR @ Scilab Conference 2018
DLR @ Scilab Conference 2018DLR @ Scilab Conference 2018
DLR @ Scilab Conference 2018
Scilab
 
Fraunhofer IIS @ Scilab Conference 2018
Fraunhofer IIS @ Scilab Conference 2018Fraunhofer IIS @ Scilab Conference 2018
Fraunhofer IIS @ Scilab Conference 2018
Scilab
 
Arcelormittal @ Scilab Conference 2018
Arcelormittal @ Scilab Conference 2018Arcelormittal @ Scilab Conference 2018
Arcelormittal @ Scilab Conference 2018
Scilab
 

More from Scilab (20)

Statistical Analysis for Robust Design
Statistical Analysis for Robust DesignStatistical Analysis for Robust Design
Statistical Analysis for Robust Design
 
Electric motor optimization
Electric motor optimizationElectric motor optimization
Electric motor optimization
 
Asteroidlanding - Scilab conference 2019 Keynote
Asteroidlanding - Scilab conference 2019 KeynoteAsteroidlanding - Scilab conference 2019 Keynote
Asteroidlanding - Scilab conference 2019 Keynote
 
Faster Time to Market using Scilab/XCOS/X2C for motor control algorithm devel...
Faster Time to Market using Scilab/XCOS/X2C for motor control algorithm devel...Faster Time to Market using Scilab/XCOS/X2C for motor control algorithm devel...
Faster Time to Market using Scilab/XCOS/X2C for motor control algorithm devel...
 
Scilab and Xcos for Very Low Earth Orbits satellites modelling
Scilab and Xcos for Very Low Earth Orbits satellites modellingScilab and Xcos for Very Low Earth Orbits satellites modelling
Scilab and Xcos for Very Low Earth Orbits satellites modelling
 
X2C -a tool for model-based control development and automated code generation...
X2C -a tool for model-based control development and automated code generation...X2C -a tool for model-based control development and automated code generation...
X2C -a tool for model-based control development and automated code generation...
 
A Real-Time Interface for Xcos – an illustrative demonstration using a batter...
A Real-Time Interface for Xcos – an illustrative demonstration using a batter...A Real-Time Interface for Xcos – an illustrative demonstration using a batter...
A Real-Time Interface for Xcos – an illustrative demonstration using a batter...
 
Aircraft Simulation Model and Flight Control Laws Design Using Scilab and XCos
Aircraft Simulation Model and Flight Control Laws Design Using Scilab and XCosAircraft Simulation Model and Flight Control Laws Design Using Scilab and XCos
Aircraft Simulation Model and Flight Control Laws Design Using Scilab and XCos
 
Scilab for real dummies j.heikell - part3
Scilab for real dummies j.heikell - part3Scilab for real dummies j.heikell - part3
Scilab for real dummies j.heikell - part3
 
Scilab for real dummies j.heikell - part 2
Scilab for real dummies j.heikell - part 2Scilab for real dummies j.heikell - part 2
Scilab for real dummies j.heikell - part 2
 
Scilab for real dummies j.heikell - part 1
Scilab for real dummies j.heikell - part 1Scilab for real dummies j.heikell - part 1
Scilab for real dummies j.heikell - part 1
 
Multiobjective optimization and Genetic algorithms in Scilab
Multiobjective optimization and Genetic algorithms in ScilabMultiobjective optimization and Genetic algorithms in Scilab
Multiobjective optimization and Genetic algorithms in Scilab
 
Scilab optimization workshop
Scilab optimization workshop Scilab optimization workshop
Scilab optimization workshop
 
INRA @ Scilab Conference 2018
INRA @ Scilab Conference 2018INRA @ Scilab Conference 2018
INRA @ Scilab Conference 2018
 
Qualcomm @ Scilab Conference 2018
Qualcomm @ Scilab Conference 2018Qualcomm @ Scilab Conference 2018
Qualcomm @ Scilab Conference 2018
 
Sanofi @ Scilab Conference 2018
Sanofi @ Scilab Conference 2018Sanofi @ Scilab Conference 2018
Sanofi @ Scilab Conference 2018
 
University of Applied Science Esslingen @ Scilab Conference 2018
University of Applied Science Esslingen @ Scilab Conference 2018University of Applied Science Esslingen @ Scilab Conference 2018
University of Applied Science Esslingen @ Scilab Conference 2018
 
DLR @ Scilab Conference 2018
DLR @ Scilab Conference 2018DLR @ Scilab Conference 2018
DLR @ Scilab Conference 2018
 
Fraunhofer IIS @ Scilab Conference 2018
Fraunhofer IIS @ Scilab Conference 2018Fraunhofer IIS @ Scilab Conference 2018
Fraunhofer IIS @ Scilab Conference 2018
 
Arcelormittal @ Scilab Conference 2018
Arcelormittal @ Scilab Conference 2018Arcelormittal @ Scilab Conference 2018
Arcelormittal @ Scilab Conference 2018
 

Recently uploaded

Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 

Recently uploaded (20)

Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 

Numerical analysis using Scilab: Error analysis and propagation

  • 1. www.openeering.com powered by NUMERICAL ANALYSIS USING SCILAB: ERROR ANALYSIS AND PROPAGATION This tutorial provides a collection of numerical examples and advises on error analysis and its propagation. All examples are developed in Scilab. Level This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
  • 2. Error analysis and propagation www.openeering.com page 2/10 Step 1: The purpose of this tutorial The purpose of this Scilab tutorial is to provide a collection of numerical examples that are typically part of numerical analysis courses. This tutorial is intended to help readers familiarize with numerical methods and their implementations, keeping under control the error propagation. Here we provide some classical examples on error analysis and propagation. An introduction to NUMERICAL ANALYSIS USING SCILAB (Error study in Numerical Analysis) Step 2: Roadmap In this tutorial, after a brief introduction to the concept of numerical errors, we analyze some examples in which numerical errors occur. These examples are useful to understand how important is to pay attention to error propagation when implementing numerical methods. Descriptions Steps Numerical errors 3-5 Examples 6-10 Conclusions and remarks 11-12
  • 3. Error analysis and propagation www.openeering.com page 3/10 Step 3: Numerical error What is allocated in a computer is only a subset of real number (using IEEE 754 standard) and hence, a real number is represented in the computer as , a fixed strings of digits. This limited amount of storage introduces a rounding error (or round-off error). It is possible to prove the following relation with | | where is a constant that depends on the floating point system used to represent the number (for double precision arithmetic is equal to ). // Scilab command to obtain eps // ---------------------------- %eps Step 4: Truncation error The next step is to study what happens when the basic arithmetic operations are used. We denote the computer arithmetic as , , , to distinguish them from real arithmetic , , and respectively. A part from the numerical error due to limited length in bits of registers, the computer arithmetic introduces a further truncation error when results are transfer from CPU to the memory. This error is caused by the fact that the length in bits of the CPU register is greater than the one used to store numbers. As an example, if we sum two numbers and (to compute ) the corresponding machine operation can be written as ( ) with | | . The sum of two numbers involves the sum of the two floating point operands. Since this operation is done in a register of the computer, it is necessary to consider a further floating point representation when the number is transferred to be stored into the memory.
  • 4. Error analysis and propagation www.openeering.com page 4/10 Step 5: Cancellation error It is interesting to analyze the arithmetic operations when we consider relative errors. For example, we want to analyze the sum operation: | | | | in terms of the relative error of the input operands and . The relative error for is defined as | | | | A computer operation is considered numerically stable when where and and are two input operands. It is possible to prove that the computer operations and are the only stable operations with respect to the rounding error. Conversely, for addition we have: ( | | | | | | | | ) A similar inequality holds for subtraction. When , the right hand side of the inequality may be very high and hence may generate a high relative error (cancellation error). Cancellation error should be avoided whenever possible! Example of cancellation error for subtraction operation In this example we consider a decimal arithmetic with floating point where a number is expressed in the following way: with . is the exponent (or characteristic) of the representation while is the mantissa of the representation. The mantissa has always a fixed number of digits, in this case m. For example, we can compute using a system with a mantissa of 4 digits for the number, while we use a mantissa of 8 digits for the internal representations in the CPU register. The example is done using . From memory to registers: Memory (mantissa = 4) Register (mantissa = 8)   Arithmetic operation with alignment of the exponent: Register (mantissa = 8) Register with aligned exp.   +  From register to memory: Register (mantissa = 8) Memory (mantissa = 4)  It is easy to compute the final step in which we subtract again 1 to evaluate . As a result we obtain that is not equal to x.
  • 5. Error analysis and propagation www.openeering.com page 5/10 Step 6: Two equivalent expressions In this example we compare the following two equivalent expressions: These two expressions are equivalent from an algebraic point of view; the second expression is simply obtained from the first one through simplification. The first function suffers of the cancellation error when goes to zero. This phenomenon has been explained in the previous step. In the reported figure we have plotted the error . We may see that the cancellation error is huge when is close to zero. This phenomenon produces a loss of significant digits. The Scilab script for the figure on the right is available in ex01.sce. The code can be downloaded from the Openeering website. (Error err in the range [-1e-07;1e-07])
  • 6. Error analysis and propagation www.openeering.com page 6/10 Step 7: Two equivalent polynomials In this example, we compare the two following polynomial expressions: where the first expression is obtained from the second by expansion. As depicted on the right, the second expression is numerically stable while the first one is more unstable. The Scilab script is reported in the function ex02.sce. (Comparison between two algebraic equivalent polynomials)
  • 7. Error analysis and propagation www.openeering.com page 7/10 Step 8: Derivative example In this step, we study the computation of a derivative from a numerical point of view. To approximate the first derivate, we use here the difference quotient (a.k.a. Newton’s quotient): For example, we may analyze the formula for the function at point varying h in the following way: The plot on the right visualizes the results. From a mathematical point of view, when goes to zero, the formula should assume the value of the first derivative. Intuitively, we may expect the smaller the , the better the approximation. Unfortunately, because of cancellation errors, it happens that the most reliable value for the derivate is reached in (for , the value of the derivate is the same as ). The Scilab script for plot and table is reported in the function ex03.sce. (Value of the derivative changing the value of h) (Derivative example – table of results)
  • 8. Error analysis and propagation www.openeering.com page 8/10 Step 9: Error analysis and optimal step The Newton’s quotient to approximate the derivative contains two sources of error:  Round-off error;  Truncation error. This follows from the Taylor series expansion of : where and hence: The first term contributes to round-off error, while the second term gives rise to a truncation error. As reported on the right the total error can be expressed as ̅ From the above formula it is possible to compute the optimal step size . Taking the derivative of the total error with respect to and setting this quantity equal to zero, we have: √ ̅ This represents the optimal value for to minimize the total error. Evaluation of the round-off error: The round-off error for the Newton’s quotient can be written as: | ( ) ( ) | | | where | | (remember that where | | ). Moreover we ignore error from division by . In order to evaluate this error, with small, we replace by We do not know the signs of and , so we replace the difference with ̅. This leads to: ̅ | | ̅ where | |. Evaluation of the truncation error: The truncation error is given by: | | where for small values of we replace by and | |.
  • 9. Error analysis and propagation www.openeering.com page 9/10 Step 10: Exercise It is possible to compute the second derivatives of a function using the following approximation Apply the above formula to compute the second derivative of the function at a given point . Moreover, prove the following estimate for the total error: | ( ) ( ) ( ) | ̅ where | | and | |. The upper bound error is minimized when has the value √ ̅ Hints: Using Taylor expansion for the function and to the fourth order paying attention to the signs. (Relative error for second derivative approximation) (Second derivative approximation, table of results)
  • 10. Error analysis and propagation www.openeering.com page 10/10 Step 11: Concluding remarks and References In this tutorial we have collected a series of numerical examples written in Scilab for the study of numerical errors. 1. Scilab Web Page: Available: www.scilab.org. 2. Openeering: www.openeering.com. 3. J. Higham, accuracy and Stability of Numerical Algorithms, SIAM 4. Atkinson, An Introduction to Numerical Analysis, Wiley Step 12: Software content To report a bug or suggest improvements please contact Openeering team at the web site www.openeering.com. Thank you for your attention, Silvia Poles and Manolo Venturin -------------- Main directory -------------- ex01.sce : Expression example ex02.sce : Polynomial example ex03.sce : Derivative example ex04.sce : Second derivative exercise license.txt : The license file