DSE Numerical Analysis
DSE Numerical Analysis
NUMERICAL ANALYSIS
LEARNING OBJECTIVES
The main objective of this course is to introduce the students to the field of numerical
analysis enabling them to solve a wide range of physics problems. The skills developed
during the course will prepare them not only for doing fundamental and applied research but
also for a wide variety of careers. Python programming, foundational numerical methods, and
physics applications
LEARNING OUTCOMES
After completing this course, student will be able to,
• Analyse a physics problem, establish the mathematical model and determine the
appropriate numerical techniques to solve it.
• Derive numerical methods for various mathematical tasks such as root finding,
interpolation, least squares fitting, numerical differentiation, numerical integration, and
solution of initial value problems.
• Analyse and evaluate the accuracy of the numerical methods learned.
• In the laboratory course, the students will learn to implement these numerical methods in
Python and develop codes to solve various physics problems and interpret the results.
THEORY COMPONENT
Unit – I (7 Hours)
Approximation and errors in computing: Introduction to numerical computation, Taylor’s
expansion and mean value theorem; floating point computation, overflow and underflow;
IEEE single and double precision format; rounding and truncation error, absolute and relative
error, error propagation
Solutions of algebraic and transcendental equations: Basic idea of iteration method,
Bisection method, Secant method, Newton Raphson method. Comparison of order of
convergence
Unit – II (7 hours)
Interpolation: Interpolation and Lagrange polynomial, divided differences, Newton divided-
difference form of the interpolating polynomial with equally spaced nodes. Theoretical error
Page 43 of 65
in interpolation
Least Squares Approximation: Least squares linear regression, Least squares regression for
exponential and power functions by taking logarithm.
Unit - IV (8 Hours)
Initial Value Problems: Solution of initial value problems by Euler, modified Euler and
Runge Kutta (RK2, RK4) methods; local and global errors, comparison of errors in the Euler
and RK methods, system of first order differential equations; solving higher order initial
value problems by converting them into a system of first order equations
References:
Essential Readings:
1) Introduction to Numerical Analysis, S. S. Sastry, 5th edition, 2012, PHI Learning Pvt. Ltd.
2) Elementary Numerical Analysis, K. E. Atkinson, 3rd edition, 2007, Wiley India Edition.
3) Numerical methods for scientific and engineering computation, M. K. Jain, S. R. K.
Iyenger and R. K. Jain, 2012, New Age Publishers
4) A Friendly Introduction to Numerical Analysis, B. Bradie, 2007, Pearson India
Additional Readings:
1) Numerical Recipes: The art of scientific computing, W. H. Press, S. A. Teukolsky and W.
Vetterling, 3rd edition, 2007, Cambridge University Press
2) Numerical Methods for Scientists and Engineers, R. W. Hamming, 1987, Dover
Publications
3) Applied numerical analysis, C. F. Gerald and P. O. Wheatley, 2007, Pearson Education
4) Numerical Analysis, R. L. Burden and J. D. Faires, 2011, Brooks/Cole, Cengage Learning
5) Numerical Methods, V. N. Vedamurthy and N. Ch. S.N. Iyengar, 2011, Vikas Publishing
House
PRACTICAL COMPONENT
At least 12 programs must be attempted (taking at least two from each unit).
The implementation is to be done in Python.
Use of scipy inbuilt functions may be encouraged
Page 44 of 65
Unit 1
Basic Elements of Python: The Python interpreter, the print statement, comments, Python
as simple calculator, objects and expressions, variables (numeric, character and sequence
types) and assignments, mathematical operators. Strings, Lists, Tuples and Dictionaries, type
conversions, input statement, list methods. List mutability, Formatting in the print statement.
Control Structures: Conditional operations, if, if-else, if-elif-else, while and for Loops,
indentation, break and continue, List comprehension. Simple programs for practice like
solving quadratic equations, temperature conversion etc.
Functions: Inbuilt functions, user-defined functions, local and global variables, passing
functions, modules, importing modules, math module, making new modules. Writing
functions to perform simple operations like finding largest of three numbers, listing prime
numbers, etc. Generating pseudo random numbers
Unit 2
NumPy Fundamentals: Importing Numpy, Difference between List and NumPy array,
Adding, removing and sorting elements, creating arrays using ones(), zeros(), random(),
arange(), linspace(). Basic array operations (sum, max, min, mean, variance), 2-d arrays,
matrix operations, reshaping and transposing arrays, savetxt() and loadtxt().
Plotting with Matplotlib: matplotlib.pyplot functions, Plotting of functions given in closed
form as well as in the form of discrete data and making histograms.
Unit 3
Root Finding:
(a) Determine the depth up to which a spherical homogeneous object of given radius and
density will sink into a fluid of given density.
(b) Solve transcendental equations like α = tan(α).
Page 45 of 65
(c) To approximate nth root of a number up to a given number of significant digits.
Unit 4
Interpolation and least square fitting:
a) Given a dataset (x, y) with equidistant x values, prepare the Newton’s divided difference
table.
b) Given a dataset (x, y) corresponding to a physics problem, use Lagrange and Newton’s
forms of interpolating polynomials and compare. Determine the value of y at an
intermediate value of x not included in the data set. This may be done with equally
spaced and non-equally spaced x-values.
c) Generate a tabulated data for an elementary function, approximate it by a polynomial and
compare with the true function.
d) Make Python function for least square fitting, use it for fitting given data (x,y) and
estimate the parameters a, b as well as uncertainties in the parameters for the following
cases :
i. Linear ( )
ii. Power law ( ) and
iii. Exponential ( ).
The real data taken in physics lab may be used here.
e) Compare the interpolating polynomial for a given dataset (following a known form e.g.
exponential) with the approximation obtained by least square fitting.
Unit 5
Differentiation and Integration:
a) To compute the left, right and central approximations for derivative of a function given
in closed form.
b) Plot both the function and derivative on the same graph. Plot (using matplotlib) the error
as a function of step size on a log-log graph , study the behaviour of the plot as step size
decreases and hence discuss the effect of round off error.
c) Use integral definition of error function to compute and plot erf(x) in a given range. Use
Trapezoidal, Simpson and Gauss Legendre methods and compare the results for small and
large values of x.
d) Verify the degree of precision of each quadrature rule.
e) Approximate the value of π by evaluating the following integral by using Simpson and
Gauss Legendre method
"
1
' 𝑑𝑥
𝑥! + 1
#
Unit 6
Initial Value Problems (IVP):
a) Compare the errors in Euler, RK2 and RK4 by solving a first order IVP with known
solution. Reduce the step size to a point where the round off errors takes over.
b) Radioactive decay: With a given number of initial nuclei and decay constant plot the
number of nuclei left as a function of time and determine the half life
c) Solve a system of two first order differential equations by Euler, RK2 and RK4 methods.
Use it to solve an nth order IVP. Solve a damped free and forced harmonic oscillator
problem using this.
d) Solve a physics problem like free fall with air drag or parachute problem using RK
method.
Page 46 of 65
e) Obtain the current flowing in a series LCR circuit with constant voltage for a given set of
initial conditions.
Page 47 of 65