CH332 28jan
CH332 28jan
Computational Chemistry
Note: The numerical method not only solves a problem but also provides
computable error estimates of the procedures it uses.
Difference between analytical and numerical methods
Analytical Numerical
o Analytical methods provide the exact o Numerical methods provide
solution approximate solutions.
Where do we use this? At what time the ball will reach the ground?
Ø y is the height of the ball from the ground.
Ø Now when the ball reaches the ground; y=0 and –x2+4x+5 = 0; finding the value of x for which y=0 will
solve the problem. That is the root of that equation
ln (k)
−2
−3
−4
6.0x10−4 6.4x10−4 6.8x10−4 7.2x10−4
1/T
Optimization: finding the maximum or Use in physical chemistry: Protein folding pathway
minimum of a function
xA + yB = zC https://youvegotthismath.com
7. Ordinary Differential equations
𝑑𝑇
= 𝛼(𝑇 − 𝑇* )
𝑑𝑡
𝛼à constant
Tà initial temperature
Tmà temperrture after cooling
)- ∆-
Given ≈ = 𝑓 𝑡, 𝑦 , Rate of a first-order reaction:
). ∆.
solve y as a function of t
𝑦012 = 𝑦0 + 𝑓(𝑡0 , 𝑦0 )∆𝑡
Mathematical modelling and problem solving
“No matter how impressive tool you have, you will have a hard time repairing a
car if you do not understand how it works.”
Chapra et al. (2015)
A mathematical model can be broadly defined as a formulation or equation that expresses the essential features of a
physical system or process in mathematical terms.
𝒏𝑹𝑻
𝒑=
𝑽
Dependent variable three independent variable
Characteristics of a mathematical model
o A parachutist of mass 68.1 kg jumps out of a stationary hot air balloon. Compute the velocity
before opening the chute. The drag coefficient is equal to 12.5 kg/s.
9.81×68.1 5
29.;
𝑣 𝑡 = 1−𝑒 <=.2 .
12.5
𝑑𝑣 Δ𝑣 𝑣 𝑡012 − 𝑣(𝑡0 )
≅ = because ∆t is finite
𝑑𝑡 Δ𝑡 𝑡012 − 𝑡0
𝑑𝑣 Δ𝑣
Note: = lim
𝑑𝑡 ∆.→? Δ𝑡
o Perform the same computation as before but numerically to compute the velocity.
Employ a step size of 2 s for the calculation.
12.5
velocity at ti+1 𝑣 = 0 + 9.81 − (0) ×2 = 19.62 𝑚/𝑠
68.1
12.5
𝑣 = 19.62 + 9.81 − (19.62) ×2 = 32.04 𝑚/𝑠
68.1
….and so on
Numerical method captures the essential features of the exact
solution
Output:
FORTRAN code for the numerical solution
The numerical approach gives the same result as Analytical when we
use a very small timestep
t (m/s)
t (m/s)
30
30
Analytical
20
20 Numerical (dt = 2s)
Analytical 10 Numerical (dt = 1s)
10 Numerical (dt = 2s) Numerical (dt = 0.1s)
0
0 0 4 8 12 16 20
0 4 8 12 16 20
t (s)
t (s)
We cannot ignore the existence of errors in numerical
methods
“Approximations and errors are an integral part of human life” Numerical methods,
Balagurusami (2013)
To do science, we must
do experiments and
analysis (either in the Collect data Error
lab or on the
computer)
Some errors
Human errors
are avoidable
Non-zeros are
significant
Trailing zeros
Leading zeros
following a
are not 0.0003100400 decimal point
significant
are significant
zeros between
non-zero digits
are significant
Detailed explanation
o All non-zero digits are significant. o All zeros in between non-zero digits are significant.
o Trailing zeros following a decimal point o Zeros on the right of a decimal point and before the
are significant first non-zero digit are not significant. They only
represent the position of the decimal point.
3.1400 -----> 5
0.00031415 -----> 5
65.000 -----> 5
0.0031415 -----> 5
0.23000 -----> 5
0.031415 -----> 5
o When the decimal point is not written,
trailing zeros are not considered to be 31415 × 10 -8 -----> 5
significant 31415 × 10 -7 -----> 5
31415 × 10 -6 -----> 5
4500 = 45 × 102 -----> 2
A decimal rounded from 6 significant digits to 1 significant
digit
Errors associated with measurements can be characterized by their
accuracy and precision
o Accuracy refers to how closely a
computed or measured value agrees with
the true value.
o Precision refers to how closely individual
computed or measured values agree with
each other.
Let’s say you are estimating the root of an
equation, and you know the true value is 1.0
Truncation errors:
o Arise from an approximation in place of an exact mathematical procedure.
o Appears a lot in numerical analysis because many of them are iterative procedures and the computing is
infinite
We terminate
The sum of ' ( the process
$ ≈ 6 𝑎 𝑥$
Sine of an 𝑥 ) 𝑥 * 𝑥 +
after a certain
an infinite 𝑆 = 6 𝑎$ 𝑥 $ sin 𝑥 = 𝑥 − + − + …
angle with a 3! 5! 7! term is
series $%& $%&
series calculated
Modelling errors
o Mathematical models are the first step (basic input) in designing numerical solutions
o We try to develop a model as accurate as possible. However, in many situations, it is
impractical/impossible to include all real problems. So, we take some assumptions
Total force:
𝐹 = 𝐹3 + 𝐹4 𝐹3 = 𝑚𝑔 𝐹4 = −𝑐𝑣
Assumption:
We may not be able 1. Force due to air
to estimate the air resistance is linearly
resistance properly proportional to the
velocity of the falling
o We can reduce errors by refining or enlarging body
the models by incorporating more features ---- 2. there is no wind force
> But this makes the model more difficult to acting on the body
solve
Blunders
o Errors due to human imperfections
o Such errors may cause serious disaster in the result.
Some common types of errors are:
o Lack of understanding of the problem
o Wrong assumptions
o Overlooking some basic assumptions required for formulating the model
o Selecting the wrong numerical method for solving the mathematical model
o Wrong guessing of initial values
o Making mistakes in the computer program
𝑥. − 𝑥A
𝑒@ =
𝑥.
𝑥. − 𝑥A
Percent relative error: 𝑒@ = ×100
𝑥.
Minimizing the Errors
o Let’s assume that the mathematical model is properly formulated, and the input
data are accurate
1. Increasing the significant figures of the
Truncation error can be reduced by
computer
decreasing step size: But it can increase the
o 0.110 = 0.00011001 (8 binary digits) vs 0.110 = roundoff error
0001100110011001
o Use double precision for floating point
calculation
2. Minimizing the number of arithmetic
operations
o ax+bx could be written as (a+b)x
3. Avoiding subtractive cancellations
! ! "# !
o could be written as 𝑥 + 𝑦
!"#
4. Choosing the proper initial parameters
Process and Job-control
THANK YOU!