Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Prerna Bansal Maths in Chemistry

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

Prerna Bansal

Maths in Chemistry
Also of Interest
Molecular Symmetry and Group Theory.
Approaches in Spectroscopy and Chemical Reactions
R. C. Maurya, J.M. Mir, 
ISBN ----, e-ISBN ----

Elemental Analysis.
An Introduction to Modern Spectrometric Techniques
Gerhard Schlemmer, Lieve Balcaen, José Luis Todolí, Michael
W. Hinds, 
ISBN ----, e-ISBN ----

Physical Chemistry of Polymers.


A Conceptual Introduction
Sebastian Seiffert, 
ISBN ----, e-ISBN ----

Applied Electrochemistry
Krystyna Jackowska, Paweł Krysiński, 
ISBN ----, e-ISBN ----

Organic Chemistry.
Fundamentals and Concepts
John M. McIntosh, 
ISBN ----, e-ISBN ----
Prerna Bansal

Maths in
Chemistry

Numerical Methods for Physical and Analytical


Chemistry
Author
Dr. Prerna Bansal
University of Delhi
Rajdhani College
Mahatma Gandhi Marg
110015 Delhi
bsprerna@yahoo.co.in

ISBN 978-3-11-069531-1
e-ISBN (PDF) 978-3-11-069532-8
e-ISBN (EPUB) 978-3-11-069548-9

Library of Congress Control Number: 2020938296

Bibliographic information published by the Deutsche Nationalbibliothek


The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie;
detailed bibliographic data are available on the Internet at http://dnb.dnb.de.

© 2020 Walter de Gruyter GmbH, Berlin/Boston


Cover image: berya113/iStock/Getty Images Plus
Typesetting: Integra Software Services Pvt. Ltd.
Printing and binding: CPI books GmbH, Leck

www.degruyter.com
Dedicated
To
My Parents
Acknowledgement
I owe this book to all those who encouraged me in some way or another to write
this book. The source of inspiration for writing this book came from my students.
I entirely dedicate this book to my beloved Parents who love me immensely and
unconditionally and without whom I would have not been able to start writing a
book in the first place. They have been a source of constant strength, support and
love in difficult times. I am highly indebted for their constant patience for bearing
with me while I was writing this book.
I would also like to express my heartfelt gratitude to my brother Mayank for
putting up with me when I used to make odd asks. I also owe a special thanks to
my two lovelies Divit and Ishaani for their beautiful smiles and laughters which
used to melt my stress in a blink. This acknowledgement would have been incom-
plete without mentioning my beautiful sister Sonia for her excellent advice at all
times when when she was busy with her Ph.D work.
I express my gratitude to all my students who believed in me and kept asking
me to write a book which can provide all the mentioned topics under a single wing.
I would also like to express my sincere gratitude to all my teachers who taught me
and inspired me to be the one.
I also express a sincere word of thanks to my Husband Anup Goel who kept
boosting my morale during the final stages of this manuscript completion for when
I met him first. I really owe him for his constant support and encouragement during
the entire process of its proof reading.
I also owe a word of thanks to my new family including my Father-in-law,
Mother-in-law and my Brother-in-law for their support during the proof reading of
this book.
I express my sincere thanks to the publisher De Gruyter’s for their cooperation
and processing of this manuscript. I also want to express a special word of thanks
to Emma Svensson, Ute Skambraks and Dipti Dange for their constant help and
support.
Above all, I would like to say thanks to Thakurji for providing me courage, mo-
tivation, strength and above all, his grace for giving me enough courage for writing
this book.

July 2020

https://doi.org/10.1515/9783110695328-202
Contents
Acknowledgement VII

Chapter 1
Units and measurements 1
1.1 Introduction 1
1.2 Basic arithmetic operations 1
1.3 Hierarchy of operations 2
1.4 Classification of unit system 3
1.4.1 Metric system of units 3
1.4.2 Classification of metric system of units 4
1.5 Definition of base units 5
1.6 Interconversion of units 8
1.7 Significant figures 9
1.8 Rules for performing arithmetic operations 10
1.8.1 Addition and subtraction 10
1.8.2 Multiplication and division 11
1.8.3 Mixed mathematical operations 12
1.9 Rounding off significant figures 13
1.10 Problems for practice 14

Chapter 2
Uncertainties and errors 17
2.1 Introduction 17
2.2 Absolute and relative uncertainty 20
2.3 Propagation of uncertainty 21
2.4 Rounding off uncertainties 28
2.5 Classification of errors 28
2.6 Problems for practice 29

Chapter 3
Some mathematical functions 31
3.1 Introduction 31
3.2 Classification of functions 31
3.2.1 Linear function 31
3.2.2 Exponential 32
3.2.3 Logarithmic function 34
3.2.4 Polynomials 36
3.2.5 Power function 37
3.2.6 Circle 37
3.2.7 Rational number 38
X Contents

3.2.8 Partial fractions 39


3.2.9 Trigonometric functions 39
3.2.9.1 Inverse trigonometric functions 42
3.2.9.2 Hyperbolic trigonometric functions 42
3.2.10 Taylor’s series 42
3.2.10.1 Maclaurin series 43
3.2.11 Coordinate systems 43
3.2.12 Number system 45
3.3 Problems for practice 48

Chapter 4
Descriptive statistics 49
4.1 Introduction 50
4.2 Mean 50
4.2.1 Arithmetic mean 51
4.2.2 Weighted mean 51
4.2.3 Geometric mean 51
4.2.4 Harmonic mean 52
4.3 Median 52
4.4 Mode 53
4.5 Standard deviation 53
4.6 Variance 54
4.7 Coefficient of variation 54
4.8 Data analysis 57
4.8.1 Q-test 57
4.8.2 Confidence limit 59
4.8.3 t-Test 59
4.8.4 F-test 62
4.9 Distribution of errors 65
4.9.1 Gaussian distribution 65
4.9.2 Binomial distribution 66
4.9.3 Poisson’s distribution 67
4.10 Statistical tools using spreadsheets 67
4.11 Problems for practice 70

Chapter 5
Numerical curve fitting 71
5.1 Introduction 71
5.2 Correlation 71
5.2.1 Pearson correlation coefficient 72
5.2.2 Spearman’s rank correlation coefficient 72
5.3 Regression 73
Contents XI

5.4 Interpolation versus curve fitting 74


5.5 Least square curve fitting 74
5.5.1 Linear regression 76
5.5.2 Multivariate linear regression 85
5.5.3 Polynomial regression 87
5.6 Regression and correlation in EXCEL 90
5.7 Exercises for practice 94

Chapter 6
Numerical integration 97
6.1 Introduction 97
6.2 Newton–Cotes formula 97
6.2.1 Riemann sum 98
6.2.2 Trapezoidal rule 100
6.2.2.1 Error of trapezoidal rule 105
6.2.3 Simpson’s 1/3rd rule 106
6.2.3.1 Composite integral Simpson’s rule 108
6.2.4 Simpson’s 3/8 rule 109
6.2.5 Boole’s rule 110
6.3 Exercises for practice 115

Chapter 7
Differential equations 117
7.1 Introduction 117
7.2 Euler’s method 118
7.3 Runge–Kutta method 121
7.3.1 RK 2 or predictor–corrector method 121
7.3.2 RK3 124
7.3.3 RK4 124
7.4 Problems for practice 129

Chapter 8
Numerical differentiation 131
8.1 Introduction 131
8.2 Derivatives using Newton’s forward interpolation polynomial 134
8.3 Derivatives using Newton’s backward interpolating polynomial 137
8.4 Derivatives using Stirling interpolating polynomial 139
8.5 Newton’s divided difference polynomial 142
8.6 Lagrange’s polynomial 144
8.7 Richardson’s extrapolation 147
8.8 Problems for practice 149
XII Contents

Chapter 9
Numerical root-finding methods 151
9.1 Introduction 151
9.2 Newton–Raphson method 151
9.3 Iteration method 156
9.4 Binary bisection method 162
9.5 Secant method 165
9.6 Regula-Falsi method 169
9.7 Problems for practice 174

Appendix A 175

Appendix B Answers to the problems for practice 179

Index 181
Chapter 1
Units and measurements

1.1 Introduction

In science, especially physical chemistry, quite a lot of measurements are involved. A


physical quantity holds a great importance. A physical quantity is the product of two
quantities, that is, a unit and a number. While measuring any parameter in physical
chemistry, number itself is not relevant unless it is hooked to a unit. For instance,
6 metre has the number “6” and unit “metre”. Also, while correlating two physical
quantities, constant and variables are involved. A constant is a physical quantity that
has a fixed value, for example, Planck’s constant (h = 6.626 × 10−34 J s) and Avogadro’s
constant (NA = 6.023 × 1023 mol−1). A variable, on the other hand, is a quantity that can
have any permissible values based on some other quantities for which the given vari-
able is a function, for example, p is a function of V, T, n, that is,

p = nRT=V (1:1)

where p can be represented as p = f ðV, T, nÞ.


Further, the variables are classified as dependent and independent variables.
In the earlier example, since p is a function of V, T and n, p is a dependent variable
while the rest are independent variables.

1.2 Basic arithmetic operations

A physical quantity is often the result of correlation of other physical quantities


that are related by mathematical operators. To do so, basic arithmetic operations
are performed on these quantities. We are all familiar with basic mathematical op-
erations: addition, subtraction, multiplication and division. In this section, we will
simply sum up the basics learned so far (Table 1.1).

Table 1.1: Mathematical operations.

Operation Expression Ordering

Addition A+B A+B=B+A

Subtraction A−B A−B≠B−A

Multiplication A × B or A.B or AB A×B=B×A

Division A A B
A  B or ≠
B B A

https://doi.org/10.1515/9783110695328-001
2 Chapter 1 Units and measurements

Some of the equations used in physical chemistry involving these operations are
listed below:

Ideal gas equation: pV = nRT (1:2)

Henderson−Hasselbalch equation: pH = pKa + logðacid=saltÞ (1:3)

Einstein equation: E = mc2 (1:4)

Nernst equation: E = E0 − ðRT=nFÞlog Q (1:5)


pffiffiffi
Onsager equation: ^ = ^0 − b c (1:6)

Arrhenius equation: k = A expð− Ea =RTÞ (1:7)

1.3 Hierarchy of operations

Before performing arithmetic operations, there are some set of rules that should be
followed. In conventional mathematics, BODMAS rule is used. They are also called
operator precedence or rules of precedence or order of operations. A general
method of remembering them is used in different places. For example, “PEMDAS”
is the acronym used in the United States. The order of operations is as follows:
(1) Parentheses
(2) Exponential
(3) Multiplication
(4) Division
(5) Addition
(6) Subtraction

According to these rules, parentheses precede exponents which precede multiplica-


tion and division. While solving parentheses, the functions inside the parentheses
are solved inside the parentheses itself, and is then expanded further. Also, the
other operators are solved from left to right. For example,

a. 2 × 3 + 4 = 6 + 4 = 10
But 2 × ð3 + 4Þ = 2 × 7 = 14

b. 5 + 41=2 = 5 + 2 = 7
But ð5 + 4Þ1=2 = 3
c. ð4 × 8Þ2 = 322 = 16. But ð4 × 62Þ = 242 = 12
1.4 Classification of unit system 3

Index rule
According to the index rule, index denotes the times a number has to be multiplied by itself, where
index is a number which is raised to a power. The rule can be illustrated below.
(a) ax × ay = ax + y e.g. 23 × 25 = 28
(b) ax = ay = ax − y e.g. 25 =23 = 22
(c) ðax Þy = ðay Þx = axy e.g. ð23 Þ2 = 64
(d) a − x = 1=ax e.g. ð2Þ − 1 = 1=2 = 0.5
(e) ðabÞx = ax × bx e.g. ð2 × 3Þ4 = 24 × 34 = 1296
ax ax 24 24
(f) b = bx e.g. 3 = 34
(g) ða + bÞ ≠ a + bn e.g. ð2 + 3Þ4 = 625 while 24 + 34 = 97. Hence, both are not equal.
n n

1.4 Classification of unit system

The history of unit systems begins with the British Imperial System of units, fol-
lowed by US Customary and International System of Units (metric system). Of all,
the metric system of units was a more coherent system of units since it was easy to
use and one may not use extra conversion factors that are not available in the
equation.

1.4.1 Metric system of units

The metric system is the most common and internationally accepted decimalized
system of measurement also known as SI unit system. It is classified in terms of
base units (fundamental) and derived units. These units can be used to define any
other physical quantities. The metric system of units is easy to use with the help of
multiples and fractions. In fact, the earlier used US Customary unit system and
British Imperial unit system are defined using the metric unit system.
The very idea of introducing the metric system was to have a unit system derivable
from an unchanging phenomenon but practical limitations made the use of artefacts
(prototype for metre and kilogram) indispensable. The multiples and submultiples of
metric units in terms of powers of ten make them conveniently useful with prefixes in
the names. Metric system exists in various forms with the option of choosing different
base units. CGS (centimetre–gram–second) and MKS (metre–kilogram–second) are
also known as metric system. FPS (foot–pound–second) is known as British System. SI
unit system is more precise form of MKS system. Metric units are widely used and ac-
cepted system of units in science.
4 Chapter 1 Units and measurements

Units are broadly classified as


(1) Fundamental units: Also known as base units, these units are the units of funda-
mental quantities which can be measured independently; for example, length,
mass, time, electric current and candela.
(2) Derived units: These units are derived by use of two or more fundamental units.
For example, area of rectangle, volume, energy, force, velocity, pressure, lumen
and watt.

All physical quantities can be expressed in terms of these seven base quantities.
Table 1.2 lists the seven base units along with their standard definition and Table 1.3
represents some derived units using base units.

1.4.2 Classification of metric system of units

There are three types of fundamental unit systems in metric system.


1. CGS unit system: As the name indicates, this metric system uses centimetre,
gram and second as the base units of length, mass and time.
2. MKS and MTS system: This system uses metre, kilogram and second as base
units. It was adopted in 1889 and it replaced CGS unit system. This MKS system
formed the basis of SI. There is another system of units called MTS system
based on metre, tonne and second.
3. SI unit system: Earlier, different unit systems were used to measure the same
physical quantity, but then a standard procedure was developed to maintain uni-
formity in the measurement called System de International (SI) unit system. It was
introduced by the International Union of Pure and Applied Chemistry (IUPAC)
and International Organization for Standardization, also known as SI. It is a type
of metric system developed in 1960 when some other units were also incorporated,
which were earlier absent in the other metric system. It is the most widely ac-
cepted unit system. The SI unit system is derived from MKS system.

Table 1.2: Base units for seven physical quantities with SI units.

Physical quantity Symbol Name of SI unit Symbol for SI unit

Length L Metre m

Mass M Kilogram kg

Time t Second s

Electric current I Ampere A


1.5 Definition of base units 5

Table 1.2 (continued )

Physical quantity Symbol Name of SI unit Symbol for SI unit

Temperature T Kelvin K

Amount of substance N Mole mol

Luminous intensity Iv Candela cd

British Imperial Unit system


The imperial system or imperial units is a system of units defined in British Weights and
Measurements Act of 1824. In British imperial system, the base unit of length is yard and that of
temperature is Fahrenheit. It was derived haphazardly but later by twentieth century most coun-
tries adopted the metric system (Appendix A1). FPS is the fundamental unit of British unit system
which is foot–pound–second.

US Customary System of Units


The other type of traditional unit system that was established in the United States was the US
Customary System of Units that was derived from the imperial system of units; for example, feet,
inches, miles and yard (Appendix A1). The United States after its independence from Britain de-
cided to adopt only the imperial system of units, even when the metric system was becoming popu-
lar among most countries.

1.5 Definition of base units

The base units are defined in terms of constants like speed of light in vacuum (c),
charge of the electron or those that can be measured accurately. The new redefined
units have replaced the artefact unit system with more coherent units of measure-
ments. The earlier used prototype of weight (platinum–iridium alloy) did not al-
ways weigh the same. Even when the piece was inside three bell jars, it gets dirty
and rusty. Cleaning the dust would change the mass of the prototype. Hence, it was
not accurate. The redefined system allows to measure mass directly at any scale
and will prove to be a boon to the scientists.
The following physical constants have been redefined in SI unit system:
(1) The Planck’s constant
(2) The Avogadro’s constant (NA)
(3) The Boltzmann’s constant (k)
(4) The elementary electric charge (e)
(5) The speed of light (c)
(6) The luminous efficacy of a defined visible radiation (Kcd)
(7) The caesium hyperfine frequency (Δνcs)
6 Chapter 1 Units and measurements

In November 2018, the changes in the units for four units were approved by General
Conference on Weights and Measurements. In May 2019, four of the seven SI base
units were redefined, which are kilogram, ampere, kelvin and mole by setting the
exact value to the Planck’s constant (h), Avogadro’s constant (NA), Boltzmann’s
constant (k) and the elementary electric charge (e), respectively. The other three
units, that is, second, metre and candela, were already defined by the physical con-
stants. All the seven base units that are redefined can be explained further.
(1) Length: Its base unit is metre. Earlier, the definition of metre was based on
wavelength of spectral line of krypton-86 and was defined as the distance trav-
elled by light in a vacuum over a time interval of 1/299,792,458 of a second. The
current definition is based on taking fixed numerical value of speed of light, c,
in vacuum to be 299,792,458 m s−1.
(2) Mass: The base unit of mass is kilogram (kg). Earlier, it was defined as the mass
of the shiny piece of platinum–iridium alloy held in Bureau International des
Poids et Mesures in France. It used to be the international prototype or artefact of
the kilogram. The new definition of kilogram involves accurate weighing ma-
chines called “kibble balance” that uses Planck’s constant to measure mass pre-
cisely by using electromagnetic force. The Planck’s constant which has been
measured in recent years with precision is 6.62607015 × 10–34 kg m2 s−1.
This new SI system will bring more accuracy in many fields, including bio-
technology, manufacturing, trade and human health.
(3) Time: The base unit for time is second. A second is defined as the duration of
9,192,631,770 periods of the radiation corresponding to the transition between
two hyperfine levels of the ground state of the caesium-133 atom. In the im-
proved definition, the numerical value of the caesium frequency Δνcs is fixed.
(4) Current: The base unit for current is ampere. Ampere is defined as the amount
of electric charge passing through an electric circuit per unit time but the pre-
vailing definition defined it as the flow of 1/1.602176634 × 10−19 times the ele-
mentary charge, e, per second.
(5) Temperature: The base unit of temperature is Kelvin. The previous definition
of kelvin was defined as the fraction 1/273.16 of the thermodynamic tempera-
ture of the triple point of water, that is, 0.01 °C or 273.16 K while the current
definition involves fixing the numerical value of Boltzmann’s constant, k, to be
1.38 × 10−23 J K−1 making sure that the triple point of water temperature remains
the same. One kelvin is equal to change in temperature T that results in thermal
energy kT by 1.380649 × 10−23 JK-1 where J K−1 = kg m2 s−2 K−1 where kilogram,
metre and second are defined according to the improved definition. Now, since
kelvin is derived from physical constant rather than experimental condition
(triple point of water), it is more reliable and stable.
1.5 Definition of base units 7

(6) Amount of substance: The base unit of amount is mole. It was defined as the
number of atoms in 12 g of carbon 12C (the isotope of carbon with relative
atomic mass 12 Da). The revised definition is the amount of substance of exactly
6.02214076 × 1023 elementary particles (atoms, molecules or ions).
(7) Luminous intensity: Its base unit is candela (cd). It is defined as the luminous
intensity or electromagnetic field of frequency 540 × 1012 Hz or 540 terahertz
emitted by a source in a specified direction with 1/683 watt per steradian.
Luminous intensity measures the visual intensity of any light source and is the
only unit that a human eye can measure. It reflects the brightness or intensity
of the light and its direction. Since earlier times, candles were used to be the
source of light; hence, the name is derived from the candle, so candela being
the unit of luminous intensity.

Table 1.3: Derived SI units.

Physical quantity Name Description Symbol SI units

Frequency Hertz Events per unit time Hz s−

Force Newton Mass × acceleration N kg ms−

Pressure Pascal Force per unit area Pa N m−

Energy, work, heat Joule Force × distance J Nm

Power Watt Work per unit time W J s−

Electric charge Coulomb Current × time C As

Electric potential Volt Work per unit charge V J C−

Electric capacitance Farad Charge per unit potential F C V−

Electric resistance Ohm Potential per unit current V A−

Electric conductance Siemens Current per unit potential S

Magnetic flux Weber Work per unit current Wb J A−

Magnetic flux Tesla Magnetic flux per unit area T Wb m−


density

Inductance Henry Magnetic flux per unit H Wb A−


current

Plane angle Radian Angle subtended by unit rad 


arc at centre of unit circle

Solid angle Steradian Solid angle subtended by Sr 


unit surface at the centre
of unit sphere
8 Chapter 1 Units and measurements

Some physical quantities are dimensionless since they have the ratio of quantities
with same dimension. For example, mole fraction, relative pressure, relative mass
and so on. Practically, there is no considerable effect on daily life measurement. It
will only matter if the measurements are below 1 kg or while measuring very small
mass. The only advantage now is that the scientist would now be able to measure
them at any place, time or scale. Hence, more accurate measurements would be
made.

1.6 Interconversion of units

There are some experiments where the measurement of the physical quantity in one
type of unit is more preferable than in other. The process of conversion depends on
the situation and intent of purpose for which conversion is required. For instance,
the SI unit for potential difference is volt, but while performing potentiometric titra-
tions, the preferred unit is mV since the amount of potential difference is very
small. In such cases, one needs to carry out the interconversion of unit into more
accepted form, that is, SI unit. Similarly, if one wants to measure the length of a
pencil, then some measurements if made in metre (SI unit) would introduce more
error and approximation, rather if the measurement is made in cm (CGS unit), then
converting into metre would give more accurate result. There are many multiples
and submultiples of metre, some are millimetre, micrometre, centimetre, kilometre
and so on. They have prefixes attached to the SI units (Appendix A1). On the basis
of utility, one may use the conversion factor to convert the measured unit into more
preferred unit. A conversion also depends on the precision and accuracy of mea-
surement with which comes certain amount of associated uncertainty of measure-
ment. Conversion should neither increase nor decrease the precision of the first
measurement. A table of different relationships and conversion factors for some
units is given at the end of the book (Appendix A1). The conversion from one unit
form to another unit form can be done by simple method called factor label
method. Factor label method is an elementary method used to convert a quantity
measured in one unit to another unit system by multiplying the conversion factor.

Example 1: Convert 0.07912 metre (m) into millimetre (mm).


Solution: From the conversion factors, we know that 1 m = 1,000 mm
1, 000mm
So 0.07912m = 0.07912m × 1m

0.07912m = 79.12mm

When the physical quantity is multiplied by the conversion factor ratio, then one unit in the
denominator is cancelled out by unit in numerator leaving only one unit.
1.7 Significant figures 9

Example 2: A piece of metal is 7 in long. Calculate its length in cm.


Solution: Since 1 in = 2.54 cm
 cm
Therefore, 7 in = 7 in × 2.54
1 in = 17.78 cm

Example 3: A beaker contains 5 L of NaOH. Calculate the volume of NaOH in m3.


Solution: As 1 L = 1,000 cm3 and 1 m = 100 cm
 1 m 3 −3
Hence, 5 L = 5 × 1, 000 cm3 × 100 cm = 5 × 10 m3

Example 4: How many atoms are there in 7.50 g of aluminium coil?


Solution: The atomic mass of aluminium is 26.981539 g/mol, which implies that 1 mol of aluminium
contains Avogadro’s number (6.023 × 1023) of aluminium atoms or 26.981539 g of aluminium con-
tains 6.023 × 1023 aluminium atoms. So, by using factor label method, we have

mol 6.023 × 1023 atoms


7.50g = 7.50g × ×
26.981539g mol1 mol
7.50 × 6.023 × 1023
= atoms
26.981539
= 1.67 × 1023 atoms

1.7 Significant figures

While making measurements, the instrument measures the physical quantity which
is accurate up to a certain limit. The digits in the measurement up to which the
measurement is certain are called significant figures. The number of digits implies
the certainty or confidence up to which a measurement is made. More significant
digits imply greater precision.
Certain rules to be followed to determine the significant figure in any measure-
ments are listed as follows.
1. All non-zeroes in a measurement are significant.
For example, mass of a metal piece is 3.15 g. Here, there are three significant
figures.
2. All the zeroes between two non-zero digits are significant.
For example, in numbers 0.00000208, 0.2008 and 208.00, there are three, four
and five significant numbers, respectively.
3. A measurement which is less than one, all zeros to the right of a decimal
point and to the left of a non-zero digit are never significant.
For example, in 0.0234 g, number of zero after decimal and before 2 is not sig-
nificant. There are three significant digits: 2, 3 and 4.
10 Chapter 1 Units and measurements

4. (a) All zeroes on the right of the last non-zero digit with the decimal point
are significant.
For example, in a number “2350.”, there are four significant digits.
(b) All zeroes on the right of the last non-zero digit with no decimal point
are insignificant.
For example, in the number 2350, there are three significant figures.
(c) The trailing zeroes to the right of a decimal point are significant, if they
are not followed by a non-zero digit.
For example, in number 53.00, there are four significant digits (5, 3, 0 and 0)
5. The exact numbers have infinite number of significant figures.
For example, 3 m = 3.00 m = 3.0000 m = 3.00000000000 m
6. When the number is written in scientific notation as a × bn, then the num-
ber of significant figures are counted in a.
For example, we have the number 0.000521, which we can write in scientific no-
tation as 5.21 × 10−4. Therefore, here the number of significant digit is three (5, 2
and 1). The 10 and –4 do not hold any place in significant figures. Changing any
number to scientific notation may vary with the number of significant figures.
For example: 3600
3600 = 2 s.f.
3600. = 4 s.f.
3.60 × 103 = 3 s.f.

Atlantic–Pacific rule
If a number has a decimal point, then the trailing zeroes on the Pacific/left side are insignificant,
and if the number does not have a decimal point, then the zeroes to the Atlantic/right side are
insignificant (since Pacific ocean is on left and Atlantic is on right side of the United States).
For example, 0.00837 has 3 s.f. (8, 3 and 7) while 3500 has 2 s.f. (3 and 5).

1.8 Rules for performing arithmetic operations

1.8.1 Addition and subtraction

The significant figure while performing addition and subtraction depends on the
number of decimal places as the number with least precise value.
For example, 63.152 + 5.6 = 68.752
Instead, one should write the answer as 68.7, since the least precise value (5.6)
has one decimal place.
1.8 Rules for performing arithmetic operations 11

Example 5: X = 312.951 + 0.32.


Solution: X = 313.27
Since, the least precise term in the addition is 0.32, which has two decimal places. So, the answer
should also retain two decimal places. Hence, it is round off to two decimal places, that is, 313.27.

Example 6: 0.241 g of NaOH is dissolved in 142.0 g of water. What is the mass of the solution?
Solution: We can find the mass of solution as 142.0 g + 0.241 g = 142.241 g.
Since the least precise measurement has 1 decimal place (i.e. 142.0), then the answer should be
142.2 g (by rounding off).

1.8.2 Multiplication and division

The same rule applies while performing multiplication and division, that is, the
number of significant figures in the result would be the same as the least precise
number in the calculation.

Example 7: 1.5 × 2.46 = 3.69 (3 s.f.).


Solution: 1.5 has 2 s.f. and 2.46 has 3 s.f., so the answer according to the rules should have as
many s.f. as in the least precise number which is 1.5.
Hence, the result on rounding off should give 3.7 (2 s.f.).

Example 8: 1.34 × 5.073 × 3.7 = 25.151934


Solution: Since the least precise number is 3.7 which has 2 s.f., the result should be rounded off to
25, which has 2 s.f.

Example 9: 1.50 × 6.234


Solution: Each of the above has 3 and 4 s.f., respectively. The answer should be 9.351. Again apply-
ing the rule, the rounding off should give 9.35(3 s.f.).

Example 10: 19.3 mL of 0.05721 N NaOH was used to neutralize the given 20.0 mL HCl solution.
Calculate the normality of HCl solution used.
Solution: Here the normality of NaOH has 4 s.f. but the other volume values have 3 s.f., so the final
answer should also have least number of s.f., that is, 3. We know that N1V1 = N2V2 so

NHCl = 19.3 × 0.05721=20.0


= 0.05520
= 0.0552ðrounding offÞ

While calculating the logarithm, the mantissa of the logarithm should contain the
same number of significant digits as there are in the number for which the loga-
rithm is calculated.
12 Chapter 1 Units and measurements

For example, log(2.00 × 105) = 5.3010299956. Since the number 2.00 × 105 has
3 s.f., the mantissa should also have 3 s.f. Hence, the answer should be 5.301.
For example, log(2 × 104) = 4.3010299956. Here, 2 × 104 has 1 s.f. so answer
should be 4.3.

Example 11: The rate constant at two temperatures 289 and 333 K are 5.03 × 10−2 and 6.71 mol−1dm3 s−1,
respectively. Calculate the value of activation energy using the expression
 
k333 Ea 1 1
ln = − (1:8)
k298 R 289 333

Solution: Both the constants have 3 s.f., so the ratio of k2/k1 should also have 3 s.f. as k2/k1 =
133.39. Since the rule says that the mantissa should have as much s.f. as in the number itself for
which the logarithm is calculated so the number of s.f. should be 3 in mantissa as ln k = 4.893,
which gives Ea = 88, 982.709 Jmol − 1

While calculating antilog of a number, the result should have the same number of
s.f. as the mantissa in the logarithm.
For example, antilog(0.477) = 2.99916251, which should be rounded off to 3.00
For example, antilog(0.47) = 2.951209226, which should be rounded off to 3.0

Example 12: The Arrhenius equation is given as

ln k = ln A − Ea =RT (1:9)

Given ln A = 9.874 and Ea = 28.26 kJ mol–1. Calculate k at 298.15 K.


Solution: ln k = 9.874 − ð28.26 × 103 Þ=ð8.314 × 298.15Þ = 9.874 − 11.40 = − 1.5266
The mantissa has only one significant figure. Then solving for k and using the above-mentioned
rule, we have
k = e − 1.5266 = 0.217 or just 0.2.

1.8.3 Mixed mathematical operations

When mixed operations are involved, calculation should be done using more number
of significant figures than will be significant to arrive at a value. Then, go back and
retrace each step for how many significant figures should have been left up to the
final result based on the standard convention. Successive rounding can magnify the
inaccuracies. Hence, when doing rounding at each step, it is always advisable to re-
tain one extra insignificant figure than can be justified to avoid error. The final an-
swer is then rounded off to the desired number of significant figures. For instance,

X = ðð4.354 + 0.0026Þ=28.5Þ − 3.553 × 10 −3


1.9 Rounding off significant figures 13

X = 0.14931016

First, 4.354 + 0.0026 = 4.357 (since the least precise value has accuracy of 3 decimal
places so should be in the answer (instead of 4.3566)).
Second, 4.357/28.5 = 0.153 (since the least precise number has 3 significant fig-
ures instead of 0.152877192).
Lastly, 0.153 – 0.003553 = 0.149 (since in subtraction, the least precise number
has three decimal places, that is, 0.153 (instead of 0.149447)).
The value obtained while keeping all figures was 0.14931016 which if rounded
off to have three significant figures is 0.150 or 1.50 × 10−1, which is the final answer.

1.9 Rounding off significant figures

Rounding off the numbers is done to remove insignificant figures by replacing them
with insignificant zeroes. If the insignificant digit is 0, 1, 2, 3 and 4, then while
rounding off, one must underestimate the value. The value of the last significant
figure remains unchanged. If it is 5, 6, 7, 8 and 9, then overestimation is done and 1
is added to the last significant digit.

Example 13: Round off 2.568 to 4 s.f.


Solution: 2.568 is rounded off to 2.57 (3 s.f.). In this case, the insignificant number is greater than
5 then it is easy to round it off to the next highest number, but if the insignificant digit is 5, there
are two options, either round up or round down because in that case the number is lying between
two rounded numbers.

Example 14: Round off 5321.98 to 2 s.f.


Solution: 5300, since it has no decimal point, the number of significant figures is 2. If it had been
5300., then it will have 4 s.f., which is not correct.

Example 15: Round off the following:


(a) 2.3467 to 4 s.f. (b) 3.6541 to 3 s.f.
Solution: (a) In 2.3467 the last significant digit is 6 and insignificant digit is 7. Since it is greater
than 5, 1 is added to the last significant digit and the insignificant digit is dropped off.
(b) 3.6541 is round off to 3.654. Here, the last significant digit is 4 while insignificant is 1 which
is less than 5; hence, it should be dropped off and only the previous digits are kept.
There is one more method to round off. It revolves around rounding off around the digit 5. This
value is midway between underestimated and overestimated value. In such cases, 5 is rounded
down when the preceding significant digit is even and 5 is rounded up when the significant digit
preceding is odd.
14 Chapter 1 Units and measurements

Example 16: 2.6375 is to be rounded off to 4 s.f.


Solution: Here, the last insignificant figure is 5 while the significant figure is 7, which is odd;
hence, the rounding off gives 2.638 to make the last significant digit even (7 to 8).

Example 17: 2.3145 is to be rounded off to 3 s.f.


Solution: Here the last insignificant figure is 5 while the significant figure is even (4) already.
Hence, it should not be meddled with. Hence the answer should be 2.314 (4 s.f.).
**Insignificant figures are often written as a small size letter like 2.3457, where 7 is the insignifi-
cant figure and 5 is the last significant figure.

1.10 Problems for practice

1. Identify the number of significant figures:


(a) 2.0040
(b) 0.083
(c) 5.21 × 10−5
(d) 9,600
(e) 7,500.00
(f) 9.80 × 107
(g) 6.023 × 1023

2. Round off the following numbers:


(a) 6,509,213.246 to 3 s.f.
(b) 0.0672000 to 1 s.f.
(c) 92.3518 to 3 s.f.
(d) 0.0012475 to 3 s.f.
(e) 0.004520 to 2 s.f.
(f) 5.0942 to 2 s.f.
(g) 32,391 to (1 s.f. to 6 s.f.)
(h) 83.810482 to (1 s.f., 2 s.f. and 6 s.f.)
(i) 0.7615 to 2 s.f.
(j) 0.956 to 1 s.f.
(k) 894.2 to 1 s.f.
(l) 8.2197 to 1 s.f.
(m) 39.0126 to 1 s.f.
(n) 0.0247779 to 4 s.f.
(o) 8,516.131 to 2 s.f.
(p) 0.00031834662 to 2 s.f.
1.10 Problems for practice 15

3. Find the following:


(a) X = 62.4 + 19.570 to 3 s.f.
(b) Y = 0.07215 − 0.0002138 to 4 s.f.
(c) Z = 98.1 × 0.03 to 1 s.f.
(d) W = 9.568=4.61457 to 4 s.f.
(e) V = 3.862 × 0.62 to 2 s.f.
(f) U = 82.5=2.3186 to 3 s.f.
(g) K = 712368 − 612368 to 1 s.f.
(h) A = ð1.2673 × 107 Þ=ð3.95 × 10 −4 Þ
(i) F = ð14.5 × 12Þ − ð35.6=6.09Þ
(j) L = ðð8.325 × 103 Þ × ð3.1729 × 10 − 7 ÞÞ=ð3.9641 × ð7.2126 × 10 −5 ÞÞ to 4 s.f.
Chapter 2
Uncertainties and errors

2.1 Introduction

The physical quantity measurements are always accompanied by error since nothing
can ever be measured with certainty. This uncertainty is referred to as Error. Error is a
mathematical representation of the uncertainty. Error should not be confused with mis-
take. Mistake can be corrected (like mistake during calculation or solution preparation
or wrong reading of the value, etc.). Error analysis facilitates the identification, quantifi-
cation and elimination of error and makes the methods of experiment more refined and
robust. During approximation or rounding off, a large amount of error is introduced.
Hence, knowing the nature of error as well as the quantification of error helps to inter-
pret the method in a more robust manner. Moreover, if the errors are more than allowed
limits, then we would know whether to keep or get rid of the particular method or ob-
servations. This error analysis is more important when we talk about numerical methods
and computational calculations that require more accuracy and precision.
Errors are broadly classified into two categories as systematic errors (determi-
nate errors) and random errors (indeterminate errors). Systematic errors can be
identified and corrected while random errors cannot be eliminated.
Uncertainty refers to the doubt around the measurement. Even with well-calibrated
instruments (thermometer, rulers, clocks, etc.), when measurements are taken, there is
always a margin of doubt. Uncertainty is the range of possible values that any physical
quantity can take during measurement. When experimental results are reported, the
true value is not reported but a range of values are reported and then we should find if
the accepted value falls under the range of uncertainty values.
There are many factors that influence the measurements including tempera-
ture, pressure, humidity and calibration. When multiple measurements are made
for the same physical quantity, then a slightly different measurement value is ob-
tained each time. In fact, uncertainty adds reliability to the results in a particular
range. To quantify the doubt, one must know two terms, namely, the interval and
the confidence limit. The interval depicts the width of margin or doubt, while confi-
dence level indicates how sure the true value is within that interval or margin. The
best way to show the uncertainty is

Measurement = best estimate ± uncertainty

For instance, a copper wire is 3 m long with an uncertainty of 15 cm (0.15 m), which
can be represented as

length = 3.0 ± 0.15 m

https://doi.org/10.1515/9783110695328-002
18 Chapter 2 Uncertainties and errors

Here the length of copper wire is reported as 3 ± 0.15 m at the 95% confidence
level. It implies that there is 95% certainty that copper wire is between 2.85 and
3.15 m long. In fact when in laboratory, the students take the readings, they do not
calculate the percent error, but the percent uncertainty. The error is calculated
when the true value is known and it is almost next to impossible to know the actual
true value.
Uncertainty is important as one wants to improve the quality of measurements.
This is why while making calibration or performing a test, the uncertainty must be
mentioned as a measure of success or failure. To avoid uncertainty in measurements,
the measurement should be taken at least thrice. So, the error that would have gone
unnoticed in the first measurement may be noticed in the next two measurements.
To further corroborate the authenticity of measurements, statistical calculations
may be carried out on the measurements to account for the error and uncertainty in
the data. So, if a set of measurements is taken, then average of all the measure-
ments will give the estimate of true value. More number of readings will give better
average, which would be more close to the true value. When the repeated measure-
ments are different, there is a lot of uncertainty involved for that physical quantity,
(the spread is large) but there is a possibility that average of all the measurement
will give a best estimate of the true value. A large spread implies that there is a
huge difference between the set of readings for the same experiment. The standard
way to quantify spread is standard deviation. It tells how an observation deviates
from the average or mean value. Standard deviation is often greater than average
deviation and is mostly used by statisticians and scientists.
Consider weighing a piece of copper alloy, where the weighing was repeated
thrice and each time a different mass was obtained, for example, 1.213, 1.275 and
1.165 g, respectively. The average for the above measurements is 1.217:

1.213 + 1.275 + 1.165


Average = = 1.217 (2:1)
3

Average deviation is often calculated to display results as

j1.217 − 1.213j = 0.004 (2:2)

j1.217 − 1.275j = 0.058 (2:3)

j1.217 − 1.165j = 0.052 (2:4)

Average deviation is calculated to be 0.038:


0.004 + 0.058 + 0.052
Average deviation = = 0.038 (2:5)
3
2.1 Introduction 19

Hence,
0.038
Percent average deviation = × 100 = 3.12% (2:6)
1.217

Hence, 3.12% is the percent average deviation but often standard deviation is used
to depict uncertainties. As standard deviation is
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
Pn 2
i = 1 ðxi − xÞ
s= (2:7)
n−1
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
ð0.004Þ2 + ð0.058Þ2 + ð0.052Þ2
s= (2:8)
3−1

s = 0.055

Therefore, 5.5% is the percent standard deviation, which is a more standard and
common practice to denote deviations.

Systematic errors
Systematic errors are the errors that can be identified for their source and, hence, can be eliminated.
Systematic errors often lead to measured value, either very high or very low. They are also called
“zero error”, which may be positive or negative. Further, they can be classified into four types:
(1) Instrumental error: This type of error originates due to poor calibration, faulty part of instru-
ment or electricity fluctuation. A poorly calibrated instrument may show zero error due to envi-
ronmental factor which can be corrected by calibrating the instrument. For example, a poorly
calibrated thermometer when immersed in boiling water reads 103 °C. Different pipettes and
volumetric flasks hold different volumes. Hence, such type of error will only magnify the error
in further readings.
(2) Observational error or personal error: These types of errors arise due to personal drawback of
observation. These errors may include mishandling of experimental apparatus, improper and
careless weighing, vagueness in taking readings, poor judgement or prejudice or color ambi-
guity including parallax in reading a metre scale, reading upper or lower meniscus. It can be
corrected by proper training and experience.
(3) Theoretical error: For the sake of simplification, if one approximates a condition in the model
system, then such error arises. For example, if one assumes atmospheric pressure does not
change the readings of temperature, then it will definitely introduce the error in the readings.
(4) Methodic error: This kind of error originates when the system, either chemical or physical,
behaves erratically. For example, the occurrence of side reaction (e.g. co-precipitation), vola-
tility, insolubility of precipitates, decomposition of species, unexpected rate of reaction (slow
or fast), instability of reaction species and so on. It is the most serious of all errors. It can be
corrected by developing proper methods.

All the above systematic errors once identified can be eliminated and the results will improve.

Random errors
Random errors are also called as indeterminate errors They may occur due to sudden change in
experimental conditions like change in temperature, humidity, current and so on.The sources of
20 Chapter 2 Uncertainties and errors

such errors are unidentified and, hence, they are difficult or impossible to eliminate. They may also
occur due to the inability of analyst to reproduce the same readings. Random errors follow
Gaussian distribution. For example, if we have measured the weight of a ball four times using the
same measuring scale and it turns out to be 20.23, 20.25, 20.27 and 20.26 g. So, to avoid this error,
more number of readings could be taken and then an average of all observation is calculated.

2.2 Absolute and relative uncertainty

Uncertainty can be classified as absolute and relative uncertainty similar to absolute


and relative error. Absolute uncertainty reflects the margin of uncertainty in a mea-
surement while relative uncertainty is the ratio of absolute uncertainty and the size of
its associated measurement. Relative uncertainty alike relative error is dimensionless.

Relative uncertainty = absolute uncertainty=magnitude of measurement


Percent relative uncertainty = 100 × relative uncertainty

Here, it should be pointed out that accuracy is not the same as certainty. While ac-
curacy is qualitative, uncertainty is quantitative. The plus–minus sign is used when
discussing errors and uncertainties.

Accuracy and precision


Accuracy reveals how closely observed value is to the true value, while precision reveals how closely
different observation values agree with each other. Precision is also known as reproducibility. One
may be precise and inaccurate and vice versa. In sciences, accuracy and precision are integral to
measurements and calculations. While measuring, there is always an error associated with each
value, precision measures the extent or spread of error from the real value. It is independent of true
actual value. Precision is expressed in digits (for measurement) but can also be expressed in terms
of deviation of the errors. A three digit measurement is more precise than two digit measurement.
For example, suppose there are six readings of marks obtained by students in a test as 8.1, 8.2,
8.5, 8.2, 8.2 and 8.5, if they are wrongly uploaded on the web as 3.1, 3.2, 3.5, 3.2, 3.2 and 3.5.
Then, the marks that have been recorded would still be precise but not accurate. Accuracy is
reduced drastically here since the actual marks and uploaded marks have great differences.

Likewise, error should not be confused with uncertainty. While error is the difference
between the true value and measured value, uncertainty is the quantification of
doubt around the measurement. Any error due to known sources could be corrected
but when the source, is unknown, such errors are said to be uncertainty. One may
never make a perfect measurement which gives a true value of a physical quantity;
hence, measurements are often estimates of true value. Therefore, what scientists are
interested in experiments is uncertainty.
2.3 Propagation of uncertainty 21

2.3 Propagation of uncertainty

Systematic errors can be corrected if one knows the source while random errors can-
not be corrected. Since calculations involve numbers (of physical quantity) that have
certain degree of uncertainty (random error) associated with them, the uncertainties
can also be combined if they have the same units. For example, while measuring
mass, the uncertainty should also be mentioned in units of mass. This procedure of
calculating one quantity using multiple quantities is also called data reduction. These
calculations involve basic arithmetic operations like addition, subtraction, division
and multiplication. This uncertainty may then be carried forward to the final result of
the calculations and hence is called propagation of uncertainty. These are also called
combining uncertainties.
The propagation of uncertainties involving arithmetic operations follow these
simple rules.

(1) Addition and subtraction


While performing addition and subtraction, if e1, e2 and e3 are the uncertainties as-
sociated with three measurements as x ± e1, y ± e2 and z ± e3, then the resultant abso-
lute uncertainty e is given as
qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
e= e21 + e22 + e23 (2:9)

Example 1: The three values of a, b and c are given as 2.16 ± 0.02, 1.46 ± 0.15 and 4.67 ± 0.04, re-
spectively. Evaluate variable d which is given as

d=a − b+c (2:10)


Solution: d = 2.16 − 1.46 + 4.37 ± e = 5.07 ± e
5.07 is the arithmetic answer and e is the uncertainty associated with the result, which can be de-
duced using eq. (2.9):
qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
e= ð0.02Þ2 + ð0.15Þ2 + ð0.04Þ2 (2:11)

e = 0.15
This is known as absolute uncertainty. Hence, the final result would be d = 5.07 ± 0.15.
Likewise, percent uncertainty can be calculated as

0.15
Percent uncertainty = × 100 (2:12)
5.07
Percent uncertainty = 3.0%

Hence, the result in terms of percent uncertainty is 5.07(±3.0%).


**Apart from the significant figure, an extra insignificant figure (as subscript) is kept in the un-
certainty to avoid the round-off error later in the calculations.
22 Chapter 2 Uncertainties and errors

Example 2: The initial and final readings of a burette during a titration are 16.85(±0.03) mL and
0.03(±0.03) mL, respectively. What is the uncertainty in the volume delivered?
Solution: As volume delivered is the difference between final reading and initial reading, the vol-
ume transferred is

16.85ð ± 0.03Þ − 0.03ð ± 0.03Þ = 16.82ð ± eÞ (2:13)


where
qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
e= ð0.03Þ2 + ð0.03Þ2 (2:14)

e = 0.042
Here, although the uncertainty associated with each reading is 0.03, the resultant uncertainty in
delivering the volume is 0.04.

How many digits should be kept?


(a) Uncertainties are mostly quoted to one significant digit. For example, 0.02 rather than 0.023.
Only if the uncertainty starts with 1, then in such cases uncertainty is quoted to two significant
digits. For example,

. ± . wrong . ± . correct


. ± . wrong . ± . correct
. ± . wrong . ±  correct

(b) Also, the experimental measurements are round off to the same decimal place as the uncer-
tainty. For example

. ± . wrong . ± . correct

(c) The measurement uncertainties should overlap. Only if the difference is not very large, the
measurements are considered real; else, they are considered to be sloppy observations.
For example, the measurements 0.56 ± 0.02 and 0.68 ± 0.02 do not agree since their spread
does not overlap at all (maximum values and minimum values for two measurements are (0.58 &
0.54) and (0.70 & 0.66), respectively), while the measurements 0.56 ± 0.06 and 0.68 ± 0.07 do
overlap. Here the second set measurement is real and acceptable.
(d) The result should have same number of significant figures as that of the quantity which is less
precise. For instance, area of circle is given by A = πr2, where π has many number of significant
figures since its value is known up to 3.1415927. . ., while r is 2.5 cm; hence, the result would de-
pend on less precise quantity, which is r having only 3 s.f.

(2) Multiplication and division


While performing arithmetic operations like multiplication and division, the abso-
lute uncertainties should first be converted into percent uncertainty and then un-
certainty is defined in terms of percent uncertainty as
qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
e = ð%e1 Þ2 + ð%e2 Þ2 (2:15)
2.3 Propagation of uncertainty 23

Example 3: Evaluate

3.36 ± 0.04
d= (2:16)
1.07 ± 0.02
Solution: The above operation may be written in terms of percent uncertainty as

3.36 ± 1.2%
d= (2:17)
1.07 ± 1.8%
d = ð3.36=1.07Þ ± e (2:18)
d = 3.14 ± e (2:19)
where
qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
e= ð%e1 Þ2 + ð%e2 Þ2 (2:20)

or
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
   ffi
Δe Δe1 2 Δe2 2
= + (2:21)
e e1 e2
qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
e = ð1.2Þ2 + ð1.8Þ2 (2:22)

e = 2.1%
Hence,
d = 3.14 ± 2.1% (in percent uncertainty)
To convert back into absolute uncertainty, multiply percent uncertainty with the result as 3.14 ×
2.1% = 0.065 ≈ 0.07
d = 3.14 ± 0.07 (in absolute uncertainty)

(3) Mixed operations


When given a combination of arithmetic operations like addition and multiplication
then in such cases, first the addition and subtraction operations are performed if
any and then multiplication and division.

Example 3: Calculate d, where a = 3.76 ± 0.02, b = 1.42 ± 0.01 and c = 2.03 ± 0.04

a−b
d= (2:23)
c
Solution: Accordingly, d should be

ð3.76 ± 0.02Þ − ð1.42 ± 0.01Þ


d= (2:24)
2.03 ± 0.04
First, the numerator is evaluated, which turned out to be

ð3.76 − 1.42Þ ± e = 2.34 ± e


24 Chapter 2 Uncertainties and errors

where
qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
e= ð0.02Þ2 + ð0.01Þ2 (2:25)

Hence, numerator becomes 2.34 ± 0.02 (in absolute uncertainty)

2.34 ± 0.9% (in percent uncertainty)

So, now

2.34 ± 0.02
d= (2:26)
2.03 ± 0.04
2.34 ± 0.9%
d= (2:27)
2.03 ± 2.0%
d = 1.15 ± e
where
qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
e= ð0.9Þ2 + ð2.0Þ2 (2:28)

d = 1.15 ± 2.19%
d = 1.15 ± 0.025
Since the uncertainty is from 0.01 decimal places, the result should also be rounded off to 0.01
decimal place.

(4) Products of powers


If the variables involve exponents like the function as follows:

z = xm yn (2:29)

In simple average terms, the uncertainty in z is given as


Δz Δx Δy
= j mj + jnj +  (2:30)
z x y

If one uses the quadrature (root of sum of squares), then one may write as
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
   
Δz mΔx 2 nΔy 2
= + +  (2:31)
z x y

Example 4: Evaluate d, when a = 2.61 ± 0.2, b = 3.7 ± 0.36 and c = 1.8 ± 0.65, if

ab3
d = pffiffiffi (2:32)
c
Solution: The arithmetic operation result would give

d = 98.539 ± e
2.3 Propagation of uncertainty 25

where e would be
     
e 0.2 0.36 0.65
= + 3 + 0.5 (2:33)
98.539 2.61 3.7 1.8
which on solving gives

e = 54.105
Hence, d = 98 ± 54.
Since the uncertainty is very large, only two significant figures are kept and the terms after decimal
point are ignored.
If the uncertainty in X2 is to be considered, then it may be argued as X × X and rule of multiplica-
tion should be used but instead rule for powers of exponents is used. Since for multiplication rule,
the variable should be independent of each other while measurements like X and Y, but in case of
X2, both are same.

(5) Multiplication by a constant


If there is any uncertainty in any measurable quantity and the quantity needs to be
multiplied by a constant, then the uncertainty is also multiplied by the same constant.

Example 5: Calculate uncertainty associated with the perimeter of the square if the uncertainty in
the side of square is 4.0 ± 0.3 cm.
Solution: As perimeter = 4 × side, and considering the above-mentioned rule, the perimeter should
be 16 ± 1.2 cm.

Example 6: Find z where a = 3.0 ± 0.2, b = 1.3 ± 0.5, c = 5.2 ± 0.02

z = ab + c3 (2:34)
3
Solution: In this case, first the quantity ab is calculated with the errors, then c . These two quanti-
ties are then added separately with their errors.
ab is calculated first as

ab = 3.9 ± 1.5

c3 = 140.6 ± 0.93
Hence, z = 144.5 ± 1.8

(6) Exponential and logarithms


For the function y = xa, the percent uncertainty is given as

%ey = a%ex (2:35)


26 Chapter 2 Uncertainties and errors

Similarly for the function y = log x, uncertainty in y is given as


1 ex ex
ey =≈ 0.4342 (2:36)
ln 10 x x
Likewise, the other functions and the uncertainties associated with them are tabu-
lated (Table 2.1).

Table 2.1: Functions and the uncertainty associated with them.

Function Uncertainty
ex
y = ln x ey = (.)
x
ey
y = x = ln 10ex ≈ 2.3026ex (.)
y
ey
y = ex = ex (.)
y

pffiffiffi
Example 7: In the function y = 3 x , what is the uncertainty in y if the uncertainty in x is 3%.
Solution: Using eq. (2.35), the uncertainty in y would be

1
%ey = ð3%Þ = 1%
3

Example 8: Using the pH value of 4.18 ± 0.03, calculate the uncertainty in [H+]
if

pH = − log½H+ (2:40)
Solution: One may write eq. (2.40) as

10− pH = ½H+ (2:41)


Here, y = [H ], while x = –pH
+

y = 10− 4.18 = 6.60 × 10− 5


ey
= ln 10ex ≈ 2.3026ex (2:38)
y
ey
= 2.3026ð0.03Þ
6.60 × 10− 5
ey = 0.45 × 10− 5
Hence uncertainty in [H ] = 6.60(0.45) x 10–5 M
+
2.3 Propagation of uncertainty 27

Summation of quadrature
Combining uncertainties using standard deviation, one can express function f which is a function
of x, y, z, . . . as f (x, y, z, . . .), then the uncertainity in f can be written by taking partial derivative of f
with respect to each variable. Then the total differential is
     
∂f ∂f ∂f
df ðx, y, z, . . .Þ = dx + dy + dz + . . ..
∂x ∂y ∂z
We may write dx, dy, dz as the error in x, y, z,. . ., that is, Δx, Δy, Δz,. . .

df df df
Δf ðx, y, z, . . .Þ = Δx + Δy + Δz + . . .
dx dy dz
If we restrict ourselves to x and y only, then we can write
 2  2
df df df df
Δf 2 = Δx 2 + Δy 2 + 2ΔxΔy
dx dy dx dy
Since ΔxΔy are very small, we can write
 2  2
df df
Δf 2 = Δx 2 + Δy 2
dx dy
If the standard deviations are small changes in x and y, then one may write the above equation as
(standard deviation approach):
  2
df 2 2 df
σ2f = σx + σ2y
dx dy
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
 2  2 ffi
df df
σf = σx +
2 σ 2y
dx dy
Hence, to sum up, in terms of standard deviation, the uncertainties are defined as
(1) When performing addition and subtraction, the resultant uncertainty σr can be written as
qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
σr = σ 2x + σ 2y + σ2z

where σx, σy and σz are the standard deviations associated with the variables.
(2) Similarly, when multiplication and division is involved, one may write the uncertainty as
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
σr
σ 2 σ 2
σ 2
x y z
= + +
r x y z
(3) Exponents r = xy as
σr
σ
x
=y
r x
(4) Logarithmic function r = log(x) as

σ
x
σ r = 0.434
x
(5) Antilog r = antilog(x) as
σr
= 2.303σ x
r
28 Chapter 2 Uncertainties and errors

2.4 Rounding off uncertainties

Different calculators and spreadsheets may give answers to the calculation up to many
decimal places. Sometimes the calculations are made simpler by rounding off the num-
ber up to some decimal places. If the uncertainty is in the first decimal place, then the
measurement should also be reported in the first decimal place. For example,

3.0 m ± 0.15m correct 3.02 m ± 0.15m wrong

It is always advisable to make the calculations to at least one more significant fig-
ure than we require. Rounding off should be carried out at the end of the calcula-
tions to avoid rounding errors. If the rounding off is carried out at each step, then
the rounding errors would magnify at the end in the calculations.
As mentioned earlier, there is a whole range of values for a physical quantity
with measurement due to uncertainty. Mostly, the measurement values are distrib-
uted around the average value in the well-known bell-shaped curve also called nor-
mal (Gaussian) distribution in which there is a probability that the measured value
lies close to average (mean) than at the extremes of the curve. This can be proved
by the standard deviation concept in statistics.

Example 9: Round off 6.2349 ± 0.152.


Solution: Since the uncertainty begins with 1, the number of s.f. would be 2. Also, the quantity and
uncertainty should have the same number of decimal places, hence, the answer should be 6.23 ± 0.15.

Example 10: Round off the quantity t = 5.42 × 106 s, where its uncertainty Δt = 3 × 104 s.
Solution: Since the quantity as well as its uncertainty is given in scientific notation, it may be writ-
ten as (5.42 ± 0.03) × 106.
The representation should have the quantity and uncertainty in the same power of 10.

2.5 Classification of errors

Although uncertainty is more standard way in sciences, yet sometimes scientists


talk about errors also, so when quantifying errors, they are classified as
(1) Absolute error and (2) Relative error
(1) Absolute error
The absolute error (Eabs) refers to the difference between the actual value x and ob-
served value a, then
Eabs = x − a
2.6 Problems for practice 29

(2) Relative error


Relative error (Erel) is defined as the ratio between absolute error and absolute
value of the observation. It is a dimensionless quantity:

x−a
Erel =
a

They are usually expressed as either percent (×100%), fractions, parts per thou-
sand (×103) or parts per million (×106).

Example 11: Demonstrate the absolute and relative errors in the approximation of numerical con-
stant e(e = 2.71828).
Solution: Eabs = j2.71 − ej = 0.00828

j2.71 − ej
Erel = = 0.003
jej
Note: When the absolute errors are indeterminate error, they are followed by “ ±,” if they are with
the determinate, then the original sign follows.

2.6 Problems for practice

(1) Express the quantities in the standard form of uncertainty as x + Δx.


(a) X = 23.0567, ΔX = 0.03279
(b) m = 0.01362kg, Δm = 2.418 × 10 − 3 kg
(c) a = 11.27 × 1032 , Δa = 3.6142 × 1030
(d) Y = 9.11 × 10 − 33 , ΔY = 3.2145 × 10 − 33

(2) Which of the following are more accurate and why?


(a) π, 3.1392842 or 3.1417
(b) 2.7182820135423 or 2.718281828 (as an approximation of e).
Chapter 3
Some mathematical functions

3.1 Introduction

A mathematical function is a relationship or an expression between a set of varia-


bles (dependent and independent). They are integral in establishing relationships
in sciences. A mathematical function may be as simple as a linear function or may
be as complex as a polynomial. It may be considered as a device that converts one
value to another. A function is often called an argument; especially in physical
chemistry, the mathematical functions are used to model physical parameters and
draw inferences from the model. A function is often written in the form

y = f ð xÞ (3:1)

which implies that y (dependent variable) is a function of x (independent variable).

3.2 Classification of functions

Although there are many classes of classification, here, only the elementary classifi-
cation of functions is mentioned.

3.2.1 Linear function

The linear function is the simplest function of all the mathematical functions. It is
represented as

y = mx + c (3:2)

When this function is plotted then a straight line is obtained, where c is the inter-
cept and m is the slope of the line (Figure 3.1). If intercept is zero (no intercept),
then the line passes through the origin (y = mx) and if the slope is zero then the line
is horizontal, that is, y = c.
Slope could be positive or negative. Figure 3.1(a) and (b) represents negative
and positive slopes, respectively. Since the function is linearly changing with x,
they are also called first-degree polynomial. Slope of any straight line can be found
out by taking two random points on the line. For example, if two points (x1,y1) and
(x2,y2) are considered which if written in the mathematical form are

y1 = mx1 + c (3:3)

https://doi.org/10.1515/9783110695328-003
32 Chapter 3 Some mathematical functions

(a) 7 y = –2x + 6 (b) 14


6 12
y = 2x + 5
5 10
4 8
3 6
2 4
1 2
0 0
0 1 2 3 4 0 1 2 3 4 5

Figure 3.1: Equation of line showing negative slope (a) and positive slope (b).

y2 = mx2 + c (3:4)

then

Δy = y2 − y1 = mðx2 − x1 Þ (3:5)
y2 − y1
m= (3:6)
x2 − x1

where m is the slope of the line joining (x1, y1) and (x2, y2).

3.2.2 Exponential

Mostly the term exponential is used to indicate the fast pace of increasing or decreas-
ing. In the exponential function, the independent variable is given as exponent to
some other constant or base (b in this case). It can be represented as

y = bx (3:7)

y = ex (3:8)

If x = 0, y = 1; y = ∞ if x ! ∞ and y = 0 if x ! − ∞
where x is an independent variable (can range from entire range of real num-
bers) and y is a dependent variable (on x). Figure 3.2 shows the exponential graph
for y = ex (a) and y = e−x (b).
3.2 Classification of functions 33

7 7
y = f(x)
f(x) = e–x

y=f(x)
(a) f(x) = e x (b)
6 6
5 5
4 4
3 3
2 2
1 1
0 0
0 100 200 300 400 x 500 0 0.2 0.4 0.6 0.8 1 1.2 x

Figure 3.2: Exponential (a) f(x) = ex and (b) f(x) = e−x.

If b = 2, then the function is f(x) = y = 2x (Figure 3.3(a)) and if b = 0.5, then the
function f(x) = y = 0.5x (Figure 3.3(b)).

140 1.2
(a) f(x) = 2x (b) f(x) = 0.5x
120 1
100
0.8
80
0.6
60
0.4
40

20 0.2

0 0
0 2 4 6 8 0 2 4 6 8

Figure 3.3: Exponential (a) f(x) = 2x and (b) f(x) = 0.5x.

Consider the example of 10x, which is used to represent decimal number where x is
an integer. By using calculus, it can be found that the natural choice for base b in
sciences turns out to be an irrational number as e = 2.718281828459045. Hence, it
can be written as f(x) = y = ex or more generally as y = ekx. It is also known as Euler’s
number (e), which is defined as the infinite series as
1 1 1 1
e=1+ + + + +  (3:9)
1! 2! 3! 4!
e = 2.718281828459045 (3:10)
34 Chapter 3 Some mathematical functions

Some of the examples of equation involving exponential mathematical function in-


clude Boltzmann’s equation for population (3.11), Arrhenius’s equation (3.12) and ex-
ponential radioactive decay (3.13) to name a few:

N = N0 expð − ΔE=RT Þ (3:11)

k = Aexpð − Ea =RT Þ (3:12)

λ = λ0 expð − kT Þ (3:13)

3.2.3 Logarithmic function

The logarithm is the inverse of exponential. It tells how many times a number
should be multiplied to itself to get a particular answer. The base of the log is the
main basis of classification. One may write the base as either 10 or e.

(a) Logarithms to the base 10


If the base of log is 10 then they are called common logarithms (Figure 3.4). For
example, 10y = x, then y is called common log of x denoted by log10(x). The subscript
10 is often not written to simplify. For example, in chemistry, pH of the equation is

pH = − log10 ½H +  (3:14)

which can be simply written as

pH = − log½H +  (3:15)

When no base is mentioned, then it is usually understood that base (a) = 10.

1
f(x) = log10x
y = f(x)

0
0 x 0.5 1 1.5 2

–1

f(x) = ln x
–2

–3

Figure 3.4: f(x) = ln x (dotted line) and f(x) = log10x (solid line).

(b) Logarithms to the base e


If the base of the logarithm is e then it is known as natural logarithms:

lnðxÞ = loge ðxÞ (3:16)


3.2 Classification of functions 35

Natural log is the inverse for exponential

y = ex (3:17)

Then

x = lnðyÞ (3:18)

lnðe Þ = x
x
(3:19)

or,

elnðxÞ = x (3:20)

For example, log216 implies 2 (base value) should be multiplied itself 4 times to get
answer 16. The more general form is

loga ðxÞ = y or x = ay (3:21)

where a is the base of the logarithm. The logarithm is the inverse of exponential, so
they both can be cancelled if the base is same.

Example 1: Simplify
 
f ð x Þ = log10 102x + 5 (3:22)
Solution: Since both exponents and logarithm have the same base 10, they cancel out each other:

f ð x Þ = 2x + 5 (3:23)

Example 2: Simplify

f ð x Þ = log3 ð3x .9x 100 Þ (3:24)


Solution: The above expression can be simplified as

f ðxÞ = log3 ð3x Þ + log3 9 + log3 ðx 100 Þ (3:25)


f ðxÞ = x + 2 + 100log3 x (3:26)

Example 3: Solve

2 Þ + 6x
f ð x Þ = aloga ð2x (3:27)
Solution: The above function can be written as

2
f ð x Þ = aloga ð2x Þ · a6x (3:28)
2 6x
f ð x Þ = 2x · a (3:29)
*If the base and exponent are different, then they both will not cancel each other.
36 Chapter 3 Some mathematical functions

3.2.4 Polynomials

The polynomials can be represented as

f ðxÞ = a0 + a1 x + a2 x2 +    + an xn (3:30)

Or in general,
X
n
f ðxÞ = ai x i (3:31)
i=0

where ai is constant and n is a positive integer. If n = 1, then it is called a linear


function (straight line):

f ðxÞ = a0 + a1 x (3:32)

which is of the same form as

y = mx + c (3:33)

If n = 2, then it is called a quadratic function as


f ðxÞ = a0 + a1 x + a2 x2 (3:34)

which can be conveniently written as


f ðxÞ = ax2 + bx + c (3:35)

f ðxÞ = x2 + 5x + 6 (3:36)
pffiffiffiffi  
This quadratic equation can be solved for the value of x as x = − b ± D 2a ,
where D = b2−4ac. If n = 3 and n = 4, then it is called cubic function and quartic
function, respectively.
A cubic equation may be represented graphically (Figure 3.5) and mathemati-
cally as

300
f (x) = x3 – 5x2 + 2x + 8
200
y = f (x)

100

0
–6 –4 –2 0 2 4 6 8 x 10
–100

–200

–300

Figure 3.5: f(x) = x3−5x2 + 2x + 8.


3.2 Classification of functions 37

f ðxÞ = x3 − 5x2 + 2x + 8 = ðx − 2Þðx + 1Þðx − 4Þ (3:37)

3.2.5 Power function

A power function may be represented as y = xn, where n is a constant. The linear, qua-
dratic, cubic and quartic functions are examples of power functions. Reciprocal func-
tions and root functions are sometimes considered as separate class, but they can also
pffiffiffi
be clubbed under the category of power function as y = x1, since y = x − 1 ,y = x since
p ffiffi

y = x1=2 , y = 3 x and so on. They are represented in the graphical form (Figure 3.6).

30 1.5
(a) (b)

y = f(x)
y = f(x)

25 1

20 0.5

15 0
–6 -4 –2 0 2 4 6
10 –0.5

5 –1

0 –1.5
–6 –4 –2 0 2 4 x6 x

2.5 2
y = f(x)

(c) (d)
y = f(x)

1.5
2
1

1.5 0.5
0
1 –6 –4 –2 0 2 4 6
–0.5
–1
0.5
–1.5
0 –2
0 1 2 3 4 5 x6 x

pffiffiffi pffiffiffi
Figure 3.6: Graphical representation of (a) y = x2; (b) y = 1/x; (c)y = x ; and (d) y = 3 x .

3.2.6 Circle

A circle in a general form can be represented as

ðx − hÞ2 + ðy − kÞ2 = r2 (3:38)

where (h, k) is the centre and r is the radius of the circle (Figure 3.7).
If the centre is the origin (0,0), then the equation becomes

x2 + y2 = r 2 (3:39)
38 Chapter 3 Some mathematical functions

x, y

r
h, k x

Figure 3.7: Equation of circle f(x) =x 2 + y 2 = r 2 .

3.2.7 Rational number

A rational number is a number obtained by dividing an integer with another integer


(non-zero). If there are two functions A(x) and B(x) as

AðxÞ = a0 + a1 x + a2 x2 +    + an xn (3:40)

BðxÞ = b0 + b1 x + b2 x2 +    + bm xm (3:41)

such that f(x) is


AðxÞ a0 + a1 x + a2 x2 +    + an xn
y = f ðxÞ = = (3:42)
BðxÞ b0 + b1 x + b2 x2 +    + bm xm

For example,
2x − 3 x2 + 3x − 10 1 x−2
, , , 2 (3:43)–(3:46)
x−5 x+1 x x + 2x − 3

Let us take f(x) = y =x1, as can be seen from the graph (Figure 3.8) when x ! 0, then
y ! ∞.
Similarly, when x ! 0 from the minus side, y ! ∞. This point of x = 0 is called
point of singularity, where curve approaches the y-axis. The y-axis, that is, x = 0 is
called the asymptote to the curve or one may say that the curve approaches the line
x = 0 asymptotically. All rational functions have at least one point of singularity. It
can also be said that as x ! ∞ from either side, the curve approaches y-axis but
does not cross it. So here y = 0 is an asymptote to the curve.
Also, if the degree of polynomial in the numerator is greater than in the denom-
inator, it is called an improper rational function and if it is smaller than in the de-
nominator, it is called proper rational function.
3.2 Classification of functions 39

1.5
f(x) = 1/x

0.5

0 x
–10 –8 –6 4 –2 0 2 4 6 8 10

y = f(x)
–0.5

–1

–1.5

Figure 3.8: Rational number y = 1/x.

3.2.8 Partial fractions

Sometimes quotients and quadratic equations in denominator can be represented


in more than one form as a collection of several partial fractions. This method of
expressing the quotient as partial fractions has application during integration and
solving differential equations. A rational function of the form A(x)/B(x) can be fac-
torized into simple partial fractions as

x+5 A B
= + (3:47)
ðx − 2Þðx + 3Þ x − 2 x + 3
x+5 Aðx + 3Þ + Bðx − 2Þ
= (3:48)
ðx − 2Þðx + 3Þ ðx − 2Þðx + 3Þ

x + 5 = Aðx + 3Þ + Bðx − 2Þ (3:49)

At x = –3, B = –2/5 while at x = 2, A = 7/5.

3.2.9 Trigonometric functions

There are three principal trigonometric functions namely sine (sin), cosine (cos)
and tangent (tan). The other trigonometric functions are secant (sec), cosecant
(cosec) and cotangent (cot) are derived functions, where
40 Chapter 3 Some mathematical functions

1 1 1
cosecθ = , sec θ = and cot θ = (3:50–3:52)
sin θ cos θ tan θ

They may be depicted graphically as in Figure 3.9.

sin x
1

1

0 x
–2π 3π –π π π π 3π 2π
–— – ̅ —
2 2 2̅ 2
1
– ̅
2

–1
cos x
1

1

0 x
–2π 3π –π π π π 3π 2π
–— – ̅ —
2 2 2̅ 2
1
– ̅
2

–1
tan x
4

0 x
–2π 3π –π π π π 3π 2π
–— – ̅ —
2 2 2̅ 2
–2

–4

Figure 3.9: Some trigonometric functions (sin, cos and tan functions).

Some important trigonometric identities that are frequently used are

sin2 θ + cos2 θ = 1 (3:53)

cosec2 θ = 1 + cot2 θ (3:54)


3.2 Classification of functions 41

sec2 θ = 1 + tan2 θ (3:55)


a+b a−b
sin a + sin b = 2 sin cos (3:56)
2 2
a+b a−b
sin a − sin b = 2 cos sin (3:57)
2 2
a+b a−b
cos a + cos b = 2 cos cos (3:58)
2 2
a+b a−b
cos a − cos b = − 2 sin sin (3:59)
2 2

Both degree and radian are often used as a unit of angle. Radian is the SI unit of
angle (SI symbol rad). In terms of circle, one radian is the angle (θ) subtended by an
arc (of length s), which is equal in length to the radius (r) of the circle (Figure 3.10).
More precisely, it is equal to the ratio of arc length to the radius of the circle,
that is,

s = rΘ

Θ
r

Figure 3.10: Arc of length subtending angle.

s
θ= (3:60)
r

Since the arc is proportional to the angle, the whole arc of circumference 2πr will
subtend angle of 360°. So 360° is equal to 2π radians. Hence,

360o
1rad = (3:61)

180
1rad = degrees (3:62)


For example, angle 270° is radians.
2
42 Chapter 3 Some mathematical functions

3.2.9.1 Inverse trigonometric functions


Inverse trigonometric functions are literally the inverse of trigonometric functions,
that is, sin−1x, cos−1x, tan−1x, csc−1x, sec−1x and tan−1x. Also called anti-trigonometric
functions, these functions are used to find the angle for the given trigonometric ratio.
The prefix “arc” is used to represent the inverse of the function, for example,

sin − 1 x = arcsinðxÞ (3:63)

sin − 1 ð1=2Þ = π=6 (3:64)

3.2.9.2 Hyperbolic trigonometric functions


Hyperbolic trigonometric functions are analogous to trigonometric functions that
are defined in terms of exponential function. There are six hyperbolic functions,
namely, sinh x, cosh x, tanh x, sech x, cosech x and coth x. As the trigonometric
functions parametrize a circle, hyperbolic trigonometric functions parametrize hy-
perbola. They have similar identities as trigonometric functions. The hyperbolic
sine and cosine functions are written as

ex − e − x
sinh = (3:65)
2
ex + e − x
cosh = (3:66)
2

3.2.10 Taylor’s series

A Taylor’s series is a representation of a function (f(x)) around a point (a) in terms


of its derivatives that can be written as a sum of infinite terms as
X

ðx − aÞn 1 1
f ðxÞ = f n ðaÞ = f ðaÞ + f ′ðaÞðx − aÞ + f ′′ðaÞðx − aÞ2 + f ′′′ðaÞðx − aÞ3 +   
n=0
n! 2! 3!
(3:67)

where f'(x) and f'(x) are the first and second derivatives of f(a) with respect to x and
h = x–a. To represent the function f(x) in terms of a polynomial, it should be defined
in regions near x = a and when the function f(x) is differentiable as many times, it
gives a good approximation of the function in the region near x = a.
According to Taylor’s theorem, if function fulfils some predefined conditions
then it may be expressed as Taylor’s series. If a = 0, then the Taylor’s expansion be-
comes the Maclaurin series.
3.2 Classification of functions 43

3.2.10.1 Maclaurin series


The Maclaurin series is a special case of Taylor’s series where the function is cen-
tred at zero (a = 0):
1 ′′ 1
f ðxÞ = f ð0Þ + xf ′ð0Þ + x2 f ð0Þ + x3 f ′′′ðaÞ +    (3:68)
2! 3!
x3 x5 x7 X∞
ð − 1Þn 2n + 1
sin x = x − + − +  = x (3:69)
3! 5! 7! n=0
ð2n + 1Þ!

x2 x4 x6 X∞
ð − 1Þn 2n
cos x = 1 − + − +  = x (3:70)
2! 4! 6! n=0
ð2nÞ!

x2 x3 x4 X∞ n
x
ex = 1 + x + + + +  = (3:71)
2! 3! 4! n=0
n!

Algebric functions and transcendental functions


Algebric functions are the functions upon which simple operations of addition, subtraction, divi-
sion and multiplication are applicable, while the transcendental functions are functions other than
algebric functions (transcends means beyond algebra). They cannot be expressed as a solution of
a polynomial equation. Transcendental functions involve trignometric functions, inverse functions,
hyperbolic functions, logarithmic and exponential functions. These functions can be expressed in
algebric terms only in terms of infinite series. For example, ex or πx are transcendental functions
that can be expressed in terms of infinite series.

3.2.11 Coordinate systems

Coordinate system uses real numbers to describe the position of points or other geo-
metric elements in the space (two dimensional or three dimensional).

(a) Cartesian coordinate system


In Cartesian coordinate system, each point is specified uniquely in a plane by a set
of numerical coordinates from the two fixed perpendicular lines. If there are three
mutually perpendicular lines in three dimensions, then n number of coordinates
can be specified in such n-dimensional space called Euclidean space. The point at
which these lines intersect is known as origin (Figure 3.11).
44 Chapter 3 Some mathematical functions

x
x, y

Figure 3.11: Cartesian coordinates.

(b) Polar coordinate system


Polar coordinate system refers to a two-dimensional coordinate system, where a
point is specified by the radial distance and angle of the point from reference point
and direction, respectively (Figure 3.12):

x = r cos θ (3:72)

y = r sin θ (3:73)

x
r, θ

r y
θ

Figure 3.12: Polar coordinates.

(c) Spherical coordinate system


Spherical coordinate system is the coordinate system for three-dimensional space
where a point is specified via three numbers, namely, radial distance of a point
from the origin, polar angle measured from a zenith direction and azimuthal angle
of its orthogonal projection on a reference plane (Figure 3.13):

z = r cos θ (3:74)

x = r sin θ cos φ (3:75)

y = r sin θ sin φ (3:76)


3.2 Classification of functions 45

(r, θ, φ)

y
φ

x Figure 3.13: Polar coordinates.

3.2.12 Number system

There are many ways to represent a number like whole numbers and real numbers.
In context of computers, there is a different sort of classification of numbers which is
(a) Decimal
(b) Binary
(c) Octal
(d) Hexadecimal

They can be interconverted conveniently without any loss to the numeric value.

(a) Decimal number system


Decimal number system uses digits 0 to 9 to represent numbers. Since it uses 10
numbers (0–9), it is called the base 10 number system. Each digit has a value based
on its position called place value. For example,

895 = 8 × 102 + 9 × 101 + 5 × 100


= 800 + 90 + 5
= 895

(b) Binary number system


Binary number system is a system of writing numbers in terms of two symbols 0
and 1 (binary means two) and they have a base of 2. This number system is used by
electronic, digital and computer devices as a medium of language. All the informa-
tion or numbers are first converted into binary form and then input into computer’s
memory. This number system uses positional notation. For example, binary number
(1000101)2 is converted into decimal number.
In Table 3.1, the bits (binary numbers) have a positional value and has some
weight associated with it which is the power of 2.
46 Chapter 3 Some mathematical functions

Table 3.1: Position and bits for conversion of binary to decimal number.

       Position

       Bit

The binary number is converted as

=1 × 26 + 0 × 25 + 0 × 24 + 0 × 23 + 1 × 22 + 0 × 21 + 1 × 20
= 64 + 4 + 1
=ð69Þ10 .

Likewise a decimal number can also be converted into a binary number system by
dividing it by 2 until the quotient is 0. The remainder is noted each time and taken
in reverse order.

2 69

2 34 1

2 17 0

2 8 1

2 4 0

2 2 0

2 1 0

0 1

69 = (1000101)2

Similarly, a decimal fraction is converted into binary fraction by successively multi-


plying it by 2 until the fraction becomes 0.

0.875 × 2

1 .750 × 2

1 .500 × 2

1 .000

(c) Octal number system


Octal number system is used to represent digital circuit numbers and is more com-
pact when compared to binary number system. In the octal system, the base is 8. To
convert a decimal number into octal number, it is divided by 8 until the remainder
is 0 as in binary system.
3.2 Classification of functions 47

8 2065

8 258 1

8 32 2

4 0

(4021)8 is equivalent to (2065)10.


Likewise, it can be traced back to decimal system as

= 4 × 83 + 0 × 82 + 2 × 81 + 1 × 80
= 2, 048 + 16 + 1
= 2, 065.

(d) Hexadecimal system


Hexadecimal number system is even more compact when compared to octal and bi-
nary system. Their base is 16 which signifies 16 single character digits or symbols.
The first 10 digits are decimal system digits and the remaining six are denoted by A,
B, C, D, E and F as shown (Table 3.2). The conversion of decimal number to octadec-
imal is similar to the methods followed earlier for binary and octal systems.
For example, 5 DB represented as (5 DB)16 is the equivalent of decimal number
(720)10.

Table 3.2: Comparison of four number systems.

Decimal Hexadecimal Octal Binary

   

   

   

   
   

   

   

   

   

   
 A  

 B  

 C  
48 Chapter 3 Some mathematical functions

Table 3.2 (continued )

Decimal Hexadecimal Octal Binary

 D  

 E  

 F  

   

3.3 Problems for practice

(1) Evaluate the following:


(a) y = log2 5 + log2 6 (b) y = log2 π (c) y = log3 ð5 − 4 Þ

(2) Solve the simultaneous equations for x and y

2x + 7y = 23 and 5x − 8y = − 19

(3) Constitute an equation for a circle whose centre lies at (2,3) and its radius is
5 cm.

(4) Arrange the van der Waal’s equation of state in the cubic equation in V
 
n2 a
p + 2 ðV − nbÞ = nRT
V

(5) Express c as an explicit function of Λm , where Kohlrausch’s law for molar con-
ductivity Λm of a strong electrolyte at low concentration (c) (where Λ∞ m is the
molar conductivity at infinite dilution and b is the constant) is given as
pffiffiffi
Λm = Λ∞m −b c
Chapter 4
Descriptive statistics

4.1 Introduction

Descriptive statistics are tools in statistics that summarizes the data into some de-
fined coefficients that could be a representation of the model or results of an experi-
ment. Descriptive statistics are broken down into measures of central tendency and
measures of variability (spread). They are used to predict or infer outcomes of a sys-
tem. It characterizes the system using the data. Sometimes the term “number
crunching” is used to describe these features. In science, an enormous amount of
data is generated which needs to be organized and interpreted logically and in a
meaningful way, in such cases descriptive statistics come to the rescue by quantify-
ing the data into useful coefficients.
A measure of central tendency in statistics indicates the attempt to find the cen-
tral position of the data set or distribution. They are sometimes also called the meas-
ures of central location or summary statistics. These measures depict where the most
values of a data set or distribution lies or which is called the central location of distri-
bution. This central value is the representative of the whole distribution. So, by the
definition, the mean or average should be representative of measure of central ten-
dency but there are other representatives as well, namely, median and mode, since
mean often is not sufficient or even sometimes misleading. Hence, under different
conditions and different types of data, different types of measures of central tendency
are used. The central value is a single value which gives the idea of approximation of
normality. The measures of dispersion of data are quantified by standard deviation
and variance, while the minimum and maximum values of the data are explained
using skewness and kurtosis.
These descriptors are useful especially in research where they can meaningfully
interpret any experiment. Also, they reduce the bulkiness of data and organize
them better. One usually prefers to analyse data and reduce the error, but reducing
the data and then analysing the error sounds more intelligent way. One cannot al-
ways end the error, but can reduce it by improvising the sources of error. But some-
times the error is reduced by interpreting the data in a different way.
Instead of taking 10 observation values for an experiment, mean of those values
is preferred (having more significant numbers), thereby reducing the data, and
hence also minimizing the error. Hence, these statistical parameters are a way of
data reduction.
Some of the frequently used descriptors of statistics are described here.

https://doi.org/10.1515/9783110695328-004
50 Chapter 4 Descriptive statistics

4.2 Mean

The mean or the average is the most common measure of central tendency. It is
equal to sum of all the values in the data set divided by the number of observations.
So, the mean can be written as
x1 + x2 + x3 +    + xn
x= (4:1)
n

or
Pn
i = 1 xn
x= (4:2)
n
where x is the mean, x1, x2, x3,. . ., xn are the observations or the data points and n is
the total number of data points, and ∑ (the Greek letter sigma) refers to the summa-
tion. The mean can be calculated for both continuous and discrete data. The above
mean is called sample mean (x) while population mean is represented by μ as
Pn
X
μ = i=1 (4:3)
n
In statistics, sample and population holds different meaning although they both
are calculated in the same manner. The mean includes all values in the data set
which may or may not be outliers; hence, there is often the possibility of error.
In Table 4.1, we have considered the weight of 10 persons (A to J) having differ-
ent weights. The mean comes out to be 60 kg, which is not the correct interpretation
of the overall weights since in the raw data the smallest weight is as small as 25 kg,
while the highest weight is as large as 94 kg. So in that case the mean is a mediocre
value that is not a real reflection of the data, hence, not an appropriate way to de-
pict the typical weight. Therefore, in this case, data is skewed. Therefore, more ro-
bust measures of central tendency are used like median. It minimizes the error in
prediction of any one value in the data set since it includes all data points in calcu-
lation. There are two more types of mean.

Table 4.1: Sample of weight of 10 persons.

Person A B C D E F G H I J

Weight (kg)          
4.2 Mean 51

4.2.1 Arithmetic mean

Arithmetic mean is simply mean average. It is obtained by adding all the values of
data points divided by the number of observations. If we are given raw data of n
number of observations, then
P
X
X= (4:4)
n

Sometimes the data is given with the frequency, that is, the number of times a data
point is repeated in the data set. The mean in such cases is given by
P
fX
X= P (4:5)
f

where f is the frequency, X is the midpoint of the class interval and n is the number
of observations. The mean calculated from raw data is different from mean calcu-
lated from continuous data with frequency. The mean is not suitable when the data
is skewed or when the data set is small since mean resists the fluctuations between
different samples.

4.2.2 Weighted mean

Weighted mean is calculated when some data points carry more weightage (impor-
tance) than other. For that the term wi is assigned to the data value xi. So the
weighted mean is given as
P
wx
Weighted mean = P (4:6)
w

4.2.3 Geometric mean

Geometric mean is defined as the arithmetic mean of data points on a log scale. It is
useful for the data that has more utility when interpreted as a product of the num-
bers and not as sum (unlike arithmetic mean). It is also expressed as the nth root of
the product of an observation
pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
GM = n ðx1 Þðx2 Þ...ðxn Þ (4:7)
P
log x
logðGMÞ = (4:8)
n
*GM cannot be used if the data points involve any zero or negative value.
52 Chapter 4 Descriptive statistics

4.2.4 Harmonic mean

Harmonic mean is defined as the reciprocal of arithmetic mean of the reciprocals.


1 1 n
HM = =P =P (4:9)
AM ð1=xÞ ð1=xÞ
n

The HM is used when the reciprocal of observations hold more importance than the
observation itself. It is particularly useful to estimate the average sample size of
groups, each having different sample size.

4.3 Median

Median is the central or middle value in the distribution data when arranged in as-
cending or descending order of its magnitude. It divides the distribution data in half.
In case of odd number of observations, the middle value is the median, while in case
of even number of observations, the average of two middle values is taken as median.
Unlike mean, median is less vulnerable to outliers and skewed data. It is a preferred
measure of central tendency especially when the data is not symmetrical.
Consider the following data of temperature (in °C) for a set of an experiment
arranged in descending order as

105, 96, 86, 79, 76, 71, 68, 67, 63, 57, 50

In such case, the total number of observations is odd, so median is defined as

Median = ðN=2Þth observation (4:10)

which is 71 °C in the above case (N = 11).


If there are even number of observations as

105, 96, 86, 79, 76, 71, 68, 67, 63, 57

then the median would be defined as


N   
th + N 2+ 1 th
Median = 2
observation (4:11)
2

that is, the average of two middle observations is taken, where (N/2)th and ((N + 1)/2)th
are the positions of the observations. So, the median in the above case would be
76 + 71
Median =
2
Median = 73.5  C
4.5 Standard deviation 53

4.4 Mode

The mode is the most frequently occurring observation in the data set. The advan-
tage of using mode as measure of central tendency is that it can be used for both
numerical and non-numerical (categorical) data. It is mostly used for categorical
data. Graphically, a histogram is used to represent a data set where the highest bar
represents mode. But sometimes, there may be two values/variables that have the
same frequency (they repeat a number of times); in such cases, mode is not useful.
Sometimes, mode lies way beyond the central tendency or region and hence
does not give the accurate idea of the data set.
In Figure 4.1, it shows the number of students voting for their favourite subject.
One can clearly see that the popular choice of students is Physical Chemistry than
Inorganic Chemistry (since most of the students voted for it). The least preferred
choice is Nanochemistry.

Mode
14
15
Number of students

11
9
10
6
5
5 3

Figure 4.1: Histogram showing mode.

4.5 Standard deviation

When a set of observations are taken for the same measurement then the measured
values are grouped around the central value (called mean). Standard deviation de-
scribes the deviation of observations from the mean value or how widely the obser-
vations are spread on either side of mean. Larger standard deviation implies more
widely spread data. Usually, there is a population of N data points where each data
point is known for which the standard deviation (σ) is defined as
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
Pn 2
i = 1 ðxi − μÞ
σ= (4:12)
N
54 Chapter 4 Descriptive statistics

where N refers to the total number of data points or observations in the population,
xi is the ith observation and μ is the population mean of the N observations. But
sometimes it is difficult to access population data; hence, a sample is taken (part or
subset of population) which is considered as an approximation of the population
parameter. There is a difference between the standard deviation of sample as com-
pared to that of population. For the sample, the standard deviation(s) is defined as
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
Pn 2
i = 1 ðxi − xÞ
s= (4:13)
n−1

where x refers to the sample mean for n number of observations. As the n→N, the
sample standard deviation approaches population standard deviation, that is, s→σ.

4.6 Variance

Variance measures dispersion around mean. It is the squared deviation from the
mean. It may be defined by squaring the standard deviation. For a given population
having N data points, the variance is
Pn
i=1 ðxi − μÞ2
σ =
2
(4:14)
N
There is one more parameter similar to variance called co-variance. Co-variance
tells how the two variables vary together. It measures the strength of correlation
between two variables where
PN
i=1 ðxi − xÞðyi − yÞ
Covðx, yÞ = (4:15)
N −1

4.7 Coefficient of variation

The coefficient of variation is defined as the ratio of standard deviation to the mean.
It represents the extent of variability with respect to the mean of the population or
sample. Also known as the relative standard deviation, it is useful in comparing the
spread of a distribution. Coefficient of variation often finds its applications in analyti-
cal chemistry.
σ
CV = (4:16)
μ

Larger the value of CV, greater is the dispersion of data around the mean. Smaller
the CV, more exact is the distribution.
4.7 Coefficient of variation 55

For example, there are two sets of data (A and B) given as follows:

Table 4.2: Analysis of coefficient of variation.

CV Std dev.

Set A      . .


Set B      . .

As evident from Table 4.2, although both sets have same standard deviation from
their mean value, their coefficient of variation (53% and 6%, respectively) is differ-
ent since their individual means are different.

Example 1: A sample of hematite was analysed for iron percentage in the sample. The measurements
were taken repeatedly to ensure true value, which are

42.62, 42.73, 42.75, 42.78, 42.79, 42.83, 42.84, 42.87, 42.92, 42.94

Calculate the mean value, spread, median, average deviation, standard deviation and coefficient
of variation.
Solution: The data is arranged, first, into ascending order

42.62, 42.73, 42.75, 42.78, 42.79, 42.83, 42.84, 42.87, 42.92, 42.94
To calculate mean,

42.62 + 42.73 + 42.75 + 42.78 + 42.79 + 42.83 + 42.84 + 42.87 + 42.92 + 42.94
Mean =
10
Mean = 42.80
Spread is the difference between the highest and lowest values in the observations:

Spread = 42.94 − 42.62 = 0.32


Since there are even number (N = 10) of observations,
N N + 1
2 th + 2 th
Median =
2
5th + 6th
Median = observation
2
Median = 42.81
To calculate average deviation, the results are tabulated (Table 4.3).
56 Chapter 4 Descriptive statistics

Table 4.3: To calculate average and standard deviation.

xi xi − x ðxi − xÞ2

. −. .


. −. .
. −. .
. −. .
. −. E-
. . .
. . .
. . .
. . .
. . .
P P
xi = 42.80 jxi − x j = 0.73 ðxi − xÞ2 = 0.0817

0.73
Hence, average deviation = = 0.073
10

rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
Pn ffi
2
Standard deviation s = i = 1 ðxi − xÞ
n−1

rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
0.0817
s= = 0.095
9

s2 = 0.009

0.095
CV = = 0.0021 = 0.21%
42.8

Skewness
Skewness indicates the asymmetric distribution. It is given by g as

Pn
− xÞ3
i = 1 ðxi
g= (A:1)
ðn − 1Þs3
If the distribution is Gaussian (symmetrical), then g = 0. If g is negative, then left tail of distribution
is longer than the right and vice versa.

Kurtosis
Kurtosis represents the pointedness of data’s distribution. It is given by k as
Pn
i=1 ðxi − xÞ4
k= (A:2)
ðn − 1Þs4
High k implies that most of the standard deviations are caused by extreme deviations from the
mean while smaller k implies that deviations are nearer the mean and the distribution is rounded.
4.8 Data analysis 57

4.8 Data analysis

All the descriptors mentioned earlier are the most frequently used parameters for
analysis of data. Also, the sampling of data is one of the most important practices.
There are a set of tests that helps in identifying the anomaly in the data. It will help
to know whether to keep a data value or remove the discordant data. The frequently
used tests in data sampling are discussed below.

4.8.1 Q-test

Also known as the Dixon’s test, the Q-test is a simple and widely used statistical
tool for finding whether a given data point or result should be retained or rejected.
It involves examining the total scattered data and finding the outliers or discordant
value. An outlier is a deviant value that may be generated from a different set of
sample or distribution.
Keeping an outlier in the data set affects the calculations of mean and standard
deviation. Hence, outliers are needed to be removed. For running Q-test calcula-
tions, the data must be normally distributed (arranged in ascending order), where
Q is given by

jxq − xn j
Q= (4:17)
w

where w is the spread of the observations, that is, the difference between the small-
est and highest value in the data, while xq is the suspected value and xn is the near-
est value to the suspected value when the data is arranged in either ascending or
descending order.
This ratio is then compared with critical values Qc (critical value of Q) corre-
sponding to a particular confidence level (CL = 95% usually). If Q is greater than Qc,
the questionable result can be rejected with the indicated degree of confidence.
Table 4.4 contains the Q values at various confidence intervals.

Table 4.4: *Critical values of Qc.

N Qc (CL %) Qc (CL %) Qc (CL %)

 . . .

 . . .

 . . .

 . . .


58 Chapter 4 Descriptive statistics

Table 4.4 (continued )

N Qc (CL %) Qc (CL %) Qc (CL %)

 . . .

 . . .

 . . .

 . . .

*D.B. Rorabacher, Anal. Chem. 63 (1991) 139.

The Q-test does not give satisfactory results for data set having more than 10 points
(N > 10). Based on the Q-result, more than one data point could be tested for erratic
behaviour but only one value is discarded. Hence, suspected data points (outliers)
are legitimately rejected by using this test.

Example 2: The density of aluminium metal was measured by taking replicate measurements which
are 2.61, 2.74, 3.4, 2.91, 2.21 g cm−3. On the basis of Q-test, should any of the data point be
rejected?
Solution: The first step in detecting an outlier by using Q-test is arranging the data in ascending
order as
2.21, 2.61, 2.74, 2.91, 3.4
The data point 3.4 looks anomalous when compared with the other values so it is the suspected
value. Hence, looking at the values, 2.21 is the smallest value, 3.4 being the highest. The closest
value to the suspect value is 2.91, which gives

j3.4 − 2.91j
Q=
3.4 − 2.21
Q = 0.30. Now, one should look for Qcrit or Qc, if the calculated value exceeds or is well below the
Qc. Since here N = 5 and Qc = 0.71 at 95% confidence level (Table 4.3), this data point may be in-
cluded based on Q-test.
The Q-test cannot be performed if there are more than one identical suspected data points.

Example 3: The analysis of calcite sample yielded CaO percentages of 55.95, 56.00, 56.04, 56.08
and 56.23. The last value appears anomalous; should it be retained or rejected at 95% confidence
level?
Solution: Arranging the data in ascending order as
55.95, 56.00, 56.04, 56.08, 56.23
Here, the difference between the highest (56.23) and lowest values (55.95) is 0.28 which is the
spread of the data.
The suspected value and its nearest values are 56.23 and 56.08, respectively, which gives

j56.23 − 56.08j
Q= = 0.53
0.28
For N = 5, Qc at 95% confidence level is 0.71. Since 0.54 < 0.71, this data point should be retained.
4.8 Data analysis 59

4.8.2 Confidence limit

The experimental mean x may or may not be close to true mean μ. There is an entire
range under which the true mean lie which is defined by experimental mean and
standard deviation. This range is called the confidence interval and its limits are
called the confidence limit. The probability that the true value lies within the range
is called confidence level, usually given by
ts
Confidence limit = x ± pffiffiffiffi (4:18)
N

where t is a statistical factor that depends on the number of degrees of freedom and
the confidence level desired and s is the standard deviation. The number of degrees
of freedom (ν) is one less than the number of measurements (N).

Example 4: A sample was analysed for its wt% in triplicate with the following result 82.5, 82.56 and
82.41 wt% of X. There is 95% confidence that true value lies in a range. What range is that?
Solution: Mean and standard deviation for the given three values are 82.49 and 0.075, respec-
tively. Here N = 3, so degrees of freedom ν = N–1 = 2.
Using eq. (4.18)

ts
Confidence limit = x ± pffiffiffiffi
N
4.303 × 0.075
= 82.49 ± pffiffiffi
3
= 82.49 ± 0.18
Hence, there is 95% confidence that the true value lies between 82.67 and 82.31 in the absence of
any determinate error.

4.8.3 t-Test

Also called Student’s t-test, it is often used by analyst to analyse the statistics be-
tween the results of two different methods. t-test helps to reflect if there is any sub-
stantial difference between the two methods or if they measure the same thing.
There are three types of t-test based on the utility which are explained.
(a) When an accepted value of data is given, there is a set of data that needs com-
paring. In such cases, t-test is given as
ts
μ = x ± pffiffiffiffi (4:19)
N
60 Chapter 4 Descriptive statistics

Or, one may write


pffiffiffiffi
N
± t = ðx − μÞ (4:20)
s

Example 5: A method was analysed for determining the amount of aluminium in a drug using ther-
mogravimetric analysis. Five replicate measurements were made with the same concentration and
the mean of the result was found to be 9.6 ppm with the standard deviation of ± 0.7. The literature
reference is 10.5 ppm. Is the method statistically correct in reference to the true value at 95% confi-
dence level?
Solution: Using t-test (eq. (4.20))
pffiffiffi
5
t = ð9.6 − 10.5Þ
0.7
t = 2.9
At N = 5, the tabulated t value (Table 4.7) is 2.77 at 95% confidence level. Since tcalc > ttab, there is
95% confidence that the procedure is providing statistically different results from the true value
(reference value).

(b) There are one more type of t-tests where the two sets of data compared have
different variances. Such data sets may have different degrees pffiffiffi
of freedom as
well. They also use the same above formula except for them, sN is replaced by
qffiffiffiffiffiffiffiffiffiffiffi
N1 N2
N1 + N2 =sp , where
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
P P P P
ðxi1 − x1 Þ2 + ðxi2 − x2 Þ2 + ðxi3 − x3 Þ2 +    + ðxik − xk Þ2
sp = (4:21)
N−k

Hence,

rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
x1 − x2 N1 N2
±t= (4:22)
sp N1 + N2

Example 6: The analysis of iron sample was carried out using two different analytical methods for
which replicate measurements were made for each method (A and B) and their data measurements
are given as:

Method A . . . . . .


Method B . . . . . –

Compare the two methods on the basis of their mean values.


Solution: When two methods are to be compared having different mean values, both F-test and
t-test can be used. The results are tabulated in Table 4.5.
4.8 Data analysis 61

Table 4.5: t-Test for different mean values of two methods.

xi1 xi1 − x1 ðxi1 − x1 Þ2 xi2 xi2 − x2 ðxi2 − x2 Þ2

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . .


P P
x1 = 19.65% = 2.262 x2 = 19.24% = 0.420

Using eq. (4.21)


rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
P P
ðxi1 − x1 Þ2 + ðxi2 − x2 Þ2
sp = N1 + N2 − 2
rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
2.262 + 0.420
sp = = 0.546
6+5−2
rffiffiffiffiffiffiffiffiffiffi
19.65 − 19.24 6 × 5
t= = 1.23
0.546 6+5

The tabulated t is 2.262 for 9 degrees of freedom (N1 + N2–2) at 95% confidence limit;
hence tcalc < ttab. Therefore, there is not much difference between two methods of
analysis as tcalc is well below the ttab value.

c) Paired t-Test

There are some data sets that need to be compared with other sets of accepted data
sets to establish their genuineness. In such cases, each data point is cross validated
with the accepted data point for deviation and the t value is given as

D pffiffiffiffi
t= N (4:23)
sd

where
sffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
P 2
ðDi − DÞ
sd = (4:24)
N−1
62 Chapter 4 Descriptive statistics

Example 7: Given are the two sets of data taken for a set of samples by two different methods.
Determine if there is a considerable difference between two methods.

Sample A B C D E F
Method X . . . . . .

Method Y . . . . . .

Solution: Using eq. (4.23) for paired t-test, the results may be tabulated for various parameters as
(Table 4.6):

Table 4.6: Paired t-test results.

Sample Method X Method Y Di Di − D ðDi − DÞ2

A . . −. −. .

B . . . . .

C . . −. . .

D . . . . .

E . . . . .

F . . . . .


P P 2
Di = 1.7 ðDi − DÞ = 0.87

1.7
D= = 0.28
6
rffiffiffiffiffiffiffiffiffiffi
0.87
sd = = 0.42
6−1
0.28 pffiffiffi
t= × 6 = 1.63
0.42
The tabulated value of t at 95% confidence limit is 2.571 and since tcalc < ttab, there is not much con-
siderable difference between two methods.

4.8.4 F-test

It is often desirable to compare the result of one method with those of accepted
methods (standard method) to design more robust method of analysis. To deter-
mine if one set of results is significantly different from another depends not only on
the difference in means but also on the amount of data available and spread. F-test
4.8 Data analysis 63

Table 4.7: Values of t for v(N−1) degrees of freedom for various confidence levels*.

Confidence level

ν % % % .%

 . . . .

 . . . .

 . . . .

 . . . .

 . . . .

 . . . .

 . . . .

 . . . .

 . . . .

 . . . .

 . . . .

 . . . .

 . . . .

∞ . . . .

* Analytical Chemistry 7e by Gary D. Christian et al., John Wiley & Sons.

evaluates the difference between spread of results. Hence, this test is designed to
indicate whether there is a significant difference between two methods based on
their standard deviation. It is used to compare two variances.
F is defined in terms of the variances of the two methods (variance is the square
of the standard deviation)

s21
F= (4:25)
s22

where s 1 > s2 .

There are two different degrees of freedom v1 and v2, where degrees of freedom are
defined as N–1 for each case.
If the calculated F value from the equation exceeds a tabulated value at the se-
lected confidence level, then there is a significant difference between the variances
of the two methods. To carry out an F-test, a null and alternate hypothesis is cre-
ated to determine the significance level. Also the degrees of freedom in both numer-
ator and denominator are found out. The calculated value is evaluated for a given
64 Chapter 4 Descriptive statistics

confidence limit to either discard the null hypotheses or vice versa. While evaluat-
ing F-test value, the greater variance should be kept in the numerator.
The null hypotheses assume that σ21 = σ22 , while according to the alternate hy-
potheses σ21 ≠σ22 . If Fcal > Fcrit, the null hypotheses is rejected where Fcrit is the value
of F at the required level of confidence or significance. Table 4.8 lists F-values at
95% confidence limit with different degrees of freedom.

Table 4.8: Values of F at the 95% confidence level*.

v =  v =            

 . . . . . . . . . . .
 . . . . . . . . . . . .
 . . . . . . .  . . . .
 . . . . . . . . . . . .
 . . . . . . . . . . . .
 . . . . . . . . . . . .
 . . . . . . . . . . . .
 . . . . . . . . . . . .
 . . . . . . . . . . . .
 . . . . . . . . . . . .
 . . . . . . . . . . . .
 . . . . . . . . . . . .

* Analytical Chemistry 7e by Gary D. Christian et al., John Wiley & Sons.

Example 8: A sample was analysed by two different methods and replicate results were taken from
these two methods. On the basis of F-test, compare the given results of two methods (Table 4.9).
Solution: To compare the two methods, F-test is often used by comparing the variances of two
methods. The variance of the two methods is calculated as

Table 4.9: F-test for two methods A and B.

Method A     

Method B     

Pn
i = 1 ðxi1− xÞ2 58
s21 = = = 14.5
N1 − 1 5−1
Pn
i = 1 ðxi2− xÞ2 26.8
s22 = = = 6.7
N2 − 1 5−1
s21
F= = 2.164
s22
4.9 Distribution of errors 65

The tabulated result (for ν1 = 4 and ν2 = 4) is 6.39. Hence, the F-values for methods that are com-
pared are way lower than the tabulated allowed results; hence, the two methods A and B are
equally established procedures on the basis of their variances.

4.9 Distribution of errors

Often the events and errors follow some trend in the experiment. The various types
of distribution that are seen can be summarized as
(1) Gaussian distribution
(2) Binomial distribution
(3) Poisson distribution

4.9.1 Gaussian distribution

In statistics, the Gaussian distribution (also called the normal distribution) is the
continuous distribution whose probability density function is
1 2 2
ρðxÞ = pffiffiffiffiffi e − ðx − μÞ =2σ (4:26)
σ 2π
n!∞
for all values of x, where μ and σ are mean and standard deviation, respectively. It
was introduced by Gauss and it governs a variety of phenomenon. The Gaussian
distribution in a normalized form can be written as
+ð∞ +ð∞
1 2 =2σ2
f ðxÞ = ρðxÞdx = pffiffiffiffiffi e − ðx − μÞ dx = 1 (4:27)
σ 2π
−∞ −∞

When σ = 1, it is called standard distribution. It characterizes the distribution of ran-


dom variable about its mean value (symmetric about the mean). This distribution is
the most common distribution in statistics; hence, if one knows the type of distribu-
tion is normal (Gaussian), then distribution of that variable can be characterized by
analysing its mean and standard deviation. In Gaussian distribution, variance and
mean do not necessarily be equal. It has a symmetrical bell-shaped curve (Figure 4.2).
It describes the continuous data having symmetric distribution. The Gaussian
distribution describes the distribution of errors in a sequence of random experi-
ments. These errors as discussed earlier could be systematic or random errors. The
Gaussian distribution is symmetrical around its mean and that mean divides the
symmetric curve into two halves. The total area under the curve bounded by x = a
and x = b is equal to 1. The curve is often standardized to make it simpler and it is
standardized when μ = 0 and σ = 1. Hence, the equation would look like as
66 Chapter 4 Descriptive statistics

0.1
σ=5

σ=7

σ = 10

–30 –20 –10 0 10 20 30

Figure 4.2: Gaussian distribution of errors.

ðb
1 2
f ðxÞ = pffiffiffiffiffi e − x =2 dx (4:28)

a

4.9.2 Binomial distribution

It describes the distribution of random discrete binary data from a finite sample ei-
ther success or failure, hence the name binary distribution. According to formula, it
shows the probability of getting x events out of n trials. It is most suited when num-
ber of outcomes are small usually a success and a failure:

PðxÞ = n Cx px qn − x (4:29)

where n is the number of trials, x is the number of successes from n trials, p is the
probability for success and q is the probability of failure, (n–x) refers to the number
of failures:
pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi pffiffiffiffiffiffiffiffi
σ = npð1 − pÞ = npq (4:30)

where

μ = np (4:31)

If a dice is rolled 30 times, what is the probability of getting 3 on the dice 8 times?
Here N = 30, p = 1/6 and r = 8. For large n, binomial distribution approximates to
Gaussian distribution.
4.10 Statistical tools using spreadsheets 67

4.9.3 Poisson’s distribution

It is a discrete probability distribution that expresses the probability of a given


number of events occurring in a fixed interval of time, distance, area, volume,
space and so on. It models random and independent events. It is appropriate for
random processes that have rare possibility of occurrence. It is useful to character-
ize the events with low probabilities of occurrence.
Consider the radioactive decay of nucleus. If the lifetime of nucleus is some years
and our measurement takes around 1 min, then probability that the nucleus will
decay during measurement is very small; hence, here Poisson distribution works:

e − λ λx
PðxÞ = (4:32)
x!
where x = 0, 1, 2, 3 . . .

Above is the probability of observing exactly x events (successes) and λ is the aver-
age number of events or successes. It is a limiting form of binomial distribution
pffiffiffi
when n tends to infinity. In Poisson process, mean = variance (σ = μ).
For example, the average number of event in a year is 5 at some place. What is
the probability of having 3 events at the same place?
Here, average λ = 5, x = 3:

e − 5 .53
So Pðx = 3Þ = 3! = 0.1404

Hence, 14% is the probability that event may occur at the same place. According to
Poisson distribution, an event may occur at any point of time and one event is inde-
pendent of the occurrence of another event. It describes the distribution of binary
data from an infinite sample. It shows the probability of getting r events from a pop-
ulation (infinite sample).

4.10 Statistical tools using spreadsheets

(1) Average
To find the mean of a sample or population, the function AVERAGE is used. The
data is first entered into the columns and then the AVERAGE function is used as
shown. Its syntax is AVERAGE(Array1)

(2) Mode
To find the mode for the given data, MODE function is used. Its syntax is MODE
(Array1) as shown in Figure 4.3.
68 Chapter 4 Descriptive statistics

A B
1 x values
2 2.1
3 2.5
4 2.3
5 2.5
6 =AVERAGE(A1:A5) =MODE(A1:A5)
7
Figure 4.3: Mean and mode in spreadsheet.

The different types of distribution parameters can also be calculated using spread-
sheet. They are explained as follows:

(3) Normal distribution


The syntax is =NORMDIST(Number, Arithmetic mean, Standard deviation, returns
the Normal Probability distribution function) (Figure 4.4).

A B
1 Number 40
2 Mean 45
3 Std dev 47.609
4 =NORMDIST(B1,B2,B3,FALSE)
5
6
7 Figure 4.4: Normal distribution in
spreadsheet.

This gives answer 0.008333 in accordance with the normal distribution function.
Similarly binomial distribution and Poisson’s distribution can also be used. The
syntax is =BINOMDIST(number’s, trials, probability’s, returns the cumulative distri-
bution function) = POISSON(number, arithmetic mean, returns the cumulative dis-
tribution function).

(4) F-test
F-test in EXCEL can be carried out by using data analysis tab→F-test two-sample for
variances (Figure 4.5). Select the data arrays and output cell, where the result will
be published.
4.10 Statistical tools using spreadsheets 69

Figure 4.5: Data analysis for F-test.

The result obtained is displayed in Figure 4.6. In the picture, df refers to the
degrees of freedom which is N–1, while F is the value of F-test.

F-Test Two-Sample for Variances

Variable 1 Variable 2
Mean 10.41666667 10.3875
Variance 0.333666667 0.932678571
Observations 6 8
df 5 7
F 0.357750973
P(F<=f ) one-tail 0.137760942
F Critical one-tail 0.205091533

Figure 4.6: F-test results in a spreadsheet.

(5) t-Test
The t-test mentioned earlier can be performed in spreadsheets for three different op-
tions as shown, which complies with three types of test we discussed under t-test
(Figure 4.7).

Figure 4.7: t-Test in spreadsheets.


70 Chapter 4 Descriptive statistics

4.11 Problems for practice

1. For the given data, calculate mean, average deviation, standard deviation and
spread of the distribution
7.146, 7.098, 6.942, 7.256, 6.593

2. The following measurements of a given variable have been obtained: 23.2, 24.5,
23.8, 23.2, 23.9, 23.5 and 24.0. Apply the Q-test to see if the data point 23.9 is an
outlier at 95% confidence level.

3. Calculate the confidence limit for a data set for which mean is 56.06, standard
deviation of 0.2% and t-value for 90% confidence limit is 1.833.

4. The analysis of a sample was carried out repeatedly for its % composition in a
sample and obtained 2.98, 3.16, 3.02, 2.99 and 3.07. If the true value was 3.03,
is the method statistically correct in reference to the true value at 90% confi-
dence level?

5. The following replicate measurements were made on a sample using flame


emission spectrometry (FES) and a new colorimetric method and reported. Is
there a significant difference in the precision of the two methods?

FES (mg dL–) Colorimetric (mg dL–)

. .
. .
. .
. .
. .
 .
.
.
Mean = . Mean = .
Chapter 5
Numerical curve fitting

5.1 Introduction

Curve fitting refers to a statistical technique constructing a curve or any mathemati-


cal function graphically that best describes a series of data points. It establishes the
relationship between dependent and independent variables as a function of each
other for a given set of data points in the form of mathematical function or mathe-
matical equation. Curve fitting is broadly used for modelling various phenomena.
But before understanding these data curve fitting technique, one needs to under-
stand two most important terms which are correlation and regression.
In statistics, correlation and regression are often used to measure the strength
of association or establish any relationship between the variables. Before the data
is fitted into a mathematical function, a scatter plot between the two variable is
drawn. From the scatter plot, it can be inferred whether there exists any relation-
ship between the two variables, also the kind of mathematical relationship between
the variables.

5.2 Correlation

It is a statistical measure that establishes the relationship (mostly linear) be-


tween two variables hence the term correlation (co + relation). It can be either
positive or negative. When two variables involved are moving in the same direc-
tion (increase in one also lead to increase in another), then it is called positive corre-
lation and vice versa. Here both variables could be same or different. Correlation is a
measure of association between two variables. Here the two variables that are to be
correlated can be two random variables. They may not be interdependent on each
other. A correlation coefficient of zero indicates no relationship at all, while a positive
value indicates that both the dependent (Y) and independent (X) variables move in
the same direction (e.g., r = 0.9) and a negative coefficient implies dependent and in-
dependent variable move in opposite direction (e.g., −0.5). The correlation value of
−1 or + 1 indicates a perfectly linear relationship. If correlation coefficient is zero,
then there is no relationship at all. The square of correlation coefficient is the coeffi-
cient of determination from regression analysis. There can be many types of correla-
tion relationships but here only two types of correlation are discussed.

https://doi.org/10.1515/9783110695328-005
72 Chapter 5 Numerical curve fitting

5.2.1 Pearson correlation coefficient

It evaluates the linear relationship between two continuous variables as the change
in one variable produces a proportionate change in another variable. In statistics,
the general formula for correlation is given as
P  Pn Pn 
n ni= 1 xy − i=1 x i=1 y
r = rffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi

P
P (5:1)
 P  2 P n  2
n ni= 1 x2 − n
i=1 x n n
i=1 y 2−
i=1 y

Usually a scatter plot is drawn to check for linearity. For evaluating the Pearson co-
efficient, the variables should be normally distributed apart from having a linear
relationship between them. It is a widely used statistical parameter when the data
is linear.
Essentially there are two types of correlation coefficient, namely, population
correlation coefficient (ρxy) and sample correlation coefficient (rxy) which can be
represented as
ssxy
rxy = (5:2)
ssxx ssyy
σxy
ρxy = (5:3)
σxx σyy

where (sn,sy) and sxy refer to sample standard deviation and co-variance while
(σxx,σyy) and σxy are population standard deviation and co-variance.

5.2.2 Spearman’s rank correlation coefficient

The Spearman rank correlation coefficient evaluates monotonic relationship be-


tween ordinal variables (monotonic relationship implies that there is not a fixed
change in one variable with another, although they change together). In Spearman-
type correlation, the variation of one variable with the other is not consistent or is
always proportionate. Alike Pearson’s correlation coefficient, it can also be positive
or negative. A correlation value of −1 or +1 indicates linear relationship whether its
Pearson or Spearman. It is denoted by ρ as
P
6 ni= 1 d2i
ρ=1− (5:4)
nðn2 − 1Þ

It is a nonparametric test which is carried out when there is ordinal data (data is
arranged in order of ranking or preference) or there is monotonic relationship be-
tween data instead of any linear data.
5.3 Regression 73

Pearson’s coefficient gives the strength and direction of linear relationship be-
tween the variables while Spearman’s coefficient gives the same for monotonic
relationship.

5.3 Regression

Regression predicts the value of dependent (y) variable on the basis of known inde-
pendent (x) variable value using the mathematical relationship between them. The
value of y depends upon the value of x; hence, y is a dependent variable while x is
independent. If they are related as

y = a + bx (5:5)

then a and b are regression parameters and b is the regression coefficient. It esti-
mates the value of random variable on the basis of fixed variable value. It also in-
volves establishing mathematical relationship between two variables (dependent
and independent). A model or relationship is constructed and is then tested for its
goodness. If the goodness is good enough, then this model can be used to predict
the values of dependent variable for the given independent variable. When a plot of
expected value of the dependent variables and independent variable is plotted, the
line obtained is called regression line (Figure 5.1). This is called least square curve
(LSC) fitting since it fits the given data keeping the square of the error minimum.
The mathematical relationship for regression (R2 or r2) is given as
ssres
R2 = 1 − (5:6)
sstotal

It is also known as coefficient of determination where ssres refers to the residual


sum of squares (difference between expected and calculated) while sstotal refers to
the sum of squares (proportional to the variance) where yi and f(xi) are the expected
and calculated functions:

ssres = e2i = ðyi − f ðxi ÞÞ2 (5:7)

and

sstotal = ðyi − yÞ2 (5:8)

The t-test and F-tests are often used to test the validity of regression models.
Here R2 implies how well the curve fits the data points, also what we know as
goodness of fit. Its value ranges from 0 to 1. A value close to 1 implies a good model
hence the curve (mathematical function) fits well in data points and vice versa. As
the value of R2 drifts away from 1, the quality of the model falls. Hence a curve is said
74 Chapter 5 Numerical curve fitting

to have a goodness of fit when its R2 value approaches 1. The more it recedes away
from 1, less is the co-variance between two variables.

5.4 Interpolation versus curve fitting

Interpolation is the technique to find the value of variables in between the existing
data points. In interpolation, a curve is constructed through the given data points
assuming the data points to be accurate. Interpolation aims to find a function that
approximates the given data and determine new data points in between. Curve fit-
ting is applied to scattered data that might not be accurate. Hence a smooth curve
is needed in curve fitting that approximates the given data point that might or
might not pass through all the data points while in case of interpolation the func-
tion passes through original data points. This can be illustrated in Figure 5.1.
Y

16
y = 1.9643x + 2.25
14 e5
R2 = 0.9745
12
e4
10
e3
8
e2
6 e1 Interpolation
4

0 x
0 1 2 3 4 5 6 7

Figure 5.1: Interpolation (curve) and curve fitting (straight line).

The interpolation of points is nothing but connecting the data points together while
the other straight line is the curve fitting where a line or a curve has been drawn
which best suits the data points that passes through the maximum number of
points and depicts some mathematical function (shown by the equation).

5.5 Least square curve fitting

The method of LSC fitting implies constructing a line or a curve that passes through
the maximum number of data points and a mathematical relationship which best
describes the data points. There are inevitable errors in every experiment or sets of
5.5 Least square curve fitting 75

observations. The best we can do is to minimize the error by using LSC. It is applica-
ble for a single curve that represents the general trend of data.
Y

16

14
e5
12

10
e3 e4
8
e1 e2
6

0 x
0 1 2 3 4 5 6 7

Figure 5.2: Least square curve fitting by minimizing errors.

(1) As can be seen from Figure 5.2, the solid dots represent the actual data while the
dotted line is the best possible curve that can be drawn to fit the given experimental
data minimizing the error. Here error is the distance between the data point and the
best fit line. For a best fit curve, the error should be minimized (also called vertical and
perpendicular deviations). This method is also called the LSC method because it aims to
minimize the sum of error (also called residual). In the figure, the data is fit into a linear
relationship, but regression can also be applied to other functions as well including
parabola, polynomial of nth order, exponential and logarithmic function to name a few.
The coefficients a and b in the earlier equations are the values that can be
found which best fits the given data into the mathematical model. LSC finds a curve
or a mathematical equation that aptly describes the behaviour of the data. Consider
the function f(x) written as y

y = f ð xÞ (5:9)

so if there is a point x1, then the expected value of y is f(x1) rather it is found to be y1.
So one can define the error in the value of y (also called residual) as

e1 = y1 − f ðx1 Þ (5:10)

Likewise the error at other points from x1 to xn can be written as

e2 = y2 − f ðx2 Þ (5:11)

e3 = y3 − f ðx3 Þ (5:12)

en = yn − f ðxn Þ (5:13)
76 Chapter 5 Numerical curve fitting

The best fitting curve is the one which has minimum sum of square of offsets (resid-
uals). These residuals can be positive or negative, hence to minimize the error at
any point xi, the square of ei’s is taken as
X
n
E= e2i (5:14)
i=1

This E should be minimized in such a way that the sum of squares of residuals is min-
imum or least (hence the name least square curve method) by minimizing the square
of error. The best line must have minimum error between line and data points.

5.5.1 Linear regression

A straight line is the simplest way of fitting the data by using LSC method using the
simple equation y = a + bx, where a and b are constants. The number of constants
equals the number of equations that needs solving. These equations are called nor-
mal equations. Starting from the function

y = a + bx (5:5)

ei is the error or residual between the expected value and measured value.
ei = ymeasured − yexpected = yi − ða + bxi Þ (5:15)

Here some differences may be positive and some may be negative. Hence the error
is squared which is minimized

min Sr = min e2i = min ½yi − ða + bxi Þ2 (5:16)

To minimize the error, differentiate the square of the error with respect to a, b and c
and put it equal to zero. In regression, one minimizes the sum of squared residuals (Sr).

dSr dSr
= =0 (5:17)
da db
dSr X n
= ½ − 2ðyi − ða + bxi ÞÞ = 0 (5:18)
da i=1

dSr X n
= ½ − 2xðyi − ða + bxi ÞÞ = 0 (5:19)
db i=1

which gives
X
n X
n
na + bxi = yi (5:20)
i=1 i=1
5.5 Least square curve fitting 77

X
n X
n X
n
axi + bxi2 = xi yi (5:21)
i=1 i=1 i=1

The earlier equation is also called normal equation. These simultaneous equations
are often solved by using them in matrix form as
2 Pn 3 2 Pn 3
n xi " a # yi
6 i=1 7 6 i=1 7
4P n Pn 5 =4Pn 5 (5:22)
xi 2
xi b xi yi
i=1 i=1 i=1
2 P n 32 P
n 3− 1
" # yi n xi
a 6 i = 1 76 i=1 7
=4Pn 5 4 P
n P
n 5 (5:23)
b xi yi xi x2i
i=1 i=1 i=1

Solving eq. (5.23) for a,


Pn Pn Pn Pn
i = 1 yi −
2
i = 1 xi i = 1 xi i = 1 xi yi
a= Pn 2 Pn 2 (5:24)
n i = 1 xi − i = 1 xi
Pn Pn
i = 1 xi − x
2
y i = 1 xi yi
a= Pn 2 2
(5:25)
i = 1 xi − nðxÞ

where
1X n
x= xi (5:26)
n i=1

and
1X n
y= yi (5:27)
n i=1

Solving eq. (5.23) for b,


Pn Pn Pn
n i = 1 xi yi − i = 1 xi i = 1 yi
b= Pn 2 Pn 2 (5:28)
n i = 1 xi − i = 1 xi
Pn
xi yi − nxy
b = Pni = 1 (5:29)
2
i = 1 xi − nðxÞ2

Also one may write b as


ssxy
b= (5:30)
ssxx
78 Chapter 5 Numerical curve fitting

These expressions can be rewritten in the form of sum of squares. Sum of squares
or sum of square deviations is a measure of variation of data set. They describe the
difference of the predicted and mean of the variable:
X
n
ssxx = ðxi − xÞ2 (5:31)
i=1
X
n 
ssxx = x2i − nx2 (5:32)
i=1
Pn 2
X
n
i = 1 xi
ssxx = x2i − (5:33)
i=1
n
X
n
ssyy = ðyi − yÞ2 (5:34)
i=1
X
n 
ssyy = yi − ny2
2
(5:35)
i=1
X
n
ssxy = ðxi − xÞðyi − yÞ (5:36)
i=1

X
n Pn Pn
i = 1 xi i = 1 yi
ssxy = xi yi − (5:37)
i=1
n
X
n X
n X
n
ssxy = n xi yi − xi yi (5:38)
i=1 i=1 i=1

The variance is square of standard deviation, which can also be written as


ssxx
σ2x = (5:39)
n
ssyy
σ2y = (5:40)
n
ssxy
covðx, yÞ = (5:41)
n
where σx2 and σy2 are the variances, and cov(x,y) is the co-variance.
As correlation coefficient is the co-variance divided by the standard deviations
of the two variables, so the fit is parametrized into correlation coefficient as

ss2xy covðx, yÞ
r2 = = (5:42)
ssxx ssyy ssxx ssyy

The sum of squares reflects the variation in y by variation in x.


The coefficient of determination tells how much y variables can be explained
by x values. If for example, R2 = 0.86, then it implies that 86% of the dependent var-
iables are explained by the independent variables.
5.5 Least square curve fitting 79

Example 1: Using LSC fitting, find an equation of the straight line (y = a + bx) with the given data

x y

 

 

 

 

 

Solution: To find the equation for the given data, the result for constructing normal equations are
tabulated in Table 5.1.

Table 5.1: Curve fitting for a straight line.

x y x xy

   

   

   

   

   

Σx =  Σy =  Σx =  Σxy = 

Here n = 5, using the normal equations as

5a + 10b = 91 (5:43)
10a + 30b = 270 (5:44)
which gives a = 3/5 and b = 44/5.
Therefore the equation would be

y = 0.6 + 8.8x (5:45)


In Figure 5.3, solid line represents the interpolation of given data points while the dotted line
shows the best fit line obtained by LSC fitting.
80 Chapter 5 Numerical curve fitting

40

Y
y = 0.6+8.8x
35

30

25

20

15

10

5
X
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5

Figure 5.3: X versus Y.

For nonlinear least square fitting to a number of unknown parameters, lin-


ear LS fitting may be applied iteratively to a linearized form of the function until
convergence is achieved. So if the given data is to be fit into any nonlinear func-
tion like

y = axb or y = ae bx (5:46)

then the function is first linearized as in the earlier example by taking logarithm on
both sides as

log10 y = log10 a + blog10 x (5:47)

Now the function looks linearized in the form

Y = A + bX (5:48)

where Y = log10 y, A = log10 a and log10 x = X

Similarly

y = ae bx (5:49)

log10 y = loga + bxlog10 e (5:50)

Y = A + BX (5:51)

where log10 y = Y, log10 a = A and blog10 e = B


5.5 Least square curve fitting 81

Example 2: Using the LSC method, fit the following data into the form y = ax b .

x y

 .

 .

 .

 .

 .

 .

Solution: The earlier data (n = 6) is tabulated in Table 5.2 and graphically depicted in Figure 5.4.

Table 5.2: Curve fitting for y = axb.

x y Y X XY X

 . . . . .

 . . . . .

 . . . . .

 . . . . .

 . . . . .

 . . . . .

ΣY = . ΣX = . ΣXY = . ΣX = .

40
Y

35 y = 3.6139x1.253

30

25

20

15

10

0
0 1 2 3 X 4 5 6 7

Figure 5.4: X versus Y.


82 Chapter 5 Numerical curve fitting

this gives

6A + 2.857B = 6.928 (5:52)

2.857A + 1.775B = 3.818 (5:53)

that gives
A = 0.558
B = 1.253 = b
a = antilog A = 3.614
Hence

y = 3.614x1.253 (5:54)

Example 3: The vapour pressure of a hydrocarbon varies with temperature as

t  (°C)    

p (kPa) . . . .

Using the linear regression for a straight line

Δvap Hm 1
lnðp=kPaÞ = − +I (5:55)
R T
Determine the value of change in enthalpy, that is, ΔvapHm.

Solution: Since in the data, temperature is given in ° C, convert it to K, T = (t °C + 273)K. Using linear
relation Y = A + BX, the results are tabulated (Table 5.3), where I represents the intercept a.

Table 5.3: Least square curve fitting to find enthalpy.

T (°C) = x p (kPa) = y /T = X ln p = Y X XY

 . . . .E– .

 . . . .E– .

 . . . .E– .

 . . . .E– .

ΣXi ΣYi ΣXi .


= . = . = .E–
5.5 Least square curve fitting 83

Using the normal equations for linear regression (n = 4)

4a + 0.011847291b = 12.80485006 (5:56)

0.011847291a + 0.000035128b = 0.037711994 (5:57)

which on solving for a and b gives, a = 19.585 and b = −5532.


Δ
Putting back b = − vapR m which gives Δvap Hm = 45.993 kJ mol − 1 , while
H

I = 3.1831208.

Example 4: The following data were obtained for decomposition of di-tertiarybutyl peroxide at con-
stant volume:

t (min)        

p (torr) . . . . . . . .

3p − p
Using the LSC fitting technique for the equation y = a + bx where y = logðpt =TorrÞ with pt = 02
and x = t (min). Determine the rate constant, if b = –k/2.303.
Solution: For using the normal equations for the linear regression these results are as follows
(Table 5.4).

Table 5.4: Least square curve fitting for kinetics data.

t=x p pt Y xy x

 . . .  

 . . . . 

 . . . . 

 . . . . 

 . . . . 

  . . . 

 . . . . 

 . . . . 

Σx =  Σy = . Σxy = . Σx = 


84 Chapter 5 Numerical curve fitting

which gives

8a + 84b = 17.121471 (5:58)


84a + 1260b = 176.63959 (5:59)
which on solving for a and b gives

b = − 0.0083 and a = 2.2273


Since b = –k/2.303, k = 0.0083 × 2.303 = 0.0191 min−1.

Example 5: Find the value of standard half electrode potential E0 of Ag|AgCl using the following
equation and data (Table 5.5):

2RT 2.303RT pffiffiffiffi


E+ ln m = E 0 + m (5:60)
F F

Table 5.5: LSC for standard electrode potential.

pffiffiffiffi
m . . . . . . .

E+ 2RT
F In m . . . . . . .

Solution: The given equation may be interpreted as

y = a + bx

0.236

y = 0.0309x + 0.2244
0.234
R 2 = 0.9723

0.232

0.23

0.228

0.226

0.224

0.222
–0.1 –0.05 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4

pffiffiffiffi
Figure 5.5: Variation of E + 2RT
F ln m versus m.

where intercept a = E0, b = 2.303RT/F and the data is plotted (Figure 5.5) which on extrapolation to
− jAgCljAg = 0.2244 V.
0
y-axis gives ECl
5.5 Least square curve fitting 85

5.5.2 Multivariate linear regression

Multiple linear regression (MLR) method is used when there are more than one vari-
able is involved in influencing the dependent variable y. It may be represented as

y = a + bx1 + cx2 (5:61)

where x1 and x2 are the two independent variables while y is a dependent variable,
b and c are the slopes or coefficients associated with x1 and x2 and a is a constant.
The following example will clearly demonstrate the MLR.

Example 6: Using the method of MLR, find out the order and rate of reaction using the given kinet-
ics data:
Rateðr Þ = k½COm ½Cl2 n (5:62)

Rate (mol L− s−) [CO] (mol L−) [Cl] (mol L−)

. . .

. . .

. . .

. . .

Solution: Since this equation is not linearized and it needs to be linearized by taking log both
sides as (Table 5.6)

log r = log k + m log½CO + n log½Cl2  (5:63)


log y = log k + m X1 + n X2 (5:64)
Y = K + m X1 + n X2 (5:65)
where Y = log r, K = log k, X1 = log ½CO and X2 = log ½Cl2 

Table 5.6: Multiple linear regression for kinetics data.

N Rate(y) [CO] = x [Cl] = x X X Y = log y

 . . . − − −.

 . . . −. − −.

 . . . − −. −.

 . . . −. −. −.


86 Chapter 5 Numerical curve fitting

Here instead of using manual calculations, one may use spreadsheets to ease the calculation by using
the LINEST function (explained in subsequent section). Upon solving,

K = log k = 0.57329
  − 3=2 − 1
antilog ð0.57329Þ = k = 3.743 mol L − 1 s

Similarly m = 1 and n = 1.494.

Hence rate = 3.743 × ð0.1Þ1 × ð0.1Þ1.494


rate = 0.012 mol L−1 s−1 which is same as given in the table; hence, the calculations are
correct.

Example 7: The absorbance values of a mixture of unknown concentration of KMnO4 and K2Cr2O7
using colorimetry at two different wavelengths 372 and 290 nm were found to be 0.732 and 0.5888,
respectively. Using the method of MLR, find the unknown concentrations of the two samples.
Solution: Using Lambert–Beer’s law, we know A = Ɛcl.
Since both the components are non-interacting with each other, their absorbance are additive.
Also if the path length of the cell is taken as unity, then

At 372 nm,

0.732 = εKMnO4 372 CKMnO4 + εK2 Cr2 O7 372 CK2 Cr2 O7 (5:66)

At 290 nm,
0.588 = εKMnO4 290 CKMnO4 + εK2 Cr2 O7 290 CK2 Cr2 O7 (5:67)

which after substituting the value of molar absorption coefficient becomes

0.732 = 805CKMnO4 + 1652CK2 Cr2 O7 (5:68)

0.588 = 1030CKMnO4 + 853CK2 Cr2 O7 (5:69)

These two equations are of the form y = ax1 + bx2 + c. In the above case, c = 0, which can be solved
analytically (Table 5.7)

Table 5.7: Multiple linear regression for absorbance data.

Absorbance (Y) X X

.  

.  

and on solving using the LINEST function gives CK2Cr2O7 = 2.76 × 10–4 M,CKMnO4 = 3.41 × 10–4 M.
5.5 Least square curve fitting 87

5.5.3 Polynomial regression

The curve fitting for second-order polynomial (e.g., equation of a parabola) is like
solving three simultaneous linear equations. For instance, a second-order polyno-
mial is given as

y = a + bx + cx2 (5:70)

where error is given as

ei = ymeasured − yexpected = yi − ða + bx + cx2 Þ (5:71)

min Sr = min e2i = min ½yi − ða + bx + cx2 Þ2 (5:72)

To minimize the error, differentiate the square of the error with respect to a, b and c
and equal it to zero:

dSr dSr dSr


= = =0 (5:73)
da db dc
dSr X n
= ½ − 2ðyi − ða + bx + cx2 ÞÞ = 0 (5:74)
da i=1

dSr X n
= ½ − 2xðyi − ða + bx + cx2 ÞÞ = 0 (5:75)
db i=1

dSr X n
= ½ − 2x2 ðyi − ða + bx + cx2 ÞÞ = 0 (5:76)
dc i=1

which gives
X
n X
n X
n
na + xi b + xi2 c = yi (5:77)
i=1 i=1 i=1
X
n X
n X
n X
n
xi a + xi2 b + xi c = xi yi (5:78)
i=1 i=1 i=1 i=1
X
n X
n X
n X
n
xi2 a + xi3 b + xi4 c = x2i y (5:79)
i=1 i=1 i=1 i=1
2 P P 32 3 2 P 3
n xi x2ia yi
6P P P 3 76 7 6 P 7
4 xi xi2 xi 54 b 5 = 4 xi yi 5 (5:80)
P 2 P P 4 P 2
xi xi3 xi c xi yi

These normal equations can now be solved for the coefficients a, b and c using ma-
trices. Similarly higher order polynomials can also be used to fit the given data
points into the equation.
88 Chapter 5 Numerical curve fitting

Example 8: The osmotic pressure values at various concentrations of a polymer in a solution at


298 K are as follows:

ρ (g cm−) . . . . . .

∏ (atm) . . . . . .

Using the LSC fitting method as per equation y = a + bx + cx2 where y = ∏/ρ, x = ρ and a = RT/M,
calculate M.
Solution: The given equation is for the the van’t Hoff equation for a polymer for which the normal
equations 5.77–5.79 may be written
X
n X
n X
n
na + xi b + xi2 c = yi (5:77)
i=1 i=1 i=1
X
n Xn X
n Xn
xi a + xi2 b + xi c = x i yi (5:78)
i=1 i=1 i=1 i=1
Xn Xn Xn X n
xi2 a + xi3 b + xi4 c = xi2 y (5:79)
i=1 i=1 i=1 i=1

0.7
y = 416.73x 2 + 16.554x + 0.0906
0.6 R 2 = 0.994

0.5

0.4

0.3

0.2

0.1

0
–0.005 0 0.005 0.01 0.015 0.02 0.025

Figure 5.6: Van’t Hoff equation for a polymer.

The limiting value of ∏/ρ at infinite dilution can be determined by plotting ∏/ρ versus ρ and deter-
mining the intercept when ρ→0 (Figure 5.6). Therefore, M = ð=ρÞ RT . Tabulating the required data
ρ!0
in Table 5.8 as
that gives
Table 5.8: Linear regression data.

ρ=x ∏ ∏/ρ = y x x x xy xy

. . . . . . . .

. . . . . .E– . .

. . . . . . . .

. . . . .E– .E– . .

. . . . . .E– . .

. . . . .E– .E– . .


   
Σx = . Σy = . Σx = . Σx = .E– Σx = .E– Σxy = . Σx y = .
5.5 Least square curve fitting
89
90 Chapter 5 Numerical curve fitting

6a + 0.06b + 0.0008125c = 1.875666667 (5:81)


0.06a + 0.0008125b + 1.29375E − 05c = 0.02428 (5:82)
0.0008125a + 1.29375E − 05b + 2.2445E − 07c = 0.0003813 (5:83)
which on solving gives
a = 0.0906, b = 16.554 and c = 416.73
Since a = RT =M,
then M = RT =a = 27, 346.26 gmol − 1 .

LSC fitting helps in trend analysis if one extrapolates the curve to predict what
should be the behaviour or value of observable at any random point of interest. It
compares the given measured data with the standard mathematical models (equa-
tions). It is a standard tool that is used in spreadsheets in terms of trendline that is
derived from the LSC fitting itself.

5.6 Regression and correlation in EXCEL

Spreadsheets uses a set of statistical models and parameters called analysis of vari-
ance (ANOVA) to calculate statistical parameters including correlation and regres-
sion by using some keywords stored in the spreadsheets.
(1) To find the correlation one may enter the data in the two tables for which the
relationship is to be determined, then in any blank cell, type CORREL (Array1,
Array2) and press enter (Table 5.9).

Table 5.9: Correlation in spreadsheet.

A B

 Concentration Absorbance

 . .

 . .

 . .

 . .

 . .

= CORREL(A:A,B:B)
5.6 Regression and correlation in EXCEL 91

The result obtained is 0.9945 which is identical when using the Pearson correla-
tion formula for which the keyword is PEARSON (Array1, Array2). The square of
correlation coefficient is nothing but regression coefficient which can be verified
either graphically or using LSC fitting since A = εcl, linear relationship exists be-
tween absorbance and concentration having a slope of εl, with no intercept.

(2) To find the slope and intercept between the data points having linear relation-
ship, LINEST function is used which uses the LSC method only.

For intercept, the syntax is (Table 5.10)

=INTERCEPT(known y’s, known x’s)


=INDEX(LINEST(known y’s, known x’s),2)
=INDEX(LINEST(B2:B6,A2:A6),2)

Table 5.10: LINEST function to find slope and intercept in spreadsheets.

A B

 Concentration Absorbance

 . .

 . .

 . .

 . .

 . .

=INTERCEPT(B:B,A:A) =SLOPE(B:B,A:A)

Likewise for slope, the syntax is

=SLOPE(B2:B6,A2:A6)
=INDEX(LINEST(B2:B6,A2:A6),1)

The 1 and 2 status in the syntax refers to the slope and intercept. The LINEST func-
tion returns the statistics for a line by using the method of LSC. It calculates the
value of slope and intercept that best fits the given data. Not only LINEST function
but SLOPE as well as the INTERCEPT function can also be used to evaluate slope
and intercept, respectively. The results obtained are same as obtained by solving
the equation used earlier.
92 Chapter 5 Numerical curve fitting

LINEST function is most useful when there are two or more independent vari-
able, also called MLR (Table 5.11). In such cases, the data is fed in the reverse order
of the independent variable. For example, there are two independent variable x1
and x2 and one dependent variable (y), then after the data is fed, select three cells
continuously in a row (A8,B8,C8) and enter the formula in the formula bar above
and press Ctrl + Shift + Enter.
Its syntax is LINEST(y’s, x’s(reverse order))

Table 5.11: LINEST function for multiple linear regression.

f(x) =LINEST(C:C, A:B)

A B C

 x x Y

   

   

   

   

   

 Slope Slope  Intercept

   

Hence by plugging the slope and intercept values, the equation may be written as

y = 3x2 + 2x1 + 5 (5:84)

which can be verified by putting the known values of x1 and


x2y = ð2 × 5Þ + ð3 × 9Þ + 5
y = 42 which is correct. Hence for any given value of x1 and x2, y can be calculated.
LINEST function can be used to calculate statistics not only for linear functions
but for polynomial, exponential and logarithmic functions as well. LOGEST func-
tion is used to calculate the best exponential curve for the data while GROWTH
function is used for exponential curve.
TREND just like LINEST also performs regression but does not return the value
of slope and intercept in the spreadsheet but based on the results, it predicts the
results (y values) for the new x values. Its syntax is

TREND(known_y's,known_x's) or
TREND(known_y's,known_x's, unknown x’s value
5.6 Regression and correlation in EXCEL 93

FORECAST is similar to TREND function except that syntax is a bit different. While
FORECAST can take only one predictor while TREND can do multiple predictors.
These function can also be reached using the data analysis tab add ins.

(3) To find the regression, one may use data analysis and select regression (Figure 5.7).

Figure 5.7: Data analysis tab.

A new window would appear asking to select the data range (Figure 5.8).

Figure 5.8: Selection of data in regression tab.


94 Chapter 5 Numerical curve fitting

Once the data range is selected and the range of output is selected in a spreadsheet,
the output would be displayed as shown in Figure 5.9.

SUMMARY OUTPUT

Regression statistics
Multiple R 1
R square 1
Adjusted R square 1
Standard error 2.77556E–16
Observations 4

ANOVA
df ss Ms F Significance F
Regression 2 0.292913593 0.146457 1.9E+30 5.1284E–16
Residual 1 7.70372E–32 7.7E–32
Total 3 0.292913593

Coefficients Standard error t stat P-value Lower 95% Upper 95% Lower 95.0% Upper 95.0%
Intercept 0.573290316 1.5066E–15 3.81E+14 1.67E–15 0.57329032 0.5732903 0.57329032 0.57329032
X Variable 1 1.49410907 9.2202E–16 1.62E+15 3.93E–16 1.49410907 1.4941091 1.49410907 1.49410907
X Variable 2 1 9.2202E–16 1.08E+15 5.87E–16 1 1 1 1

Figure 5.9: ANOVA in spreadsheet.

This analysis is based on ANOVA, which is a very powerful tool that may disburse a
lot of information on statistical parameters and helps in constructing useful statisti-
cal model if the range of data is correct.

5.7 Exercises for practice

1. The viscosity of a hydrocarbon varies with temperature as

t(°C)   

η (mP) . . .

Determine the activation energy using LSC method as per the equation

lnðη=η0 Þ = lnðA=η0 Þ + E
RT

2. Using the LSC fitting, fit the following molar heat capacity for oxygen according
to the equation y = a + bðT=K Þ + cðT=K Þ2

T (K)     


− −
Cp (J K mol ) . . . . .
5.7 Exercises for practice 95

3. Using the given data for decomposition of NO2 (g), fit the data using LSC

method for the equation y = a + bx where y = log ½NO2 =moldm − 3 and x = t (s).
If b = –k/2.303, find the rate constant k.

t (s)      , ,


½NO2 
ðmol dm − 3 Þ
. . . . . . .

4. The following data was obtained for the optical activity of a solution:

x  . . . . . . .

y  . . . . . . .

Using the LSC fitting method of the form y = a + bx, find the rate constant k,
where b = –k/2.303, where y = logfðθα − θt Þ=ðθα − θ0 Þg and x = t (min).

5. Using the LSC, fit the following data in a second-order polynomial

t (min) . . . . . α

θ (degree) . . . . . −.

6. Calculate Kd for the distribution of I2 between CCl4 and water (using LSC) for
the given data.

Corg (mol dm−) . × − . × − . × −  × − . × −

Caq (mol dm−)  × − . × −  × − . × −  × −
Chapter 6
Numerical integration

6.1 Introduction

Numerical integration refers to the approximate integration techniques used to evalu-


ate integral where explicit function is unknown. There could be many ways in calcu-
lus to approximate the integral but numerical integration involves integration using
numerical techniques. The idea behind this numerical technique is the approxima-
tion of a function which is continuous with discrete points. More simply, it involves
finding the area under the curve where the curve represents the function (Figure 6.1).
There are two techniques for numerical integration namely Newton–Cotes formula
(where equal intervals are involved) and Gauss quadrature (where unequal intervals
are present). Curve fitting is also a method of numerical integration which involves
fitting a function to discrete points and then analytically integrating the function.
When the function is unknown, the discrete equally spaced data points are used
to approximate the function by fitting them in a polynomial of nth order in Newton–
Cotes formula. When the functions are known analytically or when there are unequal
spaced sub-intervals, then Gaussian quadrature formula is used to calculate Gaussian
quadrature at the selected abscissa to give the accurate approximations.

y
y = F (x)

f (x)

a b

Figure 6.1: Definite integral of a function is the area under the curve.

Gauss quadrature involves three types of formulas namely Gauss–Legendre formula,


Gauss–Chebyshev formula and Gauss–Hermite formula. In the context of numerical
integration, this unit has been restricted to the most commonly used Newton–Cotes
formula only, assuming the data is equally spaced.

https://doi.org/10.1515/9783110695328-006
98 Chapter 6 Numerical integration

6.2 Newton–Cotes formula

The Newton–Cotes closed formulas or Newton–Cotes quadrature formulas (named


after Isaac Newton and Roger Cotes) refers to the set of formulas for numerical inte-
gration based on evaluation of integral having equally spaced intervals. They are
the most common numerical methods of integration. Newton-closed formulas are
referred to when the data points are known from the beginning to the end while
Newton–Cotes open formulas are used when the integral limits are beyond data
range. Since most definite integrals in sciences involve closed intervals, Newton-
Cotes closed formulas are used. The Newton–Cotes closed formulas include
(1) Trapezoidal rule
(2) Simpson’s 1/3rd rule
(3) Simpson’s 3/8 rule
(4) Boole’s rule

While trapezoidal rule approximates the integral using a straight line, Simpson’s
rule uses a curve or polynomial (Figure 6.2). Each method gets better by using bet-
ter approximations of higher degree polynomial.

f (x) f (x)

a b x a b t
(a) (b)

Figure 6.2: Approximating integral by a straight line (a) and a curve (polynomial) (b).

6.2.1 Riemann sum

This method is not a part of Newton–Cotes formula yet it is an important compo-


nent when discussing integration. Riemann sum method is the method of dividing
the area under the curve into various geometrical shapes like rectangle, trapezium,
and so on and then adding the area of each component that gives the area under
the curve. Rectangular sum is the method in which the area under the curve is di-
vided into rectangle segments of which each area is calculated and integrated.
6.2 Newton–Cotes formula 99

In order to calculate the area under the curve between the interval a and b
(Figure 6.3), the interval [a, b] is divided into n sub-intervals of width h as

b−a
h= (6:1)
n

by constructing a series of rectangles of width h and length f(x). The sub-intervals


are named as x0, x1, x2, x3, x4 and x5 (here n = 5).

f(x5)

f(x0)

a = x0 x1 x2 x3 x4 b = x5

Figure 6.3: Riemann sum (underestimating the area under the curve).

The area under the curve can be approximated by adding the area of all the rectan-
gles inside the curve as

Area = f ðx0 Þðx1 − x0 Þ + f ðx1 Þðx2 − x1 Þ + f ðx2 Þðx3 − x2 Þ + f ðx3 Þðx4 − x3 Þ + f ðx4 Þðx5 − x4 Þ
(6:2)
Area = ff ðx0 Þ + f ðx1 Þ + f ðx2 Þ + f ðx3 Þ + f ðx4 ÞgΔx (6:3)
X
4
Area = f ðxi ÞΔ x (6:4)
i=0
X
n−1
Area = f ðxi ÞΔ x (6:5)
i=0

−1

Area = f ðxÞdx (6:6)


0
Ð
Here Δ x is replaced by dx and Σ is replaced by (integrand) to find the area under
the curve. The earlier method will underestimate the area under the curve. There
may be another way also to look at the area under the curve (Figure 6.4).
100 Chapter 6 Numerical integration

f(x5)

f(x0)

a = x0 x1 x2 x3 x4 b = x5

Figure 6.4: Riemann sum (overestimating the area under curve).

The formula and the method remains the same but this way the area under the
curve is overestimated. Hence, Riemann’s sum is a very vague method to find the
integral. Clearly, this method seems to either underestimates or overestimates the
integral. Hence, to account for better area, trapezoidal rule was introduced.

6.2.2 Trapezoidal rule

In mathematics or more specifically numerical analysis, the trapezoidal rule is a


Ðb
method used for approximating the definite integral I = a f ðxÞ. It is the simplest
method for numerical integration where the interval points are connected by a
chord to form a trapezium which is then often divided into multiple trapeziums
whose total area is the approximation to the integral under consideration. This
rule is mainly based on the Newton–Cotes formula of first order which states that
one can find the exact value of the integral as an nth-order polynomial. The func-
tion f(x) may not necessarily be a polynomial; it could be a linear function as well.
The trapezoidal rule works by approximating the region under the graph of the
function f(x) as a trapezoid and calculates its area. This formula is also called
Newton–Cotes two-point formula. Alike in Riemann sums, the area under the
curve in trapezoidal rule is divided into several segments which are assumed to
have trapezium shape. The area of each trapezoid is calculated and integrated.
Since area of trapezium is given as

Area of trapezium = 1=2 × ðsum of parallel sidesÞ × distance between them


6.2 Newton–Cotes formula 101

y1 y2 y3 y4 y5 y6
y0
a Δ𝑥 Δ𝑥 Δ𝑥 Δ𝑥 Δ𝑥 Δ𝑥 b

Figure 6.5: Trapezoidal rule.

If the area under the curve is divided into n number of trapezium (number of
intervals) then according to the figure area (Figure 6.5)
1 1 1 1
Area = ðy0 + y1 ÞΔ x + ðy1 + y2 ÞΔ x + ðy2 + y3 ÞΔ x +    + ðyn − 1 + yn ÞΔ x (6:7)
2 2 2 2

Here distance between parallel sides is Δx.



y yn
0
Area = + y1 + y2 + y3 +    + yn − 1 + Δx (6:8)
2 2
b−a
where Δx= n =h

If we are given a function f(x) which is continuous between the intervals a and b,
then the interval is divided into n sub-intervals, so we can write

y0 = f ðaÞ (6:9)

y1 = f ða + ΔxÞ (6:10)

y2 = f ða + 2ΔxÞ (6:11)

yn − 1 = f ða + iΔxÞ (6:12)

yn = f ðbÞ (6:13)

Here i = n–1 (n refers to the number of intervals)


ðb
y
0 yn
Area = f ðxÞ ≈ Δ x + y1 +    + yn − 1 + (6:14)
2 2
a

ðb n
y + y o
0 n
Area = f ðxÞ ≈ Δ x + ðy1 + y2 +    + yn − 1 Þ (6:15)
2
a
102 Chapter 6 Numerical integration

ðb   
f ðaÞ + f ðbÞ
Area = I = f ðxÞ ≈ h + ðf ða + ihÞÞ (6:16)
2
a

It is evident that as the number of intervals (n) is increased, the width of the interval
decreases (Figure 6.6). This increases the accuracy of approximation. The trapezoidal
rule results can be improvised by increasing the number of intervals and decreasing the
step size (h) but it adds to the overall round off error. To evade this situation, Simpson’s
rule was devised by using higher order polynomial to approximate the function.

1 1 1

0.8 0.8 0.8

0.6 0.6 0.6

0.4 0.4 0.4

0.2 0.2 0.2

0 0 0
0.2 0.4 0.6 0.8 1 0.2 0.4 0.6 0.8 1 0.2 0.4 0.6 0.8 1

Figure 6.6: Increasing the sub-intervals (decreasing h).

Ð Ð1
Example 1: Using trapezoidal rule (Table 6.1), find the value of f ðxÞdx = 0 ð5x − 2x 2 Þdx using 10
intervals.
Solution: Here the limits of the integral a and b are given as 0 and 1, respectively, n = 10

b−a 1−0
h= = = 0.1
n 10

Table 6.1: Trapezoidal rule for evaluating integral.

x x x x x x x x x x x

x  . . . . . . . . . .

f(x)  . . . . . . . . . .

So using the formula as above we have


 
ð0 + 3Þ
I = 0.1 + 0.48 + 0.92 + 1.32 + 1.68 + 2.0 + 2.28 + 2.52 + 2.72 + 2.88 (6:17)
2
I = 1.83
The conventional way of integration gives I = 1.8333, so this method gives quite the accurate answer.
6.2 Newton–Cotes formula 103

Example 2: Carry out the integration of the following equation

ðb    
1 dN M 3=2 − Mu2 2
= 4π exp u du (6:18)
N du 2πRT 2RT
a
for O2 gas with du = (b–a)/N where a = 0, b = 1,500, N = 15 using all the three methods.
Solution: The given equation is Maxwell–Boltzmann’s equation for distribution of speeds (Figure 6.7),
for which the area under the curve represents the probability of finding the fraction of molecules having
the said range of speeds which is always equal to 1. The same can also be verified using trapezoidal
rule as well. For each molecular speed sub-interval, the ratio N1 dN
du is tabulated (Table 6.2) and then inte-
grating the area under the curve gives the probability of finding the molecule having that speed.

0.0025

Maxwell–Boltzmann distribution of speeds


0.002
1/N dN/du

0.0015

0.001

0.0005

0
0 200 400 600 800 1,000 1,200 1,400 1,600
Molecular speed (u)

Figure 6.7: Maxwell distribution of molecular speeds for oxygen molecule.

Table 6.2: Trapezoidal rule for Maxwell–Boltzmann’s distribution of speeds.

u (m/s) dN/du (/N) u (m/s) dN/du (/N)

   .

 .  .

 . , .E–

 . , .E–

 . , .E–

 . , .E–

 . , .E–

 . , .E–


104 Chapter 6 Numerical integration

h
I= ½f ðaÞ + f ðbÞ + 2ðf ða + ðn − 1ÞhÞ (6:19)
2
Since h = ð1500 − 0Þ=15 = 100

I = 100½2.038 × 10 − 8 + 9.999952 × 10 − 3  (6:20)


I = 0.99999724 ≈ 1
While the area turned out to be 0.9999972 using trapezoidal rule for speeds 0 to 1,500 m/s. One
may also deduce the probability of finding the molecules in a particular speed range like from 400
to 1,000 m/s, it is found to be 0.553% or 55.3%.

Example 3: Calculate the change in entropy of nitrogen heated at constant pressure from 298 to
373 K where temperature variation of Cp,m is given by the expression

Cp, m =JK − 1 mol − 1 = 27.296 + 5.23 × 10 − 3 ðT =KÞ − 0.042 × 10 − 7 ðT =KÞ2 (6:21)


Solution: Since
 
dS Cp, m
= (6:22)
dT p T

Hence entropy change is given by (Table 6.3)


ð
Cp
ΔS = dT (6:23)
T
Therefore, plugging the given function of heat capacity Cp and integrating will give entropy change
ð ð 
Cp, m 27.296
ΔS = dT = + 5.23 × 10 − 3 =K − 0.042 × 10 − 7 ðT =K 2 Þ dT (6:24)
T T
The entropy change can be found by integrating the area under the curve of Cp/T versus T (Figure 6.8).

Table 6.3: Trapezoidal rule for finding the entropy.

T(K) Cp,m/T(JK–mol–) T(K) Cp,m/T(JK–mol–) T(K) Cp,m/T(JK–mol–) T(K) Cp,m/T(JK–mol–)

 .  .  .  .

 .  .  .  .

 .  .  .  .

 .  .  .  .

 .  .  .  .

 .  .  .  .

 .  .  .


6.2 Newton–Cotes formula 105

0.1

CP V S T
0.095

0.09
Cp

0.085

0.08

0.075

0.07
298 304 310 316 322 328 334 340 346 352 358 364 370 376
Temperature (T )

Figure 6.8: Cp versus T (variation of heat capacity with temperature).

Using trapezoidal rule, we get


376 − 298
Area = ½0.087325 + 2.164047
26
= 6.754 J K − 1 mol − 1

While solving the integral by the conventional way of using limits, the change in entropy is found
to be 6.75 J K−1. Hence the results from trapezoidal rule is quite satisfactory because the number of
intervals are large.

6.2.2.1 Error of trapezoidal rule


The error in the expression is derived using Taylor’s expansion for f(x) and is given by

ðb − aÞ3 ′′
E= − f ðxÞ (6:25)
12
where a < x < b.

where f"(x) is the second derivative of f(x) over the interval [a,b]. Hence, E is propor-
tional to h3.
106 Chapter 6 Numerical integration

6.2.3 Simpson’s 1/3rd rule

Simpson’s rule is the second type of Newton–Cotes method of second order for ap-
proximating the integral of function f(x) using polynomial (e.g. parabolic arcs in-
stead of the straight line used in trapezoidal rule). The Simpson’s rule was named
after Thomas Simpson to approximate the area under the curve and to account for
the inaccuracy in Trapezoidal rule. While the trapezoidal rule works better for linear
functions, Simpson’s rule works very well for curves and polynomials. This method
is more accurate than other numerical method of integration (Figure 6.9).

f ( x3)
y = f (x)

p(x)

f ( x1)
f (x2)

h h
x

x1 = a x2 x3 = b

Figure 6.9: Approximating the data points with a parabolic function.

In Simpson’s 1/3rd rule, a parabola is used to approximate each part of the curve.
The area is divided into n equal segments of width Δx. Simpson’s rule can be de-
rived by approximating the Lagrange’s polynomial. Here Pi(x) is the polynomial of
degree ≤ n–1 that passes through n points (x1, y1), (x2,y2), . . . , (xn,yn) and is given by
X
n
PðxÞ = Pi ðxÞ (6:26)
i=1
x − xk
PðxÞ = yi Πnk = 1 (6:27)
xi − xk
x − xk
li ðxÞ = Πnk = 1 (6:28)
xi − xk

where
       
x − x0 x − x1 x − xi − 1 x − xi + 1 x − xn
li ðxÞ =   (6:29)
xi − x0 xi − x1 xi − xi − 1 xi − xi + 1 xi − xn

Here the basic assumption made is that the area under the curve is divided into three
equal parts as shown (Figure 6.10). This method involves approximating Lagrange’s
6.2 Newton–Cotes formula 107

f0 f(x)

f1 g(x)

f2

x0 x1 x2

h h
x0 = 0 x1 = h x2 = 2h coordinate shift

Figure 6.10: Approximating area using second-order Lagrange’s polynomial P(x).

second-order polynomial where the interval is divided between x0 and x2 which gives
the width of spacing between two intervals as
x2 − x0
h= (6:30)
2
PðxÞ = f0 L0 ðxÞ + f1 L1 ðxÞ + f2 L2 ðxÞ (6:31)

where
  
x − x1 x − x2
L0 ðxÞ = (6:32)
x0 − x1 x0 − x2

substituting the values of variables (x0, x1 and x2)

x2 − 3hx + 2h2
L0 ðxÞ = (6:33)
2h2
  
x − x0 x − x2
L1 ðxÞ = (6:34)
x1 − x0 x1 − x2

4hx + 2x2
L1 ðxÞ = (6:35)
2h2
  
x − x0 x − x1
L2 ðxÞ = (6:36)
x2 − x0 x2 − x1

x2 − hx
L2 ðxÞ = (6:37)
2h2
We know we can integrate function f(x) as
xð2

I= f ðxÞdx (6:38)
x0
108 Chapter 6 Numerical integration

Hence
  2xð2     2 
x − 3hx + 2h2 4hx + 2x2 x − hx
I= f0 + f1 + f2 dx (6:39)
2h2 2h2 2h2
x0
  3     3 2h
1 x 3hx2 4hx2 2x3 x hx2
I = 2 f0 − + 2xh2 + f1 − + f2 − +E (6:40)
2h 3 2 2 3 3 2 0
  3     3 2h
1 8h 12h3 16h3 8h 4h3
I = 2 f0 − + 4h − 0 + f1 8h −
3 3
+ f2 − +E (6:41)
2h 3 2 2 3 2 0

h
I= ½f0 + 4f1 + f2  + E (6:42)
3
Since the final expression has a factor of 1/3, it is also called Simpson’s 1/3 rule.

6.2.3.1 Composite integral Simpson’s rule


If the interval of the integration is small and smooth (there is not much change in the
function) then only two intervals like the earlier are sufficient to approximate the
exact integral. But if they are not then in such cases, the intervals are further divided
into many small sub-intervals to make the function smooth in such small intervals
(Figure 6.11). The Simpson’s rule is applied to each sub-interval and summed to give
an integral which approximates for the entire interval. This is called Composite inte-
gral Simpson’s rule is used which can be derived as

f(x) fN
f(x)
f0
f1 f4
f2 f3

x
h h
a b

Sub- Sub-
int. 1 int. 2

Figure 6.11: Subdividing the sub-intervals (composite Simpson’s rule).

h
I= ½ðf0 + 4f1 + f2 Þ + ðf2 + 4f3 + f4 Þ + ðf4 + 4f5 + f6 Þ +    + ðfN − 4 + 4fN − 3 + fN − 2 Þ
3 (6:43)
+ ðfN − 2 + 4fN − 1 + fN Þ + E
6.2 Newton–Cotes formula 109

h
I= ½ðf0 + 4f1 + 2f2 + 4f3 + 2f4 + 4f5 +    + 2fN − 2 + + 4fN − 1 + fN Þ + E (6:44)
3
 X
N −1 X
N −2 
h
I= f ðaÞ + f ðbÞ + 4 f ða + ihÞ + 2 f ða + ihÞ + E (6:45)
3 i = 1, 2 i = 2, 2

Here it is important to note that there are even number of intervals N while there are
N + 1 integration points which are odd. The Simpson’s rule gives more accurate re-
sults than trapezoidal rule. Simpson’s rule uses quadratic function to approximate
the function over the given interval. The Simpson’s rule demands a condition that N
should be even and h must be a constant. Even if N is odd, h still must be constant.
The truncation error in the expression is given by
− 1 5 ′′′′
E= h f ðxÞ (6:46)
90
− ðb − aÞ5 ′′′′
E= f ðxÞ (6:47)
2880

where f""(x) is the fourth derivative of the function at a point in between [a, b].

6.2.4 Simpson’s 3/8 rule

Just like Simpson’s 1/3 rule is based on quadratic approximation of the polynomial,
when the polynomial is approximated by cubic interpolation, it is known as Simpson’s
3/8 rule (Figure 6.12)

y
y = f (x)

f (x4)
f ( x3)
p(x)

f ( x1)

f ( x2)
h h h
x
x1=a x2 x3 x4=b

Figure 6.12: Simpson’s 3/8 rule.

In this technique, cubic equation or higher order polynomial is used to approximate


the data points. It uses third order Lagrange’s polynomial which on integration gives
110 Chapter 6 Numerical integration

xð3
3h
I= f ðxÞdx = ½f ðx0 Þ + 3f ðx1 Þ + 3f ðx2 Þ + f ðx3 Þ + E (6:48)
8
x0

where the truncation error E is given by

− 3h5 ð4Þ
E= f ðξÞ (6:49)
80

6.2.5 Boole’s rule

When the integration is carried over by integrating the interval over five equally
spaced sub-intervals, it is called Boole’s rule which is given as
xð4
2
f ðxÞdx = hð7f0 + 32f1 + 12f2 + 32f3 + 7f4 Þ + E (6:50)
45
x0

where the truncation error E is given as


8 7 ð6Þ
E= − h f ðξÞ (6:51)
945

Example 4: Using the same data used in Example 2 for Maxwell distribution of speeds, calculate
the area under the curve using Simpson’s rule.
Solution: Use the Simpson’s composite rule for more accurate result since there are large number
of intervals and also there is marked difference between f(x) values, hence

hh X X i
I= f ð0Þ + f ð1, 500Þ + 4 f ðodd intÞ + 2 f ðeven intÞ (6:52)
3
h = (1500–0)/15 = 100

100
I= ½0 + 4.0771 × 10 − 8 + 4ð0.004999958Þ + 2ð0.004999994Þ (6:53)
3
I = 0.9999953 ≈ 1

Example 5: Using the relationship


Tð2
Cp
ΔS = SðT2 Þ − SðT1 Þ = dT (6:54)
T
T1

Calculate ΔS for heating of 1.00 mol of solid zinc from 20.0 to 300.0 K from the given data using
both trapezoidal rule and Simpson’s rule and compare the results.
6.2 Newton–Cotes formula 111

Temperature(T) (in K) Cp,m (JK‒mol‒) Temperature(T) (in K) Cp,m (JK‒mol‒)

   .

 .  .

 .  .

 .  

 .  .

 .  .

 .  .

 .

Solution: In this problem, we are given the temperature and the heat capacity at that temperature.
According to the integral, we need to calculate Cp/T as y function which is tabulated (Table 6.4)
and depicted graphically (Figure 6.13).

Table 6.4: Simpson’s rule to find entropy change.

N Temperature (T) (in K) Cp,m (JK‒mol‒) f(x) = Cp,m/T

   .

  . .

  . .

  . .

  . .

  . .

  . .

  . .

  . .

  . .

  . .

   .

  . .

  . .

  . .


112 Chapter 6 Numerical integration

1.2
CP/T VS T
1
Cp/T

0.8

0.6

0.4

0.2

0
20 40 60 80 100 120 140 160 180 200 220 240 260 280 300
Temperature (T )

Figure 6.13: Variation of Cp/T with T (area under the curve gives entropy).

We can use both the Simpson and trapezoidal rules.

Using trapezoidal rule


 
1 300 − 20
Area = ð1.849 + 12.42335Þ (6:55)
2 14

I = 266.9565 2 JK − 1 mol − 1
Using Simpson’s rule

300 − 20
I= ½f ð20Þ + f ð300Þ + 4ð6.728525Þ + 2ð5.6948Þ (6:56)
14 × 3
I = 267.70025 J K − 1 mol − 1
When solving the function analytically, ΔS is found to be 253.9297 J K–1 mol–1.

Example 6: What is the work done for a real gas if 1.00 mol of Cl2 expands reversibly from 1 dm3 to
49 dm3 at 273 K where a = 0.655 MPa dm6 mol−2 and b = 0.055 dm3 mol−1 and R = 8.314 J K–1 mol–1.
Solution: We know that for real gases, van der Waal’s equation of state for 1 mol of gas is given as

RT a
p= − (6:57)
V − b V2
and the work done is given by
ð ð 
RT a
w= − pdV = − − 2 dV (6:58)
V −b V
6.2 Newton–Cotes formula 113

which upon integration gives


 
V2 − b 1 1
w = − RT ln −a − (6:59)
V1 − b V2 V1
For given volume, pressure is calculated using van der Waal’s equation of state. The results are
tabulated (Table 6.5) and pictorially depicted (Figure 6.14). Area under the pV curve is work done.

Table 6.5: Pressure–volume data for van der Waal’s gas.

V (dm) P (kPa) V (dm) p (kPa) V (dm) p (kPa)

 .  .  .

 .  .  .

 .  .  .

 .  .  .

 .  .  .

 .  .  .

 .  .  .

 .  .

2,500

pV work
2,000

1,500
f (x)

1,000

500

0
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49
Volume (V)

Figure 6.14: Area under the pV curve gives work done.


114 Chapter 6 Numerical integration

Using trapezoidal rule


 
1 49 − 1
w= × ½1.7929 + 2ð3.4473Þ (6:60)
2 24

w = − 8.687 kJ mol − 1
Using Simpson’s composite rule,
 
1 49 − 1
w= × ½1.7929 + 4ð1.9567Þ + 2ð1.4905Þ (6:61)
3 24

w = − 8.400 kJ mol − 1
The equation when solved analytically, work done is −8.319 kJ mol−1.

In some examples earlier, there may be some considerable difference between


the integral calculated analytically and numerically, since numerical methods are
approximate methods and uses only given discrete data points as the basis of inte-
gration which may or may not be that accurate or deviate slightly from the original
function in case of experimental data. Also the numerical methods use polynomials
of nth order which may or may not exactly fit the data points. Yet we have observed
that numerical integration is able to deliver satisfactory results where the original
function is not available or is difficult to integrate.

Newton–Cotes open formulas


These methods do not use the end points or limits. There are three types of open formula:
(1) Mid-point formula
(2) Two-point formula
(3) Three-point formula

Mid-Point formula
This rule doesn’t use the end points rather use the mid point of the interval. The formula involves
calculation of function at a single point i.e. at the mid point of the interval. Hence integral

ðb
f ðxÞdx ≈ ðb − aÞf ðxm Þ
a
where xm is the mid-point,

a+b
xm =
2

Two-point formula
The two-point formula uses two sub-intervals rather the original intervals. When the function f(x) is
continuous between the interval [a,b] then using the two-point formula, hence integral is

ðb
b−a
f ðxÞdx ≈ ðf ðx1 Þ + f ðx2 ÞÞ
2
a
6.3 Exercises for practice 115

Three-point formula
In this method, the interval is divided into four sub-intervals such that

b−a
h=
4
ðb
4h
f ðxÞdx = ð2f ðx1 Þ − f ðx2 Þ + 2f ðx3 ÞÞ
3
a
ðb
b−a
f ðxÞdx = ð2f ðx1 Þ − f ðx2 Þ + 2f ðx3 ÞÞ
3
a
where
3a + b a+b 3b + a
x1 = , x2 = , x3 =
4 2 4

6.3 Exercises for practice


2Ð0
1. Integrate x3 dx using trapezoidal rule.
10 Ð3 2
2. Using Simpson’s rule, integrate e2x dx.
1
3. What is the work done if 1 mol of a real gas expands reversibly isothermally
from 1.001 × 10−3 m3 to 0.100 m3 using trapezoidal and Simpson’s rule both
where a = 0.3640 Pa m6 mol−2 and b = 4.267 × 10–5 m3 mol−1.

4. Using Simpson’s rule, Calculate the change in entropy of Nitrogen heated at


constant pressure from 298 to 376 K using Simpson’s rule:

Cp, m ðJ K − 1 mol − 1 Þ = 27.296 + 5.23 × 10 − 3 ðT=KÞ − 0.042 × 10 − 7 ðT=KÞ2

5. Calculate the increase in enthalpy from 300 to 1,100 K using numerical integra-
tion given the following data

T (K)     ,

Cp (J K− mol−) . . . . .


Chapter 7
Differential equations

7.1 Introduction

A differential equation is an equation having derivatives. There may be first-order,


second-order and higher order differential equations. The order represents the high-
dy
est order derivative in the equation. For example, dx = xCosx is the first-order differ-
d2 y
ential equation, and dx2 = 2Sin x + 5Cos x is a second-order differential equation.
Ordinary differential equations (ODEs) are the equations which have functions of
one or more independent variable (usually x) and their derivatives. In fact vast
class of first-order differential equations cannot be solved, so in such cases numeri-
cal methods to solve differential equations come to rescue. For that matter, we
would restrict ourselves to linear, separable and exact differential equations with
set of conditions. Even the differential equations that are separable cannot be
solved explicitly. The numerical methods to solve differential equations can at least
point out the direction in which the change is taking place, that is, by plotting a
graph between y and x.
Numerical methods for differential equations are the numerical approximations
to the solutions of differential equations but it does not imply the integral computa-
tion. Some differential equations which cannot be solved using conventional alge-
braic methods, separation of variables, integrating factors or any similar methods
are solved using numerical methods. Even if the solution is obtained from the ear-
lier mentioned algebraic means or methods, the solution may seem complicated. In
such cases numerical methods give an approximate solution. The most conven-
tional method of solving the ordinary differential equation numerically is Euler’s
method. The other method used is Runge–Kutta (RK) methods. Here what we are
dealing with is ODEs i.e. Ordinary differential equations.
The differential equation are written as dy/dx = f(x,y) where y(0) = y0, that is, we
are given an initial condition: at x = 0 and y = 0, which can also be written as x0, y0.

What are Cauchy–Euler differential equations?


Cauchy–Euler’s differential equations also called Euler’s equations are linear homogeneous differ-
ential equations with variable coefficients that can be solved explicitly. In general they can be rep-
resented as

an x n y ðnÞ ðxÞ + an − 1 x n − 1 y ðn − 1Þ ðxÞ +    + a0 yðxÞ = 0 (7:1)


(n) th
where an is constant, y is the n derivative of y w.r.t. x.

https://doi.org/10.1515/9783110695328-007
118 Chapter 7 Differential equations

7.2 Euler’s method

All differential equations cannot be solved implicitly. Euler’s method is a numerical


solution for first-order differential equations. The error in each step is directly pro-
portional to the square of the step size.
This method uses the Taylor’s series expansion to express the differential equa-
tion. The Taylor’s expansion for a function is given by

h dy h2 d2 y h3 d3 y
f ðx + hÞ = f ðxÞ + + + +  (7:2)
1! dx 2! dx2 3! dx3
or

h ′ h2 h3
yðx + hÞ = yðxÞ + y ðxÞ + y′′ðxÞ + y′′′ðxÞ +    (7:3)
1! 2! 3!
where h is the difference between two successive points like x and x + h. If the inter-
val between different x values is small, i.e. h is small, then Euler’s method approx-
imates the expansion term in Taylor’s series so the earlier expansion can be
approximated as (ignoring higher order terms because they are very small)

yðx + hÞ ≈ yðxÞ + hf ðx, yÞ (7:4)

where f ðx, yÞ is the derivative of y at (x0, y0), x0 is the initial value of x and y0 is the
value of y at x = x0 (i.e. the initial condition). In general, one may write

yn + 1 = yn + hf ðxn , yn Þ (7:5)

yn +1 is the next estimated value, yn is the current value, h is the interval size and
f(xn,yn) is the derivative at [xn,yn]. Since Euler’s method retains only first-order de-
rivative terms from the Taylor’s series expansion of the function, it is also called
RK’s method of first order.
A first-order differential equation may be considered as a derivative or slope of
the function:

dy
= f ðx, yÞ (7:6)
dx

The Euler’s method uses the basis of initial value problem which suggests that as
we calculate the next value of y1 from initial y0 value, this calculated value becomes
the initial value for the next higher value of y2.

Example 1: Using the Euler’s method, solve the following differential equation:

dy y
=5−3 (7:7)
dx x
Given y(3) = 1 and h = 0.1.
7.2 Euler’s method 119

Solution: The initial conditions are given as y(3) = 1, that is, at x = 3, y = 1. Using eq. (7.7), dy/dx is
calculated as
 
dy 1
f ðx, yÞ = =5−3 =4 (7:8)
dx 3
Since

xn + 1 = xn + h = 3.1
likewise
yn + 1 = yn + hf ðx, yÞ, which gives yn + 1 = 1 + ð0.1Þð4Þ = 1.4

The remaining results are tabulated in Table 7.1 and depicted graphically in Figure 7.1. One may
calculate the data points using the earlier differential equation.

Table 7.1: Euler’s method to solve first-


order ODE.

x y dy/dx

  
. . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .

4.0
y

3.5 3.8, 3.5


3.7, 3.2
3.0 3.6, 3.0
3.5, 2.7
2.5
3.4, 2.4

2.0 3.3, 2.1


3.2, 1.8
1.5
3.1, 1.4

1.0 3, 1.0

0.5

0.0
2.9 3.1 3.3 x 3.5 3.7 3.9

Figure 7.1: Solved ODE using Euler’s method.

Thus this graph is the solution of the above differential equation.


120 Chapter 7 Differential equations

Example 2: Using the solution of differential equation for first-order kinetics y’ = –ky ( i.e. [At] = –k[A] )
with the initial condition of [A0] = 0.25 mol dm–3, determine the concentration [A] at t = 200, 400, 600,
800, 100 and 1,200 s where k = 0.000622 s−1.
Solution: Here a first-order differential equation, Euler’s method would be used as

d½A
= − k½A (7:9)
dt
where initial condition is [A](t = 0) = [A0] = 0.25, h = 200 s

y1 = A200 = A0 + Δt.d½A=dt (7:10)


 
dy
A200 = 0.25 + 200 × (7:11)
dx
The results are further tabulated in Table 7.2 and depicted graphically in Figure 7.2.

Table 7.2: Euler’s method to solve for


kinetics data.

x y dy/dx

 . −.
 . −.
 . −.
 . −.
 . −.E–
, . −.E–
, . −.E–

0.3

0.25 0, 0.25

200, 0.218
0.2 400, 0.191
y

600, 0.167
0.15 800, 0.146
1,000, 0.128
1,200, 0.112
0.1

0.05

0
0 200 400 600 x 800 1,000 1,200 1,400

Figure 7.2: Euler’s method for solving first-order kinetics data.


7.3 Runge–Kutta method 121

Its solution is given by

lny = − kx + C (7:12)
where C = ln 0.25 which gives the same results as found out by Euler’s method while the general
solution is

½A = ½A0 e − kt (7:13)


or

ln½A = ln½A0 − kt (7:14)

ln½A = C − kt (7:15)

7.3 Runge–Kutta method

As compared to Euler’s method which requires very small intervals to give accurate
results, RK method produces better results in lesser steps. It is a numerical method to
integrate a differential equation. RK methods are robust method which gives good
numerical solution of differential equations if the step size is taken intelligently. RKs
fourth-order algorithm is more popular due to their accuracy in the results.
The aim of RK method is same as of Euler’s method, that is, to find the value of
y at any other value of x if the initial values are given. Euler’s method will be exact
when the solution is a line while RK methods will be accurate if the solution is a
polynomial of higher order. (Euler’s method is same as RK1 method.) RK methods
for higher order polynomial are more accurate and involve multi-stage calculations
involving calculations at various slope values (e.g. RK3 and RK4 methods).
RK method provides good approximation to a function without having to differ-
entiate the equation unlike Taylor’s series (only if the point of interest is close
enough). Taylor’s method differentiates the function for each new term one intends
to calculate. RK method aims to simulate as many steps of Taylor’s series while
evaluating the original function. RK method order 4 formula, also called RK4, is
widely used in the fields of mechanics, climate models, aerodynamics, environmen-
tal studies models, drug delivery, ecosystem study and many other sub-branches of
physics, chemistry and biology.

7.3.1 RK 2 or predictor–corrector method

RK method of order 2 is also called Heun’s method or improved Euler’s method.


This numerical method is used to solve only first-order differential equations of the
form
122 Chapter 7 Differential equations

dy
= f ðx, yÞ (7:6)
dx

It involves calculating the intermediate value and then use this value to calculate
the final value. We know by Euler’s method that

yn + 1 = yn + hf ðxn , yn Þ (7:16)

where the symbols have their usual meaning as described in the earlier methods.
The Taylor’s series is given as

h ′ h2 h3
yðx + hÞ = yðxÞ + y ðxÞ + y′′ðxÞ + y′′′ðxÞ +    (7:17)
1! 2! 3!
If the first two terms of the Taylor’s series are retained then it is nothing but Euler’s
method or RK’s first-order method. But if the first three terms are retained, then the ap-
proximation would look like

h2 ′
yn + 1 = yn + hf ðxn , yn Þ + f ðxn , yn Þ (7:18)
2!
And is called RK second-order method where f ′(xn, yn) is the double derivative of
function at point xn,yn. This implies that second-order derivative is to be calculated
which is very difficult to calculate using the differential equation. Instead RK wrote
second-order method as
 
k1 k2
yn + 1 = yn + + h (7:19)
2 2

where k1 = f(xn,yn) and k2 = f(xn + h, yn + k1h).


Here yn +1 is the final value while yn + k1h is the intermediate value.
The true error in the approximation is given by

h2 h3
E= f ðxn , yn Þ + f ′ðxn , yn Þ +    (7:20)
2! 3!
which is nothing but the remaining terms of the Taylor’s expansion series.

Example 3: Using the solution of second-order RK method of differential equation for kinetics, as
dy/dx = −ky2 with the initial condition of y(t = 0) = 632 mol dm–3 at t = 3,6, 9,12, 15 and 18 min
where k = 1.78 × 10−5 dm3 min–1.
Solution: Here the initial condition is given as x = 0 and y = 632

dy
= − ky 2 (7:21)
dx
Using the second-order RK method of differential equation we have
7.3 Runge–Kutta method 123

 
k1 k2
yn + 1 = yn + + h (7:19)
2 2
where k1 = f (xn, yn) and k2 = f (xn + h, yn + k1 h)

dy
k1 = f ðx, yÞ = = − 1.78 × 10 − 5 ð632Þ2 = − 7.109 (7:22)
dx
Similarly xn + h = 0 + 3 = 3 and yn + k1 h = 632 + ð− 7.10Þ3 = 610.67

k2 = f ð3, 610.67Þ = − 1.78 × 10 − 5 ð610.67Þ2 = − 6.637 (7:23)


Hence, the results are further tabulated in Table 7.3.

Table 7.3: RK2 method for solving kinetics data.

x y k k x+h y + k h

  −. −.  .


 . −. −.  .
 . −. −.  .
 . −. −.  .
 . −. −.  .
 . −. −.  .
 . −. −.  .
 . −. −.  .

650
Y

630 0, 632

610 3, 611.38

590 6, 592.06
9, 573.92
570
12, 556.86
550
15, 540.79
530 18, 525.62
510 21, 511.27

490

470

450
0 5 10 X 15 20 25

Figure 7.3: RK2 method for solving ODE.


124 Chapter 7 Differential equations

The solution of the earlier differential equation is (Figure 7.3)


1
y= (7:24)
kt + C
where C = 1/632 using initial condition y(t = 0) = 632, hence

1
y= (7:25)
kt + ð1=632Þ
which gives the same results.

7.3.2 RK3

RK3 is also known as RK method of order 3. In RK3 method, one more Taylor series
term is included as compared to RK2 method. RK3 is comparatively more accurate
than RK2 but less precise than RK4
1
yn + 1 = yn + ðk1 + 2k2 + k3 Þh (7:26)
6

where k1 = f ðxn , yn Þ, k2 = f ðxn + h=2, yn + k1 h=2Þ and k3 = f ðxn + h, yn − k1 h + 2k2 hÞ

7.3.3 RK4

Also known as RK method of order 4 is the most popular method to solve first-order
differential equations. Apart from being the most accurate, it requires less computa-
tion time. In general, the RK formula for any y(x + h) point can be written as
1
yn + 1 = yn + ðk1 + 2k2 + 2k3 + k4 Þ (7:27)
6
   k 
where k1 = hf ðx, yÞ, k2 = hf x + h2 , y + k21 , k3 = hf x + h2 , y + 22 , and k4 = hf ðx + h, y + k3 Þ
Originally the RK method was derived analytically rather from geometric mean
point of view since from the formula, it is clear that it takes into account the geo-
metric weight of ki.

Example 4: Using RK method of order 4, solve the following differential equation using step size h = 0.1:

dy
ð1 + x 2 Þ + xy = 0 (7:28)
dx
y ð0Þ = 2, h = 0.1
Solution: On rearranging, we have
dy − xy
= (7:29)
dx 1 + x 2
Using initial value problem, we have y(0) = 2, that is, at x = 0, y = 2,
7.3 Runge–Kutta method 125

k1 = hf ðx, yÞ = 0.1f ð0, 2Þ = 0,


k
For, k2 , x + h2 = 0 + 0.1
2 = 0.05, y + 2 = 2 + 2 = 2
1 0


k
So k2 = hf x + h2 , y + 21 = 0.1f ð0.05, 2Þ = − 0.010
For k3 , x + h = 0 + 0.1 = 0.05, y + 2 = 2 + − 0.010 = 1.995
k

2 2
2 2
k
k3 = hf x + h2 , y + 22 = 0.1f ð0.05, 1.995Þ = − 0.010
For k4 , x + h = 0 + 0.1 = 0.1, y + k3 = 2 + ð − 0.010Þ = 1.990
k2 = hf ðx + h, y + k3 Þ = 0.1f ð0.1, 1.990Þ = − 0.020
The rest of the results are tabulated in Table 7.4 and graphical solution is depicted in Figure 7.4.

Table 7.4: RK4 method to solve first-order differential equation.

x y dy/dx k k(x) k(y) k k(y) k k(x) k(y) k

. . . . . . −. . −. . . −.
. . −. −. . . −. . −. . . −.
. . −. −. . . −. . −. . . −.
. . −. −. . . −. . −. . . −.
. . −. −. . . −. . −. . . −.
. . −. −. . . −. . −. . . −.
. . −. −. . . −. . −. . . −.
. . −. −. . . −. . −. . . −.
. . −. −. . . −. . −. . . −.
. . −. −. . . −. . −. . . −.
. . −. −. . . −. . −. . . −.

2.500

2.000

1.500
y

1.000

0.500

0.000
0.000 0.200 0.400 0.600 0.800 1.000 1.200 1.400
x

Figure 7.4: RK4 method to solve ODE.


126 Chapter 7 Differential equations

Second-order differential equations can also be solved using the earlier numerical
methods for solving differential equation. One such example of such equation is vi-
brating springs where an object of mass is held at the end of a spring (Hooke’s law).
According to the latter, the restoring force is given as F = −kx, where k is the spring
constant. Also using Newton’s law, F = ma where m is the mass of the object held to
the spring where acceleration can be written in terms of derivative of displacement of
the spring from the equilibrium position. This gives a second-order differential equa-
tion as
d2 x
m = − kx (7:30)
dt2
and the general solution is given by

xðtÞ = c1 cosωt + c2 sinωt (7:31)

where
rffiffiffiffi
k
ω=
m
For such second-order differential equations

d2 y dy
m +n + ky = 0 (7:32)
dx2 dx
The equations can be written as two simultaneous coupled first-order equations by
defining a new variable z as
dy
= z = f ðx, y, zÞ (7:33)
dx
d2 y dz
= = gðx, y, zÞ (7:34)
dx2 dx
Hence the earlier equation can be rewritten as

dz
m + nz + ky = 0 (7:35)
dx

This equation can also be solved using either Euler’s method or RK4 method. For
RK4 method, different coefficients are given as

k0 = hf ðx0 , y0 , z0 Þ, l0 = hgðx0 , y0 , z0 Þ



k l k l
k1 = hf x0 + h2 , y0 + 20 , z0 + 20 , l1 = hg x0 + h2 , y0 + 20 , z0 + 20



k2 = hf x0 + h2 , y0 + k21 , z0 + l21 , l2 = hg x0 + h2 , y0 + k21 , z0 + l21
k3 = hf ðx0 + h, y0 + k2 , z0 + l2 Þ, l3 = hgðx0 + h, y0 + k2 , z0 + l2 Þ
1
y1 = y0 + 61 ðk0 + 2k1 + 2k2 + k3 Þ, z1 = z0 + ðl0 + 2l1 + 2l2 + l3 Þ
6
7.3 Runge–Kutta method 127

Example 5: A spring of 2 kg is stretched to length 0.7 m with a force of 25.6 N, which had the equi-
librium length of 0.5 m then released with the initial velocity of zero. Find the position of mass at
0.7 s (Figure 7.5).

m Equilibrium 0
position

x m

Figure 7.5: Hooke’s law for a spring.

Solution: As we have learnt, the solution of the above type of second-order differential equation is
given by

d2 x
m = − kx (7:30)
dt 2
According to Hooke’s law

kð0.2Þ = 25.6
k = 128
Substituting the values of mass and spring constant as

d2 x
2 + 128 x = 0 (7:36)
dt 2
when solved analytically, the general solution is

x ðt Þ = c1 cos8t + c2 sin8t (7:31)


where
rffiffiffiffiffiffiffiffi
128
ω= =8
2
The initial condition of x(t = 0) = 0.2, also the initial velocity is given as zero, that is, x’(t = 0) = 0 or
dx/dt = 0. Substituting the initial condition in 7.31

x ð0Þ = c1 cos0 + c2 sin0 = 0.2 (7:37)


x′ðt Þ = 8c1 sin8t + 8c2 cos8t (7:38)
Hence c1 = 0.2. Also

At t = 0 x′ðt = 0Þ = 8c1 sin0 + 8c2 cos0 = 0 (7:39)


Table 7.5: RK4 method to solve second-order differential equation.
128

x y z k k k k l l l l

 . . . −. −. −. −. −. −. −.
. . −. −. −. −. −. −. −. −. .
. −. −. −. −. −. −. . . . .
. −. −. −. −. −. . . . . .
. −. . . . . . . . . .
. −. . . . . . . . . −.
. . . . . . . −. −. −. −.
. . . . . . −. −. −. −. −.
. . −. −. −. −. −. −. −. −. −.
Chapter 7 Differential equations
7.4 Problems for practice 129

which gives c2 = 0. Hence the solution we have is

x ðt Þ = 0.2cos8t (7:40)
To find displacement at t = 0.7 s, x(0.7) = 0.1551. Likewise, the equation can be solved using the RK’s
method for solving differential equations (Figure 7.6) as shown in Table 7.5 using the above methodology.
Using the RK method, we got almost the same answer as 0.1514. Since they are approximate
methods, one may not always get the same exact answer as that of analytical solution but quite
close solution depending on the stability of the algorithm for the given problem.

Harmonic oscillator
0.25
0.20
0.15
0.10
Displacement (x)

0.05
0.00
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
(0.05)
(0.10)
(0.15)
(0.20)
(0.25)
Time(s)

Figure 7.6: Harmonic motion of the spring solved by RK4 method.

7.4 Problems for practice


dy y
1. = y ln , yð3Þ = e, h = 0.1
dx x

dy 8y
2. = 30x2 − , yð0Þ = 0, h = 0.1
dx 3

dy
3. = sinðx + yÞ − ex , yð0Þ = 3, h = 0.1
dx

d2 y dy
4. + − 6y = 0 given yð0Þ = 3 and y′ð0Þ = 1
dx2 dx

d2 y dy
5. + 20 + 64y = 0 yð0Þ = 0 and y′ð0Þ = 0.6
dx2 dx
Chapter 8
Numerical differentiation

8.1 Introduction

For a given point on the curve, the slope of the tangent to the curve gives the deriv-
ative of that function (curve). Numerical differentiation refers to calculating the de-
rivative of an unknown function at some assigned point when the discrete data
points are given. If we are given the set of data points for which the function is not
given but only the data, then we can use those points to determine derivatives
at those points. Numerical differentiation is the way of finding numerical value of
derivative of a given function at a given point. In general, the derivative can be ex-
pressed as

f ðx + hÞ − f ðxÞ
f 'ðxÞ = (8:1)
h

where h is the difference between two x values (e.g. x and x + h).

x2,y2

x1,y1

x0,y0

x–1,y–1

x–2,y–2

Figure 8.1: Tangent to the curve.

The derivative is the slope of the line that is made by connecting the data points
(Figure 8.1). The derivative (f'(x)) at the point x0 is

dy f ðx1 Þ − f ðx0 Þ y1 − y0
= f 'ðx0 Þ = = (8:2)
dx x1 − x0 x1 − x0

In general,

dy f ðxi + 1 Þ − f ðxi Þ yi + 1 − yi
= f 'ðxi Þ = = (8:3)
dx xi + 1 − xi xi + 1 − xi

https://doi.org/10.1515/9783110695328-008
132 Chapter 8 Numerical differentiation

This is also called forward difference formula (FDF). Similarly, if the two points are
x0, y0 and x–1, y–1, that is backward points are considered, then

dy f ðx0 Þ − f ðx − 1 Þ y0 − y − 1
= f 'ðx0 Þ = = (8:4)
dx x0 − x − 1 x0 − x − 1

which can be written as

dy f ðxi Þ − f ðxi − 1 Þ yi − yi − 1
= f 'ðxi Þ = = (8:5)
dx xi − xi − 1 xi − xi − 1

This is known as backward difference formula (BDF). If a more balanced approach


is taken to find derivative at x0, take one backward point and one forward point as

dy f ðxi + 1 Þ − f ðxi − 1 Þ yi + 1 − yi − 1
= f 'ðxi Þ = = (8:6)
dx xi + 1 − xi − 1 xi + 1 − xi − 1

This is called central difference formula (CDF). This formula can also be derived
using Taylor’s series expansion. These FDF, BDF and CDF are the simplest approach
to find derivative in case of a straight line case. But one does not have a straight
line always, in such cases interpolating polynomial is used to find the derivative.

Derivation using Taylor’s series


1. Approximation of a derivative in one variable
The first derivative from calculus can be simply written as
df f ðx + hÞ − f ðxÞ
= f 'ðxÞ ≈ lim (A:1)
dx h!0 h

For a finite value of h, the approximation of the derivative can be written as

f ðx + hÞ − f ðxÞ
f 'ðxÞ ≈ + ΔE (A:2)
h
where ΔE is the error. This formula is the general “finite difference formula” for first derivative. If
we want to estimate the error ΔE, we should consider the Taylor’s series expansion of x+h around
the neighbourhood x as
h2 h3 h4 iv
f ðx + hÞ = f ðxÞ + hf 'ðxÞ + f ''ðxÞ + f '''ðxÞ + f ðxÞ + . . . (A:3)
2! 3! 4!
which can also be rewritten as

f ðx + hÞ − f ðxÞ h2 h3 h4 iv
f 'ðxÞ = − f ''ðxÞ − f '''ðxÞ − f ðxÞ − . . . (A:4)
h 2! 3! 4!
Equation (A.2) was obtained by truncating all the terms but first two terms in eq. (A.4). Since the
approximation of the derivative of x above is based on the the values of x and x and x+h, this is
called forward difference formula. Here ΔE as can be seen as a function of h, can be reduced to
eq. (A.1) by truncating ΔE term, hence ΔE is also called truncation error. so
h
ΔE = f ''ðxÞ (A:5)
2
8.1 Introduction 133

Similarly if the Taylor’s series expansion (eq. (A.3)) is written in the neighbourhood of x–h then we
have
h2 h3 h4 iv
f ðx − hÞ = f ðxÞ − hf 'ðxÞ + f ''ðxÞ − f '''ðxÞ + f ðxÞ + . . . (A:6)
2! 3! 4!
which can be rewritten as

f ðxÞ − f ðx − hÞ h2 h3 h4 iv
f 'ðxÞ = + f ''ðxÞ − f '''ðxÞ + f ðxÞ + . . . (A:7)
h 2! 3! 4!
Again retaining only first two terms we get,

f ðxÞ − f ðx − hÞ h2
f 'ðxÞ = + f ''ðxÞ (A:8)
h 2!
which is of the form

f ðxÞ − f ðx − hÞ
f 'ðxÞ = + ΔE (A:9)
h
Where ΔE is the truncation error.

f ðxÞ − f ðx − hÞ
f 'ðxÞ = (A:10)
h
Equation (A.10) is known as the BDF and ΔE is its truncation error which is same as in eq. (A.5). So
far we have assumed that f’(x) is continuous, now assume that f’’(x) is also continuous. A three
term Taylor’s series expansion of f(x) about the point x+h and x–h, respectively, is as follows
h2 h3
f ðx + hÞ = f ðxÞ + hf 'ðxÞ + f ''ðxÞ + f '''ðxÞ (A:11)
2! 3!

h2 h3
f ðx − hÞ = f ðxÞ − hf 'ðxÞ + f ''ðxÞ − f '''ðxÞ (A:12)
2! 3!
Subtracting (A.12) from (A.11)

h3
f ðx + hÞ − f ðx − hÞ = 2hf 'ðxÞ + ½f '''ðξ 2 Þ + f '''ðξ 3 Þ (A:13)
3!
which on rearranging gives

f ðx + hÞ − f ðx − hÞ h2
f 'ðxÞ = − ½f '''ðξ 2 Þ + f '''ðξ 3 Þ (A:14)
2h 12
So the truncation error in eq. (A.14) is

h2
ΔE = − ½f '''ðξ 2 Þ + f '''ðξ 3 Þ (A:15)
12
Also according to the intermediate theorem

1
f '''ðξÞ = ½f '''ðξ 2 Þ + f '''ðξ 3 Þ (A:16)
2
So

h2
ΔE = − f '''ðξÞ (A:17)
6
134 Chapter 8 Numerical differentiation

ΔE is the truncation error for two points CDF. Hence, eq. (A.14) becomes

f ðx + hÞ − f ðx − hÞ h2
f 'ðxÞ = − f '''ðξÞ (A:18)
2h 6
Hence, eq. (A.18) is a second-order approximation of first derivative. Likewise, other higher order
approximations of derivative can be derived using Taylor’s series expansion:

f ðx + hÞ − f ðx − hÞ
f 'ðxÞ = (A:19)
2h
Formula (A.19) is known as CDF.

Interpolating polynomials are the general expression of polynomials that are used to
approximate the function f(x) which is then used to find the derivative by differentiat-
ing the polynomial directly. There are many ways to estimate derivative using interpo-
lation polynomial. Interpolation can thus also be used to estimate the value between
a set of data. For this, first determine the appropriate interpolating polynomial for
the given data. To carry out numerical differentiation, three types of interpolating
polynomials, namely, Newton’s interpolating polynomial, Stirling’s polynomial
and Lagrange’s polynomial are used.
(a) When the data points are equidistant then
(1) Newton’s forward interpolation formula is used to find the derivative (near
the beginning of the table).
(2) Newton’s backward interpolation polynomial is used to find the derivative
(near the end of the table)
(3) Stirling’s formula is used to find the derivative (near the centre of the table).

(b) When the data points are not equidistant then


(1) Newton’s divided difference interpolation formula is used.
(2) Lagrange’s interpolation formula is used to find the derivative.

While if the data points are very far from each other, then Richardson extrapolation
is used to find the derivative.

8.2 Derivatives using Newton’s forward interpolation polynomial

Newton’s forward interpolation formula is used to interpolate values of [x,y(x)] near


the beginning of the data set values (xi, y(xi)). Newton’s forward interpolation for-
mula (also called Newton–Gregory formula) is given by

pðp − 1Þ 2 pðp − 1Þðp − 2Þ 3 pðp − 1Þðp − 2Þðp − 3Þ 4


y ≡ y0 + pΔy0 + Δ y0 + Δ y0 + Δ y0 + . . .
2! 3! 4!
(8:7)
8.2 Derivatives using Newton’s forward interpolation polynomial 135

x−x
where p = h 0 , y0 is the first value of the data set. Δy0 is the difference between two
consecutive y values while Δ2y0 is the difference between two Δy0 values and so on.
To find the derivative, the function y is differentiated with respect to p:

dy 2p − 1 2 3p2 − 6p + 2 3 4p3 − 18p2 + 22p − 6 4


= Δy0 + Δ y0 + Δ y0 + Δ y0 + . . . (8:8)
dp 2! 3! 4!
Also one may write

dy dy dp
= (8:9)
dx dp dx

dp 1
Since =
dx h
 
dy 1 2p − 1 2 3p2 − 6p + 2 3 4p3 − 18p2 + 22p − 6 4
= Δy0 + Δ y0 + Δ y0 + Δ y0 + . . . (8:10)
dx h 2! 3! 4!

At x = x0, p = 0
  
dy 1 Δ2 y0 Δ3 y0 Δ4 y0
= Δy0 − + − + ... (8:11)
dx x = x0 h 2! 3! 4!

Similarly
   
d2 y d dy d dy dp
= = . (8:12)
dx2 dx dx dp dx dx
  
d2 y 1 11 4 5 5
= Δ y0 − Δ y0 + Δ y0 − Δ y0 + ...
2 3
(8:13)
dx2 x = x0 h2 12 6

dy
For finding the maxima and minima of a function, dx = 0.
1/h ≠ 0, hence ignoring the higher order terms in eq. (8.10), a quadratic equa-
tion is obtained of the form

a + bp + cp2 = 0 (8:14)

Solving for p gives the maxima/minima of the function y = f(x) where x = x0 + ph.

Example 1: Find the derivative dy/dx at x = 2 using the given data points.

x      

y −     

Solution: Since the data points are equidistant (equally spaced x’s value) and the derivative is to
be found at the beginning of the table (at x = 1), Newton’s forward interpolating polynomial is used.
The given data points may be further tabulated in Table 8.1.
136 Chapter 8 Numerical differentiation

Table 8.1: Newton’s forward difference interpolating formula.

x y Δy0 Δ2y0 Δ3y0 Δ4y0

0 −7
5
1 −2 2
7 0
2 5 2 0
9 0
3 14 2 0
11 0
4 25 2 0
13 0
5 38 2
15
6 53

  
dy 1 Δ2 y0 Δ3 y0 Δ4 y0
= Δy0 − + − + ...
dx x = x0 h 2! 3! 4!
  
dy 1 2 0
= 7− +
dx x = 1 1 2! 3!

dy
=6
dx x = 1
One may also interpolate the given data and using curve fitting technique, and the general polyno-
mial equation for this data is y = x 2 + 4x − 7 for which the derivative is y' = 2x + 4, hence, the solution.

Example 2: The following data of a first-order reaction was given as follows:

t/s      , ,

ln[A] . . . . . . .

Find the slope dy/dx which gives rate constant at t = 200 s.


Solution: For first-order reactions, the integrated rate expression is given by

½At 
ln = − kt (8:15)
½A0 
Slope can give the rate constant when a graph between ln[A] versus t is plotted. Since the derivative
is to be found out at the start of the observation table (t = 200 s), the Newton’s forward interpolation
formula for derivative is used and the Newton’s forward difference construction table is constructed
(Table 8.2).
8.3 Derivatives using Newton’s backward interpolating polynomial 137

Table 8.2: Newton’s forward difference formula for kinetics data.

t=x [A] y = ln[A] Δy Δy2 Δy3 Δy4 Δy5 Δy6

0 0.25 −1.386
−0.114
200 0.223 −1.500 −0.004
−0.118 −0.005
400 0.198 −1.619 −0.010 0.010
−0.129 0.004 −0.0007
0.174 600 −1.748 −0.005 0.010 −0.0200
−0.135 0.015 −0.0192
0.152 800 −1.883 0.009 −0.008
−0.126 0.006
0.134 1,000 −2.009 0.015
−0.110
0.12 1,200 −2.120

  
dy 1 ð − 0.010Þ 0.004 0.010 ð − 0.01929Þ
= − 0.118 − + − +
dx t = 200 200 2 6 24 60

dy
= − 0.0005689
dx t = 200

Hence, k200 = 0.0005825 s − 1 .


Analytically solving from the given data, the rate constant is found to be 0.000650 s−1 which is
almost the same as found by numerical differentiation.
There would always be some difference between the analytical answer and the answer obtained
by numerical methods since they all are approximate methods.

8.3 Derivatives using Newton’s backward interpolating polynomial

If the data point is to be estimated near the end of the data table, then Newton’s back-
ward interpolating polynomial is used which is

pðp − 1Þ 2 pðp − 1Þðp − 2Þ 3 pðp − 1Þðp − 2Þðp − 3Þ 4


y = y0 + pΔy0 + Δ y0 + Δ y0 + Δ y0 + . . .
2! 3! 4!
(8:16)
dy dy dp
= (8:9)
dx dp dx
 
1 2p + 1 2 3p2 + 6p + 2 3 4p3 + 18p2 + 22p + 6 4
y= Δy0 + Δ y0 + Δ y0 + Δ y0 + . . . (8:17)
h 2! 3! 4!
138 Chapter 8 Numerical differentiation

At x = x0 , p = 0
#  
dy 1 Δ2 y0 Δ3 y0 Δ4 y0
= Δy0 + + + + ... (8:18)
dx h 2 3 4
x = x0
   
d2 y d dy d dy dp
= = . (8:12)
dx2 dx dx dp dx dx

Similarly
  
d2 y 1 11 4 5 5
= Δ2
y 0 + Δ 3
y0 + Δ y0 + Δ y0 + . . . (8:19)
dx2 x = x0 h2 12 6

Example 3: Calculate the derivative dy/dx at x = 1.5 from the following data:

x  . . . . . .

y . . . . . . .

Solution: Since the derivative needs to be calculated at the end of the table, Newton’s backward
difference polynomial (Table 8.3) for calculating derivative is used (eq. (8.18)).

Table 8.3: Newton’s backward difference interpolation formula for calculating derivative.

x y Δy0 Δ2y0 Δ3y0 Δ4y0 Δ5y0 Δ6y0

1 7.989
0.414
1.1 8.403 −0.036
0.378 0.006
1.2 8.781 −0.03 −0.002
0.348 0.004 0.001
1.3 9.129 −0.026 −0.001 0.002
0.322 0.003 0.003
1.4 9.451 −0.023 0.002
0.299 0.005
1.5 9.75 −0.018
0.281
1.6 10.031

  
dy 1 Δ2 y0 Δ3 y0 Δ4 y0
= Δy0 + + + + ...
dx x = x0 h 2! 3! 4!
  
dy 1 ð − 0.023Þ 0.03 ð − 0.001Þ 0.001
= 0.299 + + + +
dx x = 1.5 0.1 2 3 4 5

dy
= 2.884
dx x = 1.5
8.4 Derivatives using Stirling interpolating polynomial 139

Example 4: Using Example 2, calculate the derivative at t = 1,000 s.


Solution: Since the derivative needs to be calculated at the end of Table 8.4, Newton’s backward
difference polynomial would be used.

Table 8.4: Newton’s backward difference interpolation formula.

Using the Newton backward interpolating polynomial as

  
dy 1 0.009 0.015 0.010 ð0.0007Þ
= − 0.126 + + + +
dx t = 1, 000 200 2 3 4 5

dy
= − 0.0005680
dx t = 1, 000

k1, 000 = 0.0005680 s − 1

8.4 Derivatives using Stirling interpolating polynomial

The Stirling formula computes the average of values obtained by Gauss forward
and backward interpolation. The condition for using Stirling’s formula is −1/2 < p <
1/2. The formula is given as
   
Δy0 + Δy − 1 p2 pðp2 − 1Þ Δ3 y − 1 + Δ3 y − 2
y ≡ y0 + p + Δ2 y − 1 +
2 2! 3! 2
 5  (8:20)
p ðp − 1Þ 4
2 2
pðp − 1Þðp − 2 Þ Δ y − 3 + Δ y − 2
2 2 2 5
+ Δ y−2 + + ...
4! 5! 2
x − x0
where p =
h
140 Chapter 8 Numerical differentiation

Differentiating the above equation with respect to p,


   
dy Δy0 + Δy − 1 3p2 − 1 Δ3 y − 1 + Δ3 y − 2 4p3 − 2p 4
= + pΔ y − 1 +
2
+ Δ y − 2 + . . . (8:21)
dp 2 3! 2 4!
dp 1
Also = , so
dx h
dy dy dp
= . (8:9)
dx dp dx

Therefore, we get
    
dy 1 Δy0 +Δy − 1 3p2 −1 Δ3 y − 1 +Δ3 y −2 4p3 −2p 4
= + pΔ2 y − 1 + + Δ y −2 + ... (8:22)
dx h 2 3! 2 4!

At x = x0, p = 0
       
dy 1 Δy0 + Δy − 1 1 Δ3 y − 1 + Δ3 y − 2 1 Δ5 y − 2 + Δ5 y − 3
= − + − . . . (8:23)
dx x = x0 h 2 6 2 30 2

Similarly
  
d2 y 1 1 4 1 6
= Δ2
y −1 − Δ y −2 + Δ y −3 − . . . (8:24)
dx2 x = x0 h2 12 90

Example 5: Find the derivative dy/dx at x = 0.3.


Solution: Since here in this example, the derivative needs to be found at the mid of the data table,
Stirling’s interpolation polynomial (Table 8.5) will be used (eq. (8.23)).

x  . . . . . .


y  . . . . . .

Table 8.5: Stirling’s interpolation formula to find derivative.

x Y Δy Δy Δy Δy Δy Δy

 
.
. . −.
−. −.E–
. . −. .E–
−. .E– −.E–
. . −.  .E–
−. .E– −.E–
. . −. −.E–
8.4 Derivatives using Stirling interpolating polynomial 141

Table 8.5 (continued )

x Y Δy Δy Δy Δy Δy Δy

−. −.E–
. . −.
−.
. .

       
dy 1 Δy0 + Δy − 1 1 Δ3 y − 1 + Δ3 y − 2 1 Δ5 y − 2 + Δ5 y − 3
= − + − ...
dx h 2 6 2 30 2
    − 16 
dy 1 − 0.1 + ð − 0.172Þ 1 4.440 × 10 + 4.440 × 10 − 16
= −
dx x = 0.3 0.1 2 6 2
 
1 − 1.77 × 10 − 15 + ð8.88 × 10 − 16 Þ
+
30 2

dy
= − 1.36
dx x = 0.3

Example 6: For the reversible reaction

A !B
The rate of change of A is as follows:

Time (h)      ∞

%A  . . . . 




A −A
where the reaction follows the first-order kinetics with ln eqAeq = − ðk1 + k − 1 Þt where Aeq and A are
the equilibrium concentration and concentration at any time t. Calculate the rate constants for both
forward and backward reaction and the equilibrium constant.
Solution: Since in this example, the data is given for concentration of A and we need log term as


A −A
ln eq
Aeq so before applying the method of numerical differentiation in terms are calculated as in
Table 8.6.

Table 8.6: Kinetics data for reversible reaction.

Time (h)      ∞

%A  . . . . 


 
Aeq − A  −. −. −. −. –
ln
Aeq
142 Chapter 8 Numerical differentiation

As no particular data point is given to calculate the derivative, it is calculated at the middle inter-
val. Calculating the derivative at the interval of 2 h using Stirling’s polynomial method of derivative
(Table 8.7), we may depict the same as h = 1 h:
     
dy 1 Δy0 + Δy − 1 1 Δ3 y − 1 + Δ3 y − 2
= − + ...
dx
t = 2h h 2 6 2
    
dy 1 − 0.4605 + ð − 0.5409Þ 1 − 0.1191 + 0.1267
= −
dx t = 2h 1 2 6 2

dy
= − 0.5013
dx t = 2h

Table 8.7: Stirling’s interpolation polynomial for kinetics data.

xi yi Δy Δy Δy Δy

 .
−.
 −. .
−. −.
 −. −. .
−. .
 −. .
−.
 −.

where the slope graphically is found to be –0.4991.


k1 ½Beq
Also K = k−1 = ½Aeq = 70
30 = 2.333

Hence substituting the known values in the relationship, we get


k1 = 0.3506 h − 1 , k1 = 0.1502 h − 1

Higher order derivatives can be found out by subsequently differentiating the previ-
ous derivatives. Numerical differentiation using Stirling’s polynomial is more accu-
rate as compared to Newton’s polynomial. When the points are usually unequally
spaced, Newton’s divided difference polynomial and Lagrange’s polynomial is used.

8.5 Newton’s divided difference polynomial

When the intervals are unequispaced, then Newton’s divided difference interpola-
tion formula is used which is
f ðxÞ = f ðx0 Þ + ðx − x0 Þ f ½x0 , x1  + ðx − x0 Þðx − x1 Þ f ½x0 , x1 , x2 
(8:25)
+ ðx − x0 Þðx − x1 Þðx − x2 Þ f ½x0 , x1 , x2 , x3  + . . .
8.5 Newton’s divided difference polynomial 143

y1 − y0
where f ½x0 , x1  =
x1 − x0
Δy2 − Δy0
similarly f ½x0 , x1 , x2  =
x2 − x0

The earlier equation is then differentiated with respect to x to find the derivative at the
particular point. Apart from Newton’s divided difference polynomial, Lagrange’s poly-
nomial is also used for interpolation of data points which are at unequal intervals.

Example 7: Using the given data, evaluate dy/dx at x = 6.

X      

Y      

Solution: Since data points are not equally spaced, the table for Newton’s divided difference table
(Table 8.8) for interpolation is constructed.

Table 8.8: Newton’s divided difference formula for interpolation.

x y f[x,x] f[x,x,x] f[x,x,x,x] f[x,x,x,x,x]

 
26 − 4
= 11
2−0
32 − 11
  =7
3−0
58 − 26 11 − 7
= 32 =1
3−2 4−0
54 − 32
  = 11 
4−2
112 − 58 16 − 11
= 54 =1
4−3 7−2
118 − 54
  = 16 
7−3
466 − 112 22 − 16
= 118 =1
7−4 9−3
278 − 118
  = 22
9−4
922 − 466
= 278
9−7
 

Using eq. (8.25)

f ðxÞ = 4 + ðx − 0Þ11 + xðx − 2Þ7 + xðx − 2Þðx − 3Þ1

f ðxÞ = x 3 + 2x 2 + 3x + 4

f 'ðxÞ = 3x 2 + 4x + 3
f 'ðxÞx = 6 = 108 + 24 + 3 = 135
144 Chapter 8 Numerical differentiation

8.6 Lagrange’s polynomial

For the given data points x1, x2, x3, . . ., xn where they are not at equidistant, the
Lagrange’s interpolating polynomial for the points (x1,y1), (x2,y2), (x3,y3),. . ., (xn,yn)
is given by

LðxÞ = Lðx1 Þf ðx1 Þ + Lðx2 Þf ðx2 Þ + Lðx3 Þf ðx3 Þ (8:26)


ðx − x2 Þðx − x3 Þ ðx − x1 Þðx − x3 Þ ðx − x1 Þðx − x2 Þ
LðxÞ = f ðx1 Þ + f ðx2 Þ + f ðx3 Þ (8:27)
ðx1 − x2 Þðx1 − x3 Þ ðx2 − x1 Þðx2 − x3 Þ ðx3 − x1 Þðx3 − x2 Þ

The derivative of the function is the derivative of the Lagrange’s polynomial itself;
hence, we can write

f 'ðxÞ = L'ðxÞ = L'ðx1 Þf ðx1 Þ + L'ðx2 Þf ðx2 Þ + L'ðx3 Þf ðx3 Þ (8:28)


2x − x2 − x3 2x − x1 − x3 2x − x1 − x2
f 'ðxÞ ≈ f ðx1 Þ + f ðx2 Þ + f ðx3 Þ (8:29)
ðx1 − x2 Þðx1 − x3 Þ ðx2 − x1 Þðx2 − x3 Þ ðx3 − x1 Þðx3 − x2 Þ

So if we want to find derivative at x1 then


2x1 − x2 − x3 x1 − x3 x1 − x2
f 'ðx1 Þ ≈ f ðx1 Þ + f ðx2 Þ + f ðx3 Þ (8:30)
ðx1 − x2 Þðx1 − x3 Þ ðx2 − x1 Þðx2 − x3 Þ ðx3 − x1 Þðx3 − x2 Þ

If we consider the forward difference points such that x1 = x, x2 = x + h and x2 = x + 2h:


−3 4 1
f 'ðxÞ ≈ f ðx1 Þ + f ðx2 Þ − f ðx3 Þ (8:31)
2h 2h 2h

which can also be written as

− 3f ðxÞ + 4f ðx + hÞ − f ðx + 2hÞ
f 'ðx1 Þ ≈ (8:32)
2h

This is known as three-point FDF.


The second derivative can also be written by differentiating the equation again
and we get the general formula as
1
f ''ðxi Þ ≈ ½f ðxi + 1 Þ − 2f ðxi Þ + f ðxi − 1 Þ (8:33)
h2

The above is the three-point FDF to find derivative in ith position. If we take the four
points x0, x1, x2, x3, then similarly the second derivative can also be found out as

2½ðx − x1 Þ + ðx − x2 Þ + ðx − x3 Þ 2½ðx − x0 Þ + ðx − x2 Þ + ðx − x3 Þ
f ''ðxÞ ≈ L''ðxÞ = f ðx0 Þ + f ðx1 Þ
ðx0 − x1 Þðx0 − x2 Þðx0 − x3 Þ ðx1 − x0 Þðx1 − x2 Þðx1 − x3 Þ

2½ðx − x0 Þ + ðx − x1 Þ + ðx − x3 Þ 2½ðx − x0 Þ + ðx − x1 Þ + ðx − x2 Þ
+ f ðx2 Þ + f ðx3 Þ (8:34)
ðx2 − x0 Þðx2 − x1 Þðx2 − x3 Þ ðx3 − x0 Þðx3 − x1 Þðx3 − x2 Þ
8.6 Lagrange’s polynomial 145

Considering the forward differences as

x0 = x, x1 = x + h, x2 = x + 2h and x3 = x + 3h we get

2f ðxÞ − 5f ðx + hÞ + 4f ðx + 2hÞ − f ðx + 3hÞ


f ''ðxÞ ≈ (8:35)
h2

The earlier formula is referred to as four-point FDF for second derivative.

Example 8: Using the given data, find the derivative using Lagrange’s polynomial (Table 8.9).

Table 8.9: Lagrange’s polynomial for interpolation for unequispaced data points.

N    

xn −   

yn = f(xn) −   

Solution: Lagrange’s polynomial for interpolation can be written as

P2 ðxÞ = L0 ðxÞf ðx0 Þ + L1 ðxÞf ðx1 Þ + L2 ðxÞf ðx2 Þ + L3 ðxÞf ðx3 Þ (8:36)
where

ðx − x1 Þðx − x2 Þðx − x3 Þ −1 3
L0 ðxÞ = = ðx − 12x 2 + 39x − 28Þ
ðx0 − x1 Þðx0 − x2 Þðx0 − x3 Þ 80
ðx − x0 Þðx − x2 Þðx − x3 Þ 1 3
L1 ðxÞ = = ðx − 10x 2 + 17x + 28Þ
ðx1 − x0 Þðx1 − x2 Þðx0 − x3 Þ 36
ðx − x0 Þðx − x1 Þðx − x3 Þ −1 3
L2 ðxÞ = = ðx − 7x 2 − x + 7Þ
ðx2 − x0 Þðx2 − x1 Þðx2 − x3 Þ 45
ðx − x0 Þðx − x1 Þðx − x2 Þ 1
L3 ðxÞ = = ðx 3 − 4x 2 − x + 4Þ
ðx3 − x0 Þðx3 − x1 Þðx3 − x2 Þ 144
Substituting the values of (xn,yn), one may write

−1 3 1 3
P3 ðxÞ = ðx − 12x 2 + 39x − 28Þð − 2Þ + ðx − 10x 2 + 17x + 28Þð0Þ +
80 36
−1 3 1
ðx − 7x 2 − x + 7Þð63Þ + ðx 3 − 4x 2 − x + 4Þð342Þ (8:37)
45 144
P3 ðxÞ = x 3 − 1 (8:38)

P3 0 ðxÞ = 3x 2 (8:39)
P3 ð5Þ = 75
146 Chapter 8 Numerical differentiation

Example 9: Find the derivative dP/dV using the given data for van der Waal’s gas.

x x x x

x    

y = f(x) . . . .

Solution: Here the points are not equidistant; hence, the derivative can be found out using either
Newton divided difference formula or Lagrange’s polynomial. Hence, using the Newton divided dif-
ference formula as (Table 8.10)

f ðxÞ = f ðx0 Þ + ðx − x0 Þf ½x0 , x1  + ðx − x0 Þðx − x1 Þf ½x0 , x1 , x2  + ðx − x0 Þðx − x1 Þðx − x2 Þf ½x0 , x1 , x2 , x3  + ....

Table 8.10: Newton’s divided difference interpolation polynomial data.

Substituting the requisite values

P = f ðVÞ = f ðV0 Þ + ðV − V0 Þf ½V0 , V1  + ðV − V0 ÞðV − V1 Þf½V0 , V1 , V2 


P = 2224.24 − ðV − 1Þ1049.39 + ðV − 1ÞðV − 2Þ254.54 − ðV − 1ÞðV − 2ÞðV − 3Þ49.66
and differentiating with respect to V by subsuming V = 1, one gets

dP=dV = − 1452.9303
It means that pressure decreases with increase in volume which is nothing but Boyle’s law.
Similarly using the Lagrange’s polynomial for interpolation for unequal spaces as

ðx − x1 Þðx − x2 Þ ðx − x2 Þðx − x3 Þ ðx − x1 Þðx − x3 Þ ðx − x1 Þðx − x2 Þ


LðxÞ = f ðx0 Þ + f ðx1 Þ + f ðx2 Þ + f ðx3 Þ
ðx0 − x1 Þðx0 − x2 Þ ðx1 − x2 Þðx1 − x3 Þ ðx2 − x1 Þðx2 − x3 Þ ðx3 − x1 Þðx3 − x2 Þ
Here using x0, x1, x2 and x3 = 1, 2, 4 and 5, respectively, we get

ðx − 2Þðx − 4Þðx − 5Þ ðx − 1Þðx − 4Þðx − 5Þ ðx − 1Þðx − 2Þðx − 5Þ


l0 ðxÞ = , l1 ðxÞ = , l2 ðxÞ =
− 12 6 −6
ðx − 1Þðx − 2Þðx − 4Þ
l3 ðxÞ =
12
Substituting back in earlier formula for L(x) and differentiating with respect to x and substituting
the values of the requisite function values at x = 1, we get –1452.9303.
8.7 Richardson’s extrapolation 147

Both the methods give the same answer. When solved analytically using the Van der Waal’s
equation derivative, the answer is −1975.83. Being approximate methods, again the answer ob-
tained numerically will most of the times differ from conventional answer.

8.7 Richardson’s extrapolation

Sometimes when we use the data points that are not very close (Figure 8.2), for ex-
ample, xi and xi +1 and try to find the derivative or slope we get large amount of
error. It is so because the difference between the interval (h) of x is very large.

xi+1, yi+1

xi, yi

xi xi+1

Figure 8.2: Richardson’s extrapolation when data points are very far from each other.

If we reduce the h value, the slope value will improve like Figure 8.3.

xi+1,yi+1

xi,yi

xi+2,yi+2

xi xi+2 xi+1

Figure 8.3: Decreasing the interval size.


148 Chapter 8 Numerical differentiation

Now we can see that when the interval was reduced the slope of the line improves
and one gets less error. Hence one can say that the accuracy of the method for esti-
mating the derivative or integral of the function f(x) depends on the spacing between
points at which the integral is evaluated. The approximation tends to improve as the
spacing tends to zero.
With h being the uniform spacing, the data points may be approximated by the
expression as
 
f ðxi + h Þ − f ðxi − h Þ h2
DðhÞ = f 'ðxi Þ = − f ''ðxÞ + Oðh4 Þ (8:40)
2h 6

D(h) is the approximated value by using CDF with step size h. Similarly we can
write the formula when the interval is h/2 as
 
f ðxi + h=2 Þ − f ðxi − h=2 Þ h2
Dðh=2Þ = f 'ðxi Þ = − f ''ðxÞ + Oðh4 Þ (8:41)
2ðh=2Þ 64

D(h/2) is the approximated value by using CDF with step size h/2, solving the earlier
two equations we get

4Dðh=2Þ − DðhÞ
D= (8:42)
3

D is the improved estimate or true value. This process of extrapolation from D(h)
and D(h/2) to approximate D with a higher order accuracy is called Richardson’s
extrapolation. The earlier formula explains the computation of approximation that
is fourth-order accurate. This method is further extended to achieve greater accu-
racy up to order of O(h6), O(h8) and so on. The general formula for orders O(h6) or
higher than that is

4k Dk − 1 ðh=2Þ − Dk − 1 ðhÞ
Dk ðhÞ = (8:43)
4k − 1

Example 10: Using the following data (Table 8.11), calculate derivative f'(x2) where h = 2.

Table 8.11: Richardson’s extrapolation.

n     

xn     
yn     
8.8 Problems for practice 149

Solution: Using Richardson extrapolation,

1
DðhÞ = f 'ðx2 Þ = ½f ðx2 + hÞ − f ðx2 − hÞ
2h
1
DðhÞ = f 'ðx2 Þ = ½f ð5Þ − f ð1Þ
4
1
DðhÞ = f 'ðx2 Þ = ½32 − 2 = 7.5
4
Similarly calculating D(h/2)
    
1 h h
Dðh=2Þ = f 'ðx2 Þ = h
f x2 + − f x2 −
22 2 2

1
Dðh=2Þ = f 'ðx2 Þ = ½f ð4Þ − f ð2Þ
2
1
Dðh=2Þ = f 'ðx2 Þ = ½16 − 4 = 6
2
Hence using eq. (8.41),

4Dðh=2Þ − DðhÞ
D=
3
4 × 6 − 7.5 16.5
D= = ≈ 5.5
3 3
The actual function is y = 2x, whose derivative y' = 2x lnj2j ≈ 5.5443.
This formula was to obtain an accuracy of fourth order. One may also achieve accuracy of higher
order.

8.8 Problems for practice


dy d y 2
1. Find the derivative dx and dx2 at x = 5 using the given data points.

x      

y −     

2. Using the Stirling’s polynomial for interpolating derivatives, find the most
probable speed in Maxwell’s distribution curve here:
1, ð
200

m 3=2  
1 dN − Mu2
= 4πu 2
exp
N du 2πRT 2RT
0
150 Chapter 8 Numerical differentiation

u      , , ,

1 dN  . . . . . . 


=y
N du

3. Using the given data, find x where y is maximum.

x      

y . . . . . .

4. Find dy/dx at x = 1 using the following data:

x     

y     
Chapter 9
Numerical root-finding methods

9.1 Introduction

In chemistry, we often come across lengthy and complicated polynomial equations,


which are difficult to solve analytically. According to algebra, a root is the zero of
the function, that is, where the function f(x) is zero. There are three ways to solve
the equations, namely analytically, graphically and numerically. Numerical meth-
ods of finding roots of the equations is the most robust way of solving even very
complicated equation with a great degree of ease. The most important technique in
any numerical method is the iteration. Generally, an approximation of an expected
value is taken and an algorithm is applied which further improves the approxima-
tion. This step is repeated until the approximation yields almost the same value.
Numerical methods are particularly useful while solving the intensive polynomial
for their roots.
These are the following numerical methods to find roots of an equation:
1. Newton–Raphson method
2. Iteration method
3. Binary bisection method
4. Secant method
5. Regula-Falsi method

Each of the above-mentioned methods is discussed at length in the subsequent sec-


tions with their drawbacks and advantages.

9.2 Newton–Raphson method

Newton–Raphson (also called Newton’s iteration or Newton’s technique) is the most


widely used root-finding algorithm of nonlinear equations or real-valued single vari-
able functions (f(x) = 0). It uses an iterative method to approach the root of equation
by arbitrarily choosing any root which is close to the real root.
N-R method converges quadratically as we approach the root. It needs only one
initial guess value for the root. This method involves expansion of Taylor series of a
function f(x) in the vicinity of suspected root and only first few terms (usually up
to second term) of the Taylor series are retained to find the real root. Hence, trunca-
tion at second term gives the estimate of the root.

https://doi.org/10.1515/9783110695328-009
152 Chapter 9 Numerical root-finding methods

For N-R method, function f(x) can be written using a Taylor’s expansion as

h2
f ðx0 + hÞ = f ðx0 Þ + hf 'ðx0 Þ + f ''ðx0 Þ +    = 0 (9:1)
2!
where f’(x0) and f’’(x0) are the first and second derivatives of f(x0) with respect to
x and h = x–x0. Since h⋘1, h2 can be neglected; hence, one may write

f ðx0 Þ + hf 'ðx0 Þ = 0 (9:2)

which gives

f ðx0 Þ
h= (9:3)
f 'ðx0 Þ

Therefore,

f ðx0 Þ
x = x0 − (9:4)
f 'ðx0 Þ

Hence, the successive approximations for Newton–Raphson method can be written


as a general formula

f ðxn Þ
xn + 1 = xn − (9:5)
f 'ðxn Þ

This equation is nothing but the equation of the tangent to the function f(x) at x = xn
which is extrapolated to x-axis to get xn +1 (first approximate root). Consider the
function f(x) which is continuous such that f’(x) ≠ 0.

Slope = f ′ (xn)

f (xn)

z xn+1 xn

Figure 9.1: Tangent to the curve to approximate the root.

This method assumes that functions that have continuous derivatives and look like
straight lines when looked closely can be approximated by a tangent to it. Assuming
9.2 Newton–Raphson method 153

f(x) has a continuous derivative, f ’(x) can be computed. Since f ’(x) ≠ 0, it implies that
any point on the f(x) curve will be a straight line. The function at (xn, f(xn)) can be
approximated by a straight line that is tangent to the curve at that point (Figure 9.1).
The slope of the line is f ’(x) which passes through (xn, f(xn)). Therefore, the equation
of the tangent line is

y − y1 = mðx − x1 Þ (9:6)

y − f ðxn Þ = f 'ðxn Þðx − xn Þ (9:7)

The tangent crosses the x-axis at x = xn +1, at which y = 0; hence,

0 − f ðxn Þ = f 'ðxn Þðxn + 1 − xn Þ (9:8)

which may be rearranged as

f ðxn Þ
xn + 1 = xn − (9:5)
f 'ðxn Þ

which is same as obtained earlier. Hence, the first approximation xn has improved
to xn +1, which is much nearer to the real root z. This approximation may then be
used to find another approximation until the real root (z) is reached. N-R greatly
depends upon the initial guess value, so the starting guess value should be chosen
carefully such that x0 is close to the original root z.
When the difference between the successive iterates is small enough to follow
|xn +1 – xn| < εabs, then xn +1 is the approximate root of the equation. Also if f(xn +1) is
sufficiently small enough such that |f(xn +1)| ≈ 0, then xn +1 is the approximation to
the root.

Example 1: Using N-R method, find the approximate root for the following function f(x):

f ð x Þ = x 2 + 5x − 3 = 0 (9:9)
Solution: The above function can be solved graphically (Figure 9.2) as well as numerically. The
roots are those which cut the x-axis, where f(x) = 0. The order of polynomial refers to the number of
roots the function has, which is two here. Graphically, it may be pointed that root lies between
[0,2] and another root between [–4,–6]. For the above function f(x), its derivative f’(x) = 2x + 5.
We can find both roots by employing N-R method using two different guesses. Taking the initial
guess x0 = 2, the results are tabulated in Table 9.1.
154 Chapter 9 Numerical root-finding methods

50

f (x)
f(x) = x2 + 5x – 3
40

30

20

10

0
–8 –6 –4 –2 0 x 2 4 6

–10

–20

Figure 9.2: Solving f (x) graphically.

Table 9.1: N-R method to solve f(x) = x2 + 5x–3.

N xn xn + f(x) f ’(x) εabs

  .   .

 . . . . .

 . . . . .

 . . .E- . .E-

 . . .E- . 

As evident from the table, f(x) becomes zero at the fifth iteration. Also at fifth iteration, difference be-
tween (xn +1−xn) = 0, so one of the roots is 0.5413812651. The difference between two roots is less than
0.000001(εabs) or even becomes zero on successive iterations. Similarly, when another guess is taken
which is close enough to another root, the another root is found to be −5.541381265 (Table 9.2).

Table 9.2: N-R method to find root using another guess value for f(x) = x2 + 5x–3.

N xn xn + f(x) f ’(x) εabs

 − − − − 

 − −.  − .

 −. −. . −. .

 −. −. . −. .

 −. −. . −. .


9.2 Newton–Raphson method 155

Table 9.2 (continued )

N xn xn + f(x) f ’(x) εabs

 −. −. . −. .

 −. −. .E- −. .E-

Although N-R is a very good method for approximating the roots, there are
some limitations. N-R method may fail if
(1) The approximation initial value (guess) is very far from the real root.
(2) The derivative of function is bit complicated. For example

f ðxÞ = sinðcosðex ÞÞ and f ’ððxÞ = − ex sinðex Þcosðcosðex ÞÞ


In such cases, secant method serves as a saviour where instead of a tangent
line a secant is used.
(3) It may also not converge if the second derivative is very large or if the derivative
at xn is near to zero.
(4) There is local maxima or minima or point of inflection around the root.

pffiffiffi
Example 2: Find an approximation of 7 to 10 decimal places.
pffiffiffi pffiffiffi
Solution: 7 is an irrational number, hence, sequence of decimals will be non-stop. z = 7 is the
zero of the equation f(x) = x −7 on the interval [2,3].
2

So, here, using the N-R method having n approximation, the formula used is

f ðx0 Þ
x = x0 −
f 'ðx0 Þ
With the initial guess value be x0 = 2, the approximation is tabulated (Table 9.3).

Table 9.3: N-R method for to approximate.

N xn xn + f(x) f’(x)

  . − 

 . . . .

 . . . .

 . . .E- .

 . . .E- .

pffiffiffi
The correct approximation for 7 when deduced analytically is also found to be same.
156 Chapter 9 Numerical root-finding methods

Example 3: The inversion temperature of van der Waal’s gas can be calculated using the equation
appearing in the Joule–Thomson coefficient as

2a 3abp
− −b=0 (9:10)
RTi R2 Ti2

Calculate the inversion temperature at p = 10.133 MPa for N2 gas for which a = 0.141 MPa dm6 mol−2
and b = 0.0392 dm3 mol−1, R = 0.008314 dm3 MPa K−1 mol−1.
Solution: After rearranging the above equation we get,

ðbR2 ÞTi2 − ð2aRÞTi + 3abp = 0 (9:11)

So here, the above equation looks like a quadratic equation for which N-R method can be conve-
niently used where Ti is a variable like x and the other acts as coefficients (Table 9.4).

Table 9.4: N-R method to solve for inversion temperature.

N Tn Tn +  f(x) f’(x) εabs

  −. . . .

 −. −. −. . .

 −. −. −. . .

 −. . −. . .

 . . −. . .

 . . −. . .

 . . −.E- . .

So, the temperature is 78.8 K. Similarly, giving another guess value gives 786.4 K since there are
two values of T for each value of p.

9.3 Iteration method

Iteration method is also known as the fixed point iteration method. It is one of the
most common and popular methods to find the real roots of a nonlinear equation or
function. It is an open, simple and cyclic type of process to find roots of nonlinear
equations by successive approximation. This method is used to find solution of arith-
metic series, geometric series, Taylor series and many other infinite series. Also known
9.3 Iteration method 157

with the name of an open bracket method or simple enclosure method, this method is
somewhat slower and converges linearly like binary bisection method. But it gives
quite good accuracy. It is a slow method and falls under the open method category
since its convergence is not guaranteed. Its algorithm requires only one guess value
and the equation is solved by the assumed approximation. It is a mathematical proce-
dure that generates approximate solutions for a given problem in which one approxi-
mate solution is derived from the previous one. The iterations are modified at each
successive level with the previous one. Iterative method provides quite accurate ap-
proximations as compared to other methods.
To find the root of nonlinear equation f(x) = 0 by fixed point iteration method,
equation f(x) = 0 is written in the form of x = ϕ(x), that is, a new function is designed
by rearranging the original function in such a manner that the highest order varia-
bles is made to be the dependent variable of x where

jϕ'ðxÞj < 1∀x 2 ða, bÞ (9:12)

where a and b are the intervals in which the root might lie.
Iteration method is valid and converges around the root in the interval which
may be smaller than the interval in which | ϕ’(x)| < 1. The convergence will take place
only for a certain range of x. If the guess value is outside this range then the root will
not converge. When the difference between two successive iteration is sufficiently
small, iterations are stopped, that is, |xn +1−xn| < εabs or until |f(xn +1)–f(xn)| ≈ 0.

Example 4: Find a root of an equation f(x) using iteration method:

f ðxÞ = x 3 − x − 1 = 0 (9:13)
Solution: Since no guess values are given here, random numbers are put in the function f(x) in such
way that f(a)×f(b) < 0

f ð xÞ = x3 + x − 1

f ð0Þ = ð0Þ3 + 0 − 1 = − 1 ðnegativeÞ

f ð1Þ = ð1Þ3 + 1 − 1 = 1 ðpositiveÞ


So the root lies between 0 and 1 (Figure 9.3). Here x3 is rearranged to give a new function in the
form x = ϕ(x) as

ϕðxÞ = x = ð1 + xÞ1=3 (9:14)


158 Chapter 9 Numerical root-finding methods

100
f(x) = x3–x–1

f(x)
50

0
–6 –4 –2 0 2 4 6
x

–50

–100

Figure 9.3: Iteration method for f(x) = x3−x−1.

For iteration method only a single guess value is required which is close to the original root.
Either of the guess values can be chosen from the interval in which the root lies. The results are
tabulated (Table 9.5) until the function becomes zero.

Table 9.5: Iteration method for f(x) = x3−x−1.

N xn xn + εabs

  . .

 . . .

 . . .

 . . .

 . . .

 . . .E-

 . . .E-

 . . .E-

As can be seen from Table 9.5, the root is found to be 1.32471, which is accurate up to fifth decimal
place in 8 iterations.

Example 5: Using eq. (9.10) used in Example 3, calculate the inversion temperature using iteration
method at p = 200 atm for N2 gas for which a = 141 kPa dm6 mol−2 and b = 0.0392 dm3 mol−1
9.3 Iteration method 159

Solution: Rearranging eq. (9.10),

ðbR2 ÞTi2 − ð2aRÞTi + 3abp = 0 (9:11)

Using the iteration method for a guess value of 200 K (Table 9.6)

Table 9.6: Iteration method to find inversion temperature.

N Tn Tn + ΔT = Tn +−Tn

  . .

 . . .

 . . .

 . . .

 . . .

 . . .

 . . .

 . . .

 . . .

 . . .

 . . .

 . . .

 . . .

 . . .

 . . .

 . . .

Hence in 16 iterations, the convergence has been achieved up to one decimal place and the inver-
sion temperature is found to be 863.8 K

Example 6: Using iterative method, find the temperature at which o-toluidine has a vapour pressure
of 400 mm Hg where an empirical relationship between pressure (p) and temperature (T) is given by
3480.3
log p = 23.8296 − − 5.081 logT (9:15)
T
Solution: At 400 mm Hg, the above equation becomes the function of temperature only.

3480.3
21.22754 − − 5.081logT = 0 (9:16)
T
160 Chapter 9 Numerical root-finding methods

If eq. (9.16) is rewritten as a function of T only then

3480.3
F ðT Þ = =0 (9:17)
21.22754 − 5.081 log T

As evident from Table 9.7, the root converges at eighth iteration to give T = 456.9 K

Table 9.7: Iteration method to find temperature.

N T F

  .

 . .

 . .

 . .

 . .

 . .

 . .

 . .

Hence at 456.9 K, o-toluidine has a vapour pressure of 400 mm Hg.

Example 7: Suppose a nuclei undergoes a radioactive decay and form a daughter nuclei which also
starts undergoing radioactive decay as

λA λB
A ! B ! C (9:18)

where λA and λB are the decay constants of nuclei A and B. The half-lives of A and B are given as
8 days and 2 days, respectively. The starting concentration of A(NA) and B(NB) are 1020 and zero.
The variation of B with time is given by
 
λA N0A
NE = ðe − λA t − e − λB t Þ (9:19)
λB − λE

Find out the time at which the concentration of B is 1019 using Newton–Raphson method.

Solution: Since the half-life and decay constants are related by the relationship is (Figure 9.4)

ln 2
τ= (9:20)
λ
which gives λA and λB as 0.0866434 and 0.346574 day−1.
9.3 Iteration method 161

0.5
e(–λAt) –e(–λBt)
0.45

0.4

0.35

0.3

0.25

0.2

0.15

0.1

0.05

0
0 5 10 15 20 25 30 35
time (t)

Figure 9.4: Radioactive decay.

Plugging all the values in the given relationship

 
λA N0A
NB = ðe − λA t − e − λB t Þ (9:21)
λB − λA

and rearranging gives

e − λA t − e − λB t = 0.3000 (9:22)

which on rearranging gives a function in terms of t only as

f ðtÞ = e − λA t − e − λB t − 0.3000 = 0 (9:23)


The solution of the above equation can be found out using the Newton–Raphson method where the
derivative is given by

f 'ðtÞ = − λA e − λA t + λB e − λB t = 0 (9:24)

Plotting the function e − λA t − e − λB t with time (t) shows that there are two values of time t at which
the function e − λA t − e − λB t has the value 0.3000 which are 1.6 and 13.5 days (Figure 9.4) which is
also confirmed by the Newton–Raphson method (Table 9.8 and 9.9).
162 Chapter 9 Numerical root-finding methods

Table 9.8: N-R method using one guess value.

N t t’ f(t) f’(t)

  . −. −.

 . . . −.

 . . . -.

Table 9.9: N-R method using another guess value.

N t t’ f(t) f’(t)

  . . .

 . . −. .

 . . −. .

 . . −. .

 . . −.E- .

9.4 Binary bisection method

The binary bisection method (also called interval halving method) is a simple and ro-
bust root-finding algorithm that bisects an interval repeatedly in which a root is ex-
pected to lie. Hence, this method is also called bracketing. This method requires the
prior knowledge of an approximate interval between which the real root lies. This
method is based on the intermediate value theorem (also called Bolzano’s theorem) ac-
cording to which if f(x) is a continuous function in the interval a and b (a and b are real
numbers) such that f(a)×f(b) < 0, then there is definitely a root that lies between a and b.
Let us say there is a function f(x) (f(x) is an algebraic or transcendental equa-
tion) which is continuous and lies in the interval a and b that has the real root,
such that f(a)×f(b) < 0, then at the root, that is f(x) = 0 (where x is the root of the
equation). It is also called the zero of the function f(x). In this algorithm, an interval
[a,b] is bisected in two (binary) and then a subinterval c is selected in which the
root lies. It is halved to find a subinterval c as
a+b
c= (9:25)
2
where c 2 ða, bÞ
Now, find f(c),
1) If f(c) = 0, then c is the root of the equation, else
9.4 Binary bisection method 163

2) If f(a)×f(c) < 0, then the root lies between a and c, so a and c becomes the new inter-
val, hence b = c and a = a. Again, the sub-interval c is found using the new intervals.
3) If f(b)×f(c) < 0, then root lies between b and c, therefore b and c becomes the
new interval, b=b and a=c, calculate c again.

This method repeatedly bisects the new intervals based on the signs of function f(x).
This procedure is continued until the zero is obtained or the intervals are sufficiently
small. Its convergence criteria is same as that of Newton–Raphson method and itera-
tion method that when f(a) or f(b) or f(c) ≈ 0 or ja − bj < ϵabs the iterations are stopped.
The advantage of binary bisection method is that it always converges howsoever long
it takes, but it may not be able to deduce more than one root at one time in a given
interval. It also converges slowly as compared to other algorithms. Moreover, the inter-
val in which we assume our root lies should be certain, else even if the interval is not
true, the method converges to give some value of root which may not be true.

Example 8: Find the roots of the equation f(x) using binary bisection method with εabs = 0.01 in the
interval [1,2].
f ðxÞ = x 2 − 3 (9:26)
Solution: Here, the interval given is [1,3], that is a = 1, b = 3. Graphically, the function may be de-
picted as in Figure 9.5
f ð1Þ = − 2, f ð3Þ = 6
c = ð1 + 3Þ=2 = 2
f(c) = 1, hence now a = a while b = c since f (a)×f (c) < 0

50

f (x) = x2–3
40
f(x)

30

20

10

0
‒8 ‒6 ‒4 ‒2 0 2 4 6 x 8

‒10

Figure 9.5: Binary bisection method for f(x) = x2−3.

Hence, tabulating the calculations in Table 9.10 as


Table 9.10: Binary bisection method.
164

N a b f(a) f(b) c = (a + b)/ f(c) Update

   −  . −. a=c

 .  −.  . . b=c

 . . −. . . −. a=c

 . . −. . . −. a=c

 . . −. . . −. a=c

 . . −. . . . b=c

 . . −. . . −. a=c

 . . −. . . −. a=c

 . . −. . . . a=c


Chapter 9 Numerical root-finding methods

 . . −. . . −. b=c

 . . −. . . −. a=c

 . . −. . . . a=c

 . . −. . . . b=c

 . . −. . . −.E- a=c

 . . −.E- . . .E- a=c

 . . −.E- .E- . −.E- b=c


9.5 Secant method 165

Hence, in the 16th iteration, the root converges to 1.7320 which is correct up to fourth decimal
place.

9.5 Secant method

As the name suggests, secant implies a line which passes through two points of the
curve. It is an algorithm for finding the roots of scalar-valued function of a single
variable x when no information of derivative is given. Secant method is an algo-
rithm used to find the roots of nonlinear functions. Let x0 and x1 be the two initial
guesses for the root of f(x) = 0, then f(x0) and f(x1), respectively, are their function
values. A line is drawn between the two guess approximations and the point where
it crosses the x-axis (Figure 9.6) will be the approximate root of f(x) using approxi-
mate guesses (x0 and x1). Secant method assumes that the equation or function is
approximately linear in the region of interest.

f(x)

x0 x2 x1

Figure 9.6: Secant method.

Hence, the slope m can be written as

y − f ðx1 Þ f ðx1 Þ − f ðx0 Þ


m= = (9:27)
x − x1 x1 − x0

So, in the above figure, it can be seen that the line between the two guess values
touches x-axis at x2, so here, value of y = 0 (root is the value of a variable where the
function becomes zero); therefore

0 − f ðx1 Þ f ðx1 Þ − f ðx0 Þ


m= = (9:28)
x2 − x1 x1 − x0
f ðx1 Þ − f ðx0 Þ
− f ðx1 Þ = ðx2 − x1 Þ (9:29)
x1 − x0
166 Chapter 9 Numerical root-finding methods

which on rearranging gives


x1 − x0
x2 = x1 − f ðx1 Þ (9:30)
f ðx1 Þ − f ðx0 Þ

Hence, x2 is the approximate root yet not the original root. A root for the function f(x)
is approximated which is not really a root but is quite near to the original root.

f(x)

x3 x0 x2 x1

Figure 9.7: Secant method.

To do the same, a new secant would be drawn (Figure 9.7). Since x2 is closer to the
original root than x0 (also f(x1)*f(x2) < 0), the new secant would be drawn between
new intervals, that is [x1,f(x1)] and [x2, f(x2)] where x3 is the new point of intersection
to x-axis. Using the same procedure as above, it can be written that
x2 − x1
x3 = x2 − f ðx2 Þ (9:31)
f ðx2 Þ − f ðx1 Þ

This cycle will continue to take place until the difference between |xn-1−xn-2| < εabs.
Hence, the general expression for secant method may be written as
xn − 1 − xn − 2
xn = xn − 1 − f ðxn − 1 Þ (9:32)
f ðxn − 1 Þ − f ðxn − 2 Þ

In above procedure, the iterations are used to bring the two guess values close to
the original root. The most important point to remember is that the initial guess
value should be close to the original root else secant method will not converge.
There may not be a proper way of knowing how close the guess value may be but if
the function f(x) is differentiable and f’(x0) = 0 on that interval then the secant
method would not converge. Thus, it adopts the possibility of being faster but may
not be converging due to non-root bracketing.
As compared to N-R method and iteration method, binary bisection method and
secant method uses two guess values (interval in which root lies). As compared to N-R
method, where f(x) and f’(x) both are calculated, secant method should be faster since
it has to compute only one f(x), but in reality N-R method is found to be faster as
9.5 Secant method 167

compared to secant method since f(x) and f’(x) are computed simultaneously as it iter-
ates at each step. Secant method may not necessarily always converge.

Example 9: Using secant method, find roots of the following equation up to three decimal places

f ðxÞ = x 3 + x − 1 (9:13)
Solution: Using Example 4, the roots lies between 0 and 1, hence using secant formula (9.32), the
first iteration be N = 1
xn − 1 − xn − 2
xn = xn − 1 − f ðxn − 1 Þ (9:32)
f ðxn − 1 Þ − f ðxn − 2 Þ
 
1−0
x1 = 1 − 1
1 − ð − 1Þ
x1 = 0.5.

The remaining results are tabulated (Table 9.11) as follows.

Table 9.11: Secant method for solving f(x) = x3−x + 1.

N xn– xn– f(xn–) f(xn–) xn

   −  .

  .  −. .

 . . −. −. .

 . . −. . .

 . . . −. .

 . . −. −.E- .

 . . −.E- .E- .

The root is found to be 0.6823278 which is exact up to not only three decimal place but up to fifth
decimal places. At seventh iteration, we can see that |xn–xn–1| < 10−6 which is less than the prede-
fined tolerance limit.

Example 10: Find the root of the nonlinear equation 3x + sin x–ex = 0

Solution: When analysed graphically, both the root lies between [0, 2]. So, using the secant for-
mula as (Figure 9.8)

xn − 1 − xn − 2
xn = xn − 1 − f ðxn − 1 Þ (9:32)
f ðxn − 1 Þ − f ðxn − 2 Þ
168 Chapter 9 Numerical root-finding methods

1.5
f(x) = 3x + sin(x) – exp(x)

f(x)
1

0.5

0
0 0.5 1 1.5 2 x 2.5

–0.5

–1

–1.5

Figure 9.8: Secant method.

The results are tabulated in Table 9.12:

Table 9.12: Secant method for f(x) = 3x + sin(x)–ex.

N xn– xn– f(xn–) f(xn–) xn

   − . .

  . . . .

 . . . −. .

 . . −. . .

 . . . .E- .

 . . .E- −.E- .

So here, after six iterations, the root is found to be 0.3604, which is exact up to four decimal places.
The iterations can be continued until a convergence criteria is reached which is |xn + 1 – xn| < εstep, that
is, the difference between successive iterates is sufficiently small. If the denominator is zero, then divi-
sion by zero fails the iteration. Hence there is a need for new initial approximation. If after a given
number of iterations, convergence is not reached, then it is possible that solution (root) does not exist.
9.6 Regula-Falsi method 169

9.6 Regula-Falsi method

Regula-Falsi method is also a numerical method to find roots of equation. As the


name suggests it means a false position method, which approximates a real root by
approximating a guess root in an interval which lies close to the original root. It is
also a bracketing method like binary bisection method to find roots of the equation
and hence it is always bound to converge. If the function f(x) is continuous and there
is an interval in which the root lies of the function, then the root of the function can
be found using R-F method. This method is very similar to binary bisection method
except in finding the new intervals. Also, it differs from binary bisection method in
the speed of convergence, R-F converges faster than binary bisection method.

y = f(x)
a, f(a)

f(x)

x a x4 x3 x2 x1 b

b, f(b)

Figure 9.9: Regula-Falsi method.

This method alike other methods also assumes that the function f(x) be continu-
ous. Regula-Falsi method begins with a and b interval (such that a < z < b where z
is the root of the f(x)) such that f(a)×f(b) < 0, then to find the root a new approxi-
mate root x1 is calculated which is not a real root but it is a false root as suggested
by the name and proceed to find an approximate root in the interval chosen and
then carefully selecting which roots should be taken forward for the next iteration
(either a and x1 or x1 and b) depending upon the sign of f(x1), f(a) and f(b). This is
called root bracketing, implying finding root within the interval chosen. For this,
170 Chapter 9 Numerical root-finding methods

a line is drawn between (a,f(a)) and (b,f(b)) which is known as interpolation line.
The new false root is checked for its magnitude of the function, that is f(x1).
There may be three possibilities:
1) If f(x1) = 0, then x1 is the root but this usually does not happen.
2) If f(a)×f(x1) < 0, then x1 becomes the new b, that is, b = x1, so now an interpola-
tion line is drawn between a,f(a) and x1,f(x1).
3) If f(b)×f(x1) < 0 then x1 becomes the new a, that is, a = x1 and a new interpolation
line is drawn between x1,f(x1) and b,f(b) (Figure 9.9).

When a chord is drawn between [a,f(a)] and [b,f(b)], the general equation for the
line is
y − y1 y2 − y1
= (9:33)
x − x1 x2 − x1
y − f ðaÞ f ðbÞ − f ðaÞ
= (9:34)
x−a b−a

At x = x1 , y = 0

0 − f ðaÞ f ðbÞ − f ðaÞ


= (9:35)
x1 − a b−a
af ðbÞ − bf ðaÞ
x1 = (9:36)
f ðbÞ − f ðaÞ

Here x1 is the first approximated root, since it is still not the original root. Check if
f(a)×f(x1) < 0, then b = x1 else a = x1 (f(b)×f(x1)). Here f(a)× f(x1) < 0 so, a new chord
is drawn between (a, f(a)) and (x1,f(x1)) and the same equation of line is written as

y − f ðaÞ f ðx1 Þ − f ðaÞ


= (9:37)
x−a x1 − a

At x = x2, y = 0

0 − f ðaÞ f ðx1 Þ − f ðaÞ


= (9:38)
x2 − a x1 − a
af ðx1 Þ − x1 f ðaÞ
x2 = (9:39)
f ðx1 Þ − f ðaÞ

This above procedure is repeated (x2, x3, x4, . . ., xn) until f(xn) = 0 or ≈ εabs (also
called tolerance limit or degree of accuracy).
Regula-Falsi methods resemble the secant method in the formula used and two
starting initial approximations, except secant method. Except, secant method may
not necessarily find the approximated root in the starting interval (x0 and x1).
9.6 Regula-Falsi method 171

Hence roots are not bracketed in the secant method so it may not always converge
but Regula-Falsi method always converge.

Example 11: Find the roots of the function f(x) using Regula-Falsi method in the interval [0,2]. Given
εabs = 0.0001

f ðxÞ = x 3 + 3x − 5 (9:40)
Solution: Graphically, the function f(x) is depicted in Figure 9.10. For approximating the first order,
we will use eq. (9.36)

af ðbÞ − bf ðaÞ
x1 = (9:36)
f ðbÞ − f ðaÞ
f ðaÞ = f ð0Þ = − 5, f ðbÞ = f ð2Þ = 9
0f ð2Þ − 2f ð0Þ
x1 = (9:37)
f ð2Þ − f ð0Þ
5
x1 = = 0.7142
7
Now f(x1) = –2.492, since f(b)×f(x1) < 0, hence a = x1, the further results are tabulated in Table 9.13.

40
f(x)

30
f(x) = x3 + 3x–5

20

10

0
x
–4 –3 –2 –1 0 1 2 3 4
–10

–20

–30

–40

–50

Figure 9.10: Regula-Falsi method for f(x) = x3 + 3x–5.


172 Chapter 9 Numerical root-finding methods

Table 9.13: Regula-Falsi method for f(x) = x3 + 3x–5.

N a b f(a) f(b) xn f(xn) Update

   −  . −. a=x

 .  −.  . −. a=x

 .  −.  . −. a=x

 .  −.  . −. a=x

 .  −.  . −. a=x

 .  −.  . −. a=x

 .  −.  . −. a=x


 .  −.  . −. a=x

 .  −.  . −. a=x

 .  −.  . −. a=x

 .  −.  . −.E- a=x

 .  −.E-  . −.E- a=x

From the tabulated results it is clear that at the 12th iteration, the root (1.15416) is stable up to 5th
decimal place. Also at 12th iteration f(x1) ≈ 10−5

Example 12: Determine the volume of 0.5 mol of the van der Waal’s gas CO2 at 2226 kPa and 298 K.
Given a = 363.76 kPa dm6 mol−2 and b = 42.67 cm3 mol−1.

Solution: The guess value for volume is taken using ideal gas equation for volume as V = nRT/p

 
n2 a
p+ 2
ðV − nbÞ = nRT (9:38)
V

which on rearranging gives


 
nRT n2 a n3 ab
f ðVÞ = V 3 − nb + V2 + V− =0 (9:39)
p p p

To apply N-R method, derivative of function is required as


 
nRT n2 a
f 'ðVÞ = 3V 2 − 2 nb + V+ (9:40)
p p

Hence, the results are tabulated in Table 9.14.


9.6 Regula-Falsi method 173

Table 9.14: N-R method to solve van der Waal’s equation.

N x f(x) f’(x) xn

 . . . .

 . . . .

 . .E- . .

0.4998 dm3 is the volume of CO2 obtained for the given condition. It is important to note that the order
of polynomial is always equal to the number of roots of that polynomial. Here, since the order of V is 3,
it implies that should be three roots but it is not possible that at a single pressure, that is, 2,226 kPa,
there would be three volumes, hence only one of them is true. In this case, one may obtain two more
volumes (using different guess values) which would not be true solution to the equation.

Example 13: The concentration of [H+] in a dilute solution of HCl having concentration 10−6 M is
given by the expression

½H + 2 − ½HCl½H +  − kw = 0 (9:41)

Calculate the pH of 10–7 M HCl solution at 25 °C

Solution: The equation given above is a quadratic equation of the type ax2 +bx +c =0. The equation
can be solved using iteration method by rearranging the equation as

qffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi
½H +  = ½HCl½H +  + kw (9:42)

Taking the initial guess of the acid as 10–7, the results are tabulated in Table 9.15.

Table 9.15: Iteration method to solve for pH.

N xn xn + Eabs

 . .E- .E-

 .E- .E- .E-

 .E- .E- .E-

 .E- .E- .E-

 .E- .E- .E-

 .E- .E- .E-

 .E- .E- .E-

 .E- .E- .E-

 .E- .E- .E-


174 Chapter 9 Numerical root-finding methods

pH = − log10 ½H +  (9:43)
−7
pH = − log10 ½9.9 × 10  (9:44)
pH = 6.00

9.7 Problems for practice

1. Using the Newton–Raphson method, find the root of the equation accurate to
within 10−7
(a) 5sinx2 − 8cos5 x = 0 for [−1,2] (b) x4−x–10 = 0 for [1,2]

2. Find the root of the equation x2 − 4x − 7 = 0 near x = 5 to the nearest thousandth.

3. Find the roots of the following functions using iteration method


(a) f(x) = x2− 2 starting with x0 = 1
(b) f(x) = e−x cos(x) starting with x0 = 1.3 where εabs = 10−5

4. Using the iteration method, calculate [H+] in 10−4 M solution of weak acid with
ka = 1.7 × 10−10 M at 25 °C. Given the equation as

½H + 3 + ½H + 2 ka − ½H + fkw + ka ½HA0 g − ka kw = 0

Find the root of the equation x3 – 3 with the bisection method with the interval
[1, 2] using εstep = 0.1 and εabs = 0.1

5. Using binary bisection method, find the roots of the following function.
(a) cos(x)–xex = 0 (b) x4–x–10 = 0 (c) x–e-x = 0

6. Find root of the f ðxÞ = x × cos½ðxÞ=ðx − 2Þ = 0 by Regula-Falsi method.

7. Find the root of the function f ðxÞ = 5sin2 x − 8cos5 x = 0 in the interval [0.5,1.5]

8. Find root of the equation x4-x-10 = 0 using secant method in the interval [1,2]

9. Find root of the following equations using secant method


ðaÞ expð − xÞ = 3logðxÞ ðbÞ xsinðxÞ − ð1=2Þ = 0
Appendix A

Conversion factors between metric, US customary and British Imperial unit system.

Table A.1: Units of volume.

US or imperial Metric

 cu inch (in ) . cm

 cu foot (ft) . m

 fluid ounce . UK fl oz . mL

 pint ( fl oz) . UK pt . L

 gallon ( in) . UK gal . L

Table A.2: Units of length.

US or imperial Metric

 inch (in)  in . cm

 foot (ft)  ft . m

 yard (yd) , yd . m

 mile  in . km

 int. nautical mile ,. yd . km

Table A.3: Units of mass.

US or imperial Metric

 ounce (oz) . grain . g

 pound (lb)  oz . kg

 stone  lb . kg

 hundredweight (cwt)  lb . kg

 short ton (US) . t

 long ton (UK) . t

https://doi.org/10.1515/9783110695328-010
176 Appendix A

Table A.4: Units of area.

US or imperial Metric

 sq inch (in ) . cm

 sq foot (ft)  in . m

 sq yd (yd)  ft . m

 acre , yd ,. m

 sq mile (mile)  acres . km

Table A.5: Prefixes for multiple and fractions of units.

Multiple Prefix Abbreviation Fractions Prefix Abbreviation

 Deca da − Deci d

 Hecto h − Centi c


 −
 Kilo k  Milli m

 Mega M − Micro µ

 Giga G − Nano n


 −
 Tera T  Pico p

 Peta P − Femto f

 Exa E − Atto a


 −
 Zetta Z  Zepto z
 −
 Yotta Y  Yocto y

Table A.6: Volume unit conversion.

 mL . L

 cL . L

 dL . L

 in . × − L

 gal . L

 ft . L
Appendix A 177

Table A.7: Length unit conversion in metric


system.

 mm . m

 cm . m

 dm . m

 dam  m

 km , m

 Amstrong − m

 fermi − m

 light year . × − m

 mile . m

Table A.8: Mass unit conversion in metric.

 mg . g

 cg . g

 dg . g

 dag  g

 hg  g

 kg , g

 stone ,. g

 lb . g

 oz . g

Table A.9: Units of time.

 min  s

h  min/, s

 day  h

 week  days

 year  days


178 Appendix A

Table A.10: Energy unit conversion.

 British thermal unit (BTU) , J

 erg − J

 foot print . J

 calorie (cal) . J

 kilowatt hour (kWh) . ×  J

 electron volt (eV) . × − J

 litre atmosphere . J

Table A.11: Area unit conversion.

 in . × − m

 ft . × − m

 acre . ×  m

 hectare  m

 mile . ×  m

 barn − m
Appendix B Answers to the problems for practice

Unit 1

1. (a) 5 (b) 2 (c) 3 (d) 4 (e) 6 (f) 3 (g) 4


2. (a) 6,510,000 (b) 0.07 (c) 92.4 (d) 0.00125 (e) 0.0050 (f) 5.1
(g) 30,000, 32,000, 32,400, 32,390, 32,391 (h) 80, 83.8, 83.8105 (i) 0.76
(j) 1 (k) 900 (l) 8 (m) 40 (n) 0.02478 (o) 8500 (p) 0.00032
3. (a) 81.9 (b) 0.07194 (c) 3 (d) 2.073 (e) 2.4 (f) 35.6 (g) 1.0 × 105
(h) 0.320 × 1011 (i) 170 (j) 0.09177

Unit 2

1. (a) 23.06 0.03 (b) 0.0137 0.0024 (c) 11.27 0.04 (d) (9 3) × 10–33
2. (a) 3.1417 is more precise while π is more accurate
(b) 2.7182820135423 is more precise while 2.718281828 is more accurate

Unit 3
π
1. ðaÞ log2 60 ðbÞ log log 2 ðcÞ − 5 log3 5
2. x = 1, y = 3
3. ðx − 2Þ2 + ðy − 3Þ2 = 25
n2 a n3 ab
4. f ðVÞ = V 3 − ðnb + nRT p ÞV + p V − p = 0
2
∞ 2
5. f ðΛm Þ = c = b12 ðΛm − Λm Þ = 0

Unit 4

1. 7.007, 0.191, 0.257, 0.663


2. Q = 0.07 < Qc; hence, it can be included
3. 5.6 ± 0.12%
4. t = 0.424 < tc; hence, statistically correct
5. On the basis of F-test, F = 0.375 (compare with Ftab for ν1 = 5 and v2 = 7)

Unit 5

1. 6.5 kJ mol–1
2. a = 26.694, b = 0.0094, c = −10−6

https://doi.org/10.1515/9783110695328-011
180 Appendix B Answers to the problems for practice

3. 6.90 × 10−4
4. 0.0112 min−1
5. y = x2
6. 0.0111

Unit 6

1. With 10 intervals, 37,575; correct answer is 37,500


2. 1,444.2 with 20 intervals; correct answer is 1,443.1
3. 11.163 kJ mol−1
4. 6.754JK−1 mol−1
5. 40.53 kJ mol−1

Unit 8
d2 y
1. dy
dx = 14 and dx2
= 10
2. 400 m s−1
3. 5.687
4. 3.208

Unit 9

1. (a) –0.701367 (b) 1.855


2. 5.317
3. (a) 1.4142156 (b) 1.5707963
4. 1.649218 × 10−7 M
5. 1.4375
6. (a) 0.517 (b) 1.86 (c) 0.565
7. 1.222
8. 0.5 and 0.70136
9. 1.85558
10. (a) 1.24682 (b) 1.4973
Index
Abscissa 97 Cartesian coordinate system 43
Absolute error 28 Cauchy-Euler DEs 117
Absolute uncertainty 20 Central difference formula (CDF) 132
Accuracy 20 Central tendency 49
Algebric functions 43 CGS 3, 4
Amount of substance 7 Circle 37
Ampere 6 Circumference 41
Angle 41 Coefficient of determination 73
ANOVA 90 Coefficient of variation 54
Anti-trigonometric functions 42 Combining uncertainties 21
Arc 41 Common logarithms 34
Arc length 41 Composite integral Simpson’s rule 108
Area under the curve 97, 99 Computers 45
Arithmetic mean 51 Confidence level 59
Arithmetic operations 1, 21 Confidence limit 17, 59
Array 67 Constant 1
Arrhenius’s equation 33 Continuous derivative 153
Asymmetric distribution 56 Coordinate systems 43
Asymptote 38 Correlation 71
Atlantic-Pacific rule 10 Cosecant (cosec) 39
Average 18 Cosine (cos) 39
Average deviation 18 Cotangent (cot) 39
Avogadro’s constant 5 Co-variance 54, 72
Azimuthal angle 44 Critical values 57
Cubic function 36
Backward difference formula (BDF) 132 Current 6
Base 10 45 Curve fitting 71, 74
Base units 3
Bell-shaped curve 65, 66 Data analysis 57
Binary 45 Data reduction 21, 49
Binary bisection method 151, 162 Decimal 45
Binary distribution 66 Decimal number system 45
Binary number system 45 Degree 41
Binomial distribution 65 Degree of confidence 57
Bits 45 Degree of polynomial 38
BODMAS 2 Dependent variable 31
Boltzmann’s constant 5 Derived units 3, 4
Boltzmann’s equation 33 Descriptive statistics 49
Bolzano’s theorem 162 Descriptors 49
Boole’s rule 98, 109 Determinate errors 17
Bracketing 162 Differential equation 117
British Imperial Unit system 5 Digital 45
Discordant value 57
Caesium frequency Δνcs 6 Distribution 28
Caesium hyperfine frequency 5 Distribution of errors 65
Candela (cd) 7 Dixon’s test 57

https://doi.org/10.1515/9783110695328-012
182 Index

Ea 2 Ideal gas equation 2


Einstein equation 2 Improper rational function 38
Elementary charge 6 Improved Euler’s 121
Elementary electric charge 5 Independent variable 31
Error analysis 17 Indeterminate errors 17
Error of trapezoidal rule 105 INDEX 91
Errors 17 Index rule 3
Euclidean space 43 Initial value problem 118
Euler’s number (e) 33, 117, 118 Instrumental error 19
EXCEL 68, 90 Integration techniques 97
Exponential 25, 32 Intercept 31
Exponential radioactive decay 33 Interconversion of units 8
Intermediate value theorem 162
Factor label method 8 International System of Units 3
False position method 169 Interpolating polynomials 134
Finding roots 151 Interpolation 74
Finite difference formula 132 Interval halving method 162
First-degree polynomial 31 Inverse trigonometric functions 42
Fixed point iteration method 156 Iteration method 151, 156
FORECAST 92 IUPAC 4
Forward difference formula (FDF) 132
Four-point FDF 143 Kelvin 6
FPS 3 Kibble balance 6
Frequency 51 Kilogram (kg) 6
F-test 62 Kurtosis 49, 56
Fundamental units 4
Lagrange’s interpolation formula 134
Gauss-Chebyshev formula 97 Lagrange’s polynomial 106, 134, 143
Gauss forward and backward interpolation 139 Least square curve (LSC) fitting 73, 74
Gauss-Hermite formula 97 Length 6
Gaussian 56 Linear function 31
Gaussian distribution 20, 65 LINEST function 91
Gauss-Legendre formula 97 Logarithmic function 34
Gauss quadrature 97 Logarithms 25
Geometric mean 51 LOGEST function 92
Goodness 73 Luminous efficacy 5
Goodness of fit 74 Luminous intensity 7
GROWTH function 92
Maclaurin series 42, 43
Harmonic mean 52 Mantissa 11, 12
Harmonic oscillator 129 Mass 6
Henderson-Hasselbalch equation 2 Mathematical function 31
Heun’s method 121 Mean 18, 49, 50
Hexadecimal 45 Measure of central tendency 49
Hexadecimal system 47 Median 49, 52
Hierarchy of operations 2 Methodic error 19
Histogram 53 Metre 6
Hyperbolic functions 42 Metric system 3
Hyperbolic trigonometric functions 42 Mid-Point formula 114
Index 183

Mixed mathematical operations 12 Pearson coefficient 72


Mixed operations 23 Pearson correlation coefficient 72
MKS 3, 4 PEMDAS 2
Mode 49, 53 Percent average deviation 19
Mole 7 Percent error 18
MTS 4 Percent relative uncertainty 20
Multivariate linear regression 85 Percent uncertainty 18
Physical constants 5
Natural logarithms 34 Place value 45
Nernst equation 2 Planck’s constant 5
Newton-Cotes closed formulas 98 Pointedness 56
Newton-Cotes formula 97 Poisson distribution 65, 67
Newton-Cotes open formulas 98, 114 Polar angle 44
Newton-Cotes quadrature formulas 98 Polar coordinate system 44
Newton-Cotes two-point formula 100 Polynomial regression 87
Newton-Gregory formula 134 Polynomials 36
Newton-Raphson method 151 Population correlation coefficient (ρxy) 72
Newton’s divided difference interpolation Population mean 50
formula 134 Population standard deviation 72
Newton’s forward interpolation formula 134 Power function 37
Newton’s interpolating polynomial 134 Precision 20
Newton’s iteration 151 Predictor-corrector method 121
Nonlinear equations 151 Probability 67
Non-root bracketing 166 Products of powers 24
Normal 28 Propagation of uncertainty 21
Normal distribution 65 Proper rational function 38
Normal equations 87
Null hypotheses 64 Q-test 57
Number crunching 49 Quadrature 24
Number of degrees of freedom (ν) 59 Quartic function 36
Number of measurements (N) 59 Quotient 46
Number system 45
Numerical curve fitting 71 Radial distance 44
Numerical differentiation 131 Radian 41
Numerical integration 97 Random errors 17, 19
Numerical methods 151 Rational functions 38
Numerical root-finding methods 151 Rational number 38
Numerical techniques 97 Reciprocal functions 37
Rectangle 98
Observational error 19 Reference plane 44
Octal 45 Regression 71, 73
Octal number system 46 Regula-Falsi method 151, 169
Onsager equation 2 Relative error 29
Ordinary DEs 117 Relative uncertainty 20
Origin 43 Remainder 46
Outliers 57 Residual 75
Richardson extrapolation 134, 146
Paired t-Test 61 Riemann sum 98
Partial fractions 39 RK3 124
184 Index

RK4 124 Summation of quadrature 27


RK method of order 3 124 Sum of squares 73
RK method of order 4 124 Suspected value 57
RK second-order method 122 Syntax 68
Root bracketing 169 Systematic errors 17, 19
Root functions 37 System de International (SI) 4
Rounding off 12, 28
Rules for performing arithmetic operations 10 Tangent 152
Rules of precedence 2 Tangent (tan) 39
Runge-Kutta (RK) methods 117, 121 Taylor’s expansion 42
Taylor’s series 42
Sample correlation coefficient (rxy) 72 Taylor’s theorem 42
Sample mean 50 Temperature 6
Sample standard deviation 72 Theoretical error 19
Scatter plot 71 Three-point FDF 143
Secant method 151, 165 Three-point formula 115
Secant (sec) 39 Time 6
Second 6 Transcendental functions 43
Second-order polynomial 87 Trapezoidal rule 98, 100
SI 3 TREND 92
Significant figures 9, 12 Trigonometric functions 39
Simpson’s 1/3rd rule 98, 106 Trigonometric identities 40
Simpson’s 3/8 rule 98, 109 Triple point 6
Simultaneous linear equations 87 Truncation error 109
Sine (sin) 39 T-Test 59
SI unit system 4 Two-point formula 114
Skewness 49, 56
Slope 31 Uncertainty 17, 18
Spearman’s rank correlation coefficient 72 Unit 1
Speed of light 5 Unit system 3
Spherical coordinate system 44 US Customary 3
Spread 18, 55 US Customary System of Units 5
Spreadsheets 67
Standard deviation 18, 49, 53 Variability 49
Statistical tools 67 Variables 1
Stirling’s formula 134 Variance 49, 54
Stirling’s polynomial 134
Student’s t-test 59 Weighted mean 51
Successive approximation 156
Summary statistics 49

You might also like