transcriber name Murari
Numerical Methods and Simulation
Techniques For Scientists And Engineers
Saurabh Basu
Department of Physics
Indian Institute of Technology- Guwahati
Lecture 01
Introduction
Error analysis and estimates, significant
dig
So, good morning everyone welcome to this
course on numerical methods and simulation
techniques for scientists and engineers, the
courses likely to give an overview of different
numerical methods that we use for solving
different physical problems. And there are
simulation techniques which are needed in
order to either time evolve or evolve in another
parameter space of systems and then see that
how things behave in the time evolved say
for example, case such as you know, markets
or the financial groups.
They need such simulation techniques to know
that how the market is going to behave in
a few months down the line or maybe even a
few years down the line. But of course, that
is a very complicated problem, numerical problem,which
had a lot of which have a lot of you know,
external factors that influencewe are mostly
going to talk about the very established numerical
methods and the simulation techniques that
are also quite established and are needed
in a big way for solving physical andphysically
relevant problems and engineering problems.
So,in order to see an introduction to the
is let us understand that since the middle
of the last century or other the latter half
of the last century, the personal computers
have been available in a big way and they
are rather inexpensive these days, which have
made these numerical computations of various
physical things quite easy and feasible.
(refer time: 02:28)
So, is needless to say that these inexpensive
personal computers with a reasonably large
RAM, they have given access to powerful computational
methods and techniques, and which have evolved
in the last maybe 20 years or so, in afairly
massive way. So, let us you know, cite few
reasons that we should do this course or rather
learn this method of numerical techniques.
So, the first question of course, that why
should we learn numerical methods and simulation
techniques.
So, are most of these physical problems that
we come across do not have an analytic solution,
even the best of the mathematicians could
not solve a large number of problems or a
differential equations that may not have a
clue solution or an exact solution, even if
it is there, it has not been discovered as
yet. Andthere areapproximation techniques
such as perturbation techniques and so, on
which we have seen in course of say quantum
mechanics or sometimes even in classical mechanics,
they only give approximate solutions.
But that also subject to certain conditions
such as the perturbation term or the interaction
term being small as compared to the non interacting
term such that you can use the basis or the
V functions or the Eigen functions for the
non interacting problem in order to find directions
due to the interact interaction term. So,
in order to gather understanding ofthose systems
were exact numerical methods or rather exact
analytic solutions are not available computational
techniques are theonly solutions to those
problems.
And we need to arrive at the solution. So,
we need to resort to new metrics. And these
solutions when we analyze them, they give
you understanding of the key concepts that
are embedded in the equations, equations do
not make any sense to us, unless they are
solved and they are put in perspective, and
they are physically they are made physically
meaningful. In order for us to gather information
about the system, its properties, its characters
is dynamics, behaviour with respect to different
parameters, etcetera.
The second is that, they are powerful methods
to handle large systems of equations. Of course,
we cannotphysically solve maybe more than
one particle or two particle or maybe a few
particles, but, thesethese computers are these
computational techniques can solve a large
number of simultaneous equations and with
several complications such as they can have
several unknowns and large number of unknowns,large
matrices, they can handle large matrices diagonal
ization of large matrices are made possible
and they can also handle complicated nonlinear
entities, usually non linear equations cannot
be solved by hand you need to have computational
methods or numerical methods in order to solve
the non linear equations.
So, these are some of the very basic things
where numerical methods come to have us and
they are heavily used in most of these situations.
And of course, very correctly that different
computational techniques provide efficient
usage of the computersand which of course
necessitates learning of computer languages
such as C, Cc++, Python, Fortran, etc, etc.
And many of these software packages that we
actually use on a daily basis for reasons
related to computation related to plotting
of graphs, so, as to make meaning of those
results that are you know, visual meaning
of those results that we actually find.
All documentation purpose, we often use a
large number of documenting software's where
we simply write letters or write document
or write you know, notes, which are, which
could be class material and all that, they
apply number of numerical techniques, which
have few of which we would learn in this course.
And importantly, last and not the least, the
numerical techniques each and idea how the
errors propagate, and especially in high accuracy
computation.
So, when you need results, which are, you
know, you need accuracy of 10 to the power
-6, then, of course, you have difficulty of
getting anything up to the 5 decimal places,
or 4 decimal places, and so on, you need an
accuracy up to the 6 decimal place. So, they
are the small errors, which are, you know,
even of the order of 10 to the power -5, etc,
they could make a lot of difference in our,
in our results, such as, you know, these rocket
propulsion or there are other things where
accuracy is very important.
If a satellite or a rocket deviates by a very
small amountfrom its path, there could be,
you know, serious and fatal consequences,
which is what we do not want. Now, it is important
for us to have an idea that how are these
techniques propagating from one step to another
step as we carry out this computation. And
as I said that these are essentially relevant
in high precision or high accuracy computation.
(refer time: 08:51)
We will talk about the errors in a while,
but let us look at the plan for the course.
So, the plan for the course is roughly or
other will follow this by and large, which
will be all backed up by examples,which are
from the science and engineering fields as
the name suggests, that this should be for
both science and engineering fields, some
of these things are better to understand andvisualize
in various science problems, that one is actually
exposed to right from school level onwards.
So there there could be a more you know, component
or more focus on the scientific problems rather
than the engineering problem, but nevertheless,
we try to address both. So,we have exactly
like two distinctsub headings of this course,
one is called as a numerical methods, this
involves errors,it involves the roots of equations,
especially thenon linear equations, and will
learn methods how to handle the non linear
equations.
And before we actually say, all these things,
it is important for us to understand that
each of thesemethods will be backed up by
their corresponding error calculations. So
it is important that we have these,ah these
methods very clear, and each method will come
with its own error calculation, then, we will
talk about curve fitting, and how toactually
make sense of aresult and aid it visually
that how a particular function behaves as
it is dependent parameters.
And there, because they are numerical data,
they could be scattered about certain, you
know, a variation. And it is important for
us to know that what the variation is, because
in some cases in physics, or even otherwise,
you would like to know that what is the variation
of a function for its dependent parameter
say X, X going to 0 or x going to infinity
or x going to 1 and so on. So, there are these
these golf fitting will tell you what is the
nature of the function, what is the you know,
polynomial fit best polynomial fit, or, or,
orany kind of fit that is available for this
function.
Then we will talk about differentiation, numerical
differentiation, it is an important part,
the thing is that thatdifferentiation orderivative
is liable tohave a lot of errors, while knowing
that there are situations in which we cannot
just do without learning derivatives or differentiation,
because differentiation actually, if you recall
the definition that you have learned in school,
that is divided by age and the limit is tending
to 0.
So, you are actually dividing quantity by
a very small quantity and hence the there
could be serious errors which are associated
with this. So, we have to understand and learn
what are the different methods of you know
derivatives that are used, then of course,
we do integration and this is one of the most
common things that is done in numerical methods,
if you want to find out the area under the
curve or if you want to know the you know
the distance travelled in case of a non uniform
motion or even a uniform motion by particle
or by a body by system and so on.
So, we need integration techniques, differentiation,
differential equations, will look at differential
equations and how to solve differential equations
in an iterative manner.And then we will talk
about the initial and boundary value problems,
this is again a very important part of this
numerical methods, because a large number
of problems are actually subject to certain
initial and boundary values and these areneeded
for us in large number of situations such
as say wave propagation in a media or say
heat transport in a certain metal or in a
certain material or across a junction of materials.
So, you need to solve for the heat conduction
equation andsubject to the you know, the boundary
conditions or the even sometimes the initial
conditions are needed forfinding out x as
a function of d that is distance as a function
of time among the simulation techniques will
only touch upon two of them Monte Carlo technique,
it is a very important technique, which is
usedit is initially used for doing integration.
But will use that and actually learn that
how one can simulate a system and on based
on this technique, and will also learn molecular
dynamics, which is solution of Newton's equations
subject to you know, the initial conditions
and so.
(refer time: 14:26)
So, having said that, let us try to you knowing,
sort of giving you an idea of errors. So,
how errors actually arise, okay, if you are
trying to measure a line, okay, with a scale
growing very approximately what you can understand
that this is a scale with you know, with all
these markings that you have, and so on. Then,
this one comes the end of the scale, say,
suppose you actually, you know,ah align it
with the 0 of this scale.
And it comes to around a between say 8.8 centimetre
and 8.9 centimetres, and then you have no
way to say that it is closer to 8.8 or it
is closer to 8.9. So, there are what I am
trying to get at is that every system comes
with or every measuring device comes with
a least count and you cannot do anything better
than the least count this has a least count
of .1 centimetre. So, for example, you could
have better scales with you know, larger accuracy
and so on.
Of course, meter scale is not the way you
if you want to actually find out the thickness
of a air strand. And so, there are screw games
is and there are other things which are there,
but the thing is that that it is always impeded
by the least count of the apparatus, you cannot
do anything better than that you can some
student can say it is 8.8 some students can
say it is 8.9, but that is what it is one
has to accept that what is the meanah what
is it the this line is closes to whether it
is 8.8 or 8.9, subject to some parallax error
and so on.
So, there are these errors that are always
there. And mostly we are interested or rather
we talk about the errors that come out because
of rounding off of decimal places. So, what
we mean by rounding off is that every measuring
devices I said including a computer has limitations
of how many signal difficult digits you cancalculate
with the aid of it anything more than that
is not possible anything anything with larger
accuracy or higher accuracy with that kind
of measuring device is not possible.
So, we if you leave the if you take only up
to the significant digits and leave out the
non significant ones, these non significant
ones actuallycan come out in sort of you know,
they can get snowballed or other they can
get added up as we go across the various stages
of these iterative stages of these computation,
and they can become very significant. So that
is one kind of error. And we will mostly talk
about a round of error in various situations.
So, just general definition is that true value
is equal to an approximate value + error okay.
So, let us call this value of error Et equal
to the value of error which is equal to the
true value - the approximate value okay. So,
this is quite simple that wehave the error
is simply the true value, which we may know
which we may not know, but we of course, know
the approximate when value the true value
is only known when we have an analytic solution,
and we can actually solve it exactly so, a
true value means and exact value of this and
an approximate value.
So, mostly when we talk about these round
of error and things like that, we it is assumed
that we know the exact value by some other
means, okay, by probably a much better better
method, which leaves out some of these are
rather overcome some of these approximations
that have been used in this particular method.
So, another quantity that is often use this
call as a relative error, which is equal to
the value of the error 
and divided by the true divided by the true
value.
And a more frequently, what is used is that
it is called as afractional relative error.
Let us call it SPT. Okay, so this is, you
know, most of the time this is used. Okay,
so we will see some example for calculating
error and how that actually affects our results
will start with a problem, which is essentially
problem of civil engineering. And then we
will of course, as we go along the way we
show for each method or for all those numerical
techniques that we have described how each
method is subject to error due to round off
or otherwise, and we will discuss all that.
So, through this example, let us show generic
you know problem of errors or how you know
the significant digits make a difference.
(refer time: 21:31)
Let us name this as therailroad problem really
road or a crack whatever problem. So, let
us give a statement of this problem rail track
of length 1 me one mile, so, this is in older
units, but does not matter the unit is not
important here is cut at the middle 
middle and welded in the form of an arc of
length 1 mile and 1 foot one you are required
to find the the distance d at which 
it is rejoined. Okay, so, what it means is
the following, so, there was this track which
was initiallyyou know, like this, and then
it was picked like this and it is bent, and
we put all these things w have been drawn
need figure.
So, all right. So, this is, so, this becomes,
this is the rail track to before so, this
is the midpoint of the rail track. So, before
it is been cut so, this is after cut and welded.
Alright, so this is one mile. So this is like
half mile, let us write it with small MI for
a mile. So, it is a half mile, so this is
like half mile. And this is like half mile.
And so this is let us call this asO, that
is the point and this point, let us call it
as d. So, this distance is d, this distance
is d, which is one has to find that how far
away from the track that it has been joined.
And this is of course, these are arc as length
of 1 mile and 1 foot okay and let this be
r, let this angle be Theta this angle be theta
and so on. So, this is a situation and let
this length be x and this let us call this
as C and this is A and so, this is that and
there is a B here. So let us just write it
as A B and C. So ABC is the rail track, which
has now become ABC and we like to find the
okay. So, so, the question is find d okay.
(refer time: 25:56)
So, if that is the case, let us take the unit
of length as unit of length for our case equal
to half mile and the figure can be redrawn
as the same figure is as we have drawn earlier,
it is redrawn like this 
just ignore these protrusion that are at the
end and so, there is a theta there is 1 and
1 and there is a d there is a C there is A
and then there is a so because this half mile
is taken as equal to 1 unit okay.
So, this is a 1+e that is the one side the
other side is also 1+e where he is a small
number and this is of course x this is of
course d. So, x is as we have said, x is this
distance and so on. And so x and d and this
is 1+e and this is also 1+e where he is a
small number 
maybe of the order of 10 to the power -4 so
we do not have an idea of the magnitude, but
one can choose e to be so we will just say
that we choose e to be like 1 divided by 5280
which is equal to a .000189 where 5280 feet
is equal to 1 mile.
Okay, so that is the conversion so it is so
if you need half a mile then this is equal
to 2640 feet which is equal to half mile.
So, either ease of this or it is twice of
this because is the unit is taken as half
miles anyway does not matter for us as much.
So this is my r and this is where the problem
starts. So we have just reduce the problem
a little bit where the miles have been taken
into a half and so on there is a B and there
is O there so of course since Theta since
Theta is small, because it is only 1 mile
+ 1 foot.
So Theta must be small, so ADB ADB can be
considered as a right angle triangle with
sides as 1 d and 1+e okay. So, of course,
the right angle is at DBA DBA is equal to
90 degree, so that we have the hypotenuse
being formed by 1+e. So, if that is true,
then 1+e squared that is equal to 1+d squared
(refer time: 30:38)
If you solve with the value of e that we have
chosen, solving d comes out to be .0194. And
multiplying it by half mile, which is 2640
feet,we get be equal to 
so d equal to 51 feet. So from this it is
clear that if you have to make this part this
at the middle and weld it and join it like
an ark, it has to be done at a distance of
51 feet. But if you look at it a little more
carefully, so more careful calculations lead
to if you refer to the finger, then it is
1 + x square equal to r square.
Remember that this is one and this is x so
the right angle is that ABO so it is 1 + x
squared equals r squared. And which is nothing
but equal to so r squared is nothing but equal
to x + d the whole squared because the angle
Theta is small so r and x + d are nearly same.
So we can put this is of course for small
theta. Now if you look at it, sin theta becomes
equal to 1 over r so let us call this as this
as equation one sig theta as 1 over r because
this is 1 that is the right I mean the perpendicular
by the hypotenuse that 1 over r and then it
is r theta equal to 1+e now we are taking
into account that r theta an arc which is
1 over e.
And as we have said that e equal to .000189
and so on. See if you divide 2 by theta so
sig Theta over Theta. It is equal to 1 by
1 + e, which is equal to 1 - e divided by
1 + e. So that is my equation. Say, so that
is that is comes from equation 2 when we divide
by Theta so we have divided by Theta and Theta
equal to 1 by 1+e divided by r so that our
cancels and you have this for now.
(refer time: 34:14)
One needs to now expand sin theta. So that
is equal to, so LHS of 4 we have not named
it but let us name it as 4, so LHS of 4 is
written as 1 - theta square by 3 because it
is Theta – Theta Q by 3 factorial plus Theta
5 by that is the expansion of time sin theta
5 by 5 factorial. Now one Theta goes away
from everything, so theta 4 by 5 factorial
- Theta 6 by 7 factorial, etc, this is equal
to 1 – 6 divided by 1 + e, let us call this
as equation 5.
So basically, does both sides of this equation
is slightly less than 1 again, because theta
is small ok. So, the leading term is of course
1 and these are of the order of the leading
order is of the theta square and all that
and now what we can do is that we can we can
factor out theta from these things, the 1
anyway cancels out and we can factor out Theta
and can solve for, so let us just write factoring
out theta square and solving for Theta square.
So Theta squared is equal to 6e divided by
1+e, 1 - Theta square by 20, plus and all
that. So that is the value of Theta squared,
which is coming out from here. So of course,
this is equation 6 and Theta square is of
the order of maybe .001 this one can actually
theta 4 can be neglected in the denominator.
That is why we have written it only one term.
(refer time: 37:22)
So, indeed, for only 3 significant figures,
as we have been saying before that the significant
figures are important. I mean, even theta
square can be neglected in front of theta.
So solving for theta it comes out as .033708
Okay. So, hence r theta equal to 1+e which
we have already written here as equation 3,
this is from equation 3. Now r with this value
of theta r comes out to be 29.672, e we have
already quoted. So this is r equal to this.
And now we can actually get a quadratic equation
for be using this e.
So how we can get this is that we have 1 +
x squared equals to r square. So that gives
that x square is less than r square -1. And
we have actually x squared + d squared + 2xd,
which is x + d whole square, that is equal
to r squared that is there in this equation,
equation 1. So if you use this, and you can
put now here to put x squared equals to r
squared -1, so we have r squared -1 + d squared
+ 2 into r squared -1 into d equal to r square.
So, this will have you know the r square will
cancel and for large r 
one gets 1 – 2rd + d squared equal to 0.
And other way of looking at it is that we
are eliminating x. So it looks like a quadratic
equation in d 
in d, which is of course, solution will give
us the answer. But if you look at it carefully,
it is actually a linear equation with the
quadratic perturbation. So it is, this is
the the last term is the perturbation.
(refer time: 40:24)
And so, we we can write this as quadratic
perturbation. So, that is if we take this
then d equal to 1 + d square by 2r and if
you all for d by neglecting d square So, d
becomes equal to 1 over 2r and putting the
value of r, d becomes .016856 these are the
numbers that you should check and it because
to get it into the units thatah we want in
mile or feet multiplying by 2640, d becomes
equal to 44.499 feet. Now, this is 44.499,
almost 44.5 feet and the earlier answer that
we got was 51 feet as we as we saw it here.
So, one method gives you 51 feet, the other
method of course, gives you a much lower value
which is 44.5 feet. So, this is certainly
not an ignorablediscrepancy, that you actually
want to think if you think of that if a civil
engineer is actually doing this 44.5 feet
versus a 51 feet would make a lot of difference.
So, he has to take a call that that whether
he should do a sort of more you know measurement
that is based on the first method which is
just taking that arc to be a straight line
and using Pythagoras theorem in a right angle
triangle.
Or a more involved analysis, which also nevertheless
has some approximations made such as we have
made approximations I just theta is more and
d is also small compared to the unit of length,
which is half mile and various things. So,
basically, your r came out to be around this
value, one can multiply it and get a value
in a feet that is much larger than d. So,
we have actually neglected the square and
treated this equation and have gotten a value
which is 44.5 nearly 44.5 feet.
So, this is the difference in numeric computation.
So an algorithm is very important the correct
algorithm would give you get you values which
are much closer and if you choose a much simpler
algorithm, which is more inaccurate, then
the chances that one gets values which are
far away from the actual value that is that
is going to be there. So it just an example
how in such a simple problem. Looking at the
problems in two different fashions would give
you such wildly different results.
