Experimental Data Processing Laboratory
A.Y. 2024/2025
Learning objectives
We aim to offer students an introduction to the fundamental numerical computing techniques in use in the physical sciences field. Basic operating system features and commands are covered, then data structures
(in particular as included in the C++ standard library), numerical integration techniques, solution of differential equations and random-number based methods. We emphasize on a deep understanding of both the advantages and the limitations of each numerical technique. The C++ programming language is used, so its main design features (inheritance, encapsulation and polymorphism) are explained, in the context of the object-oriented (OO) design and programming paradigm.
(in particular as included in the C++ standard library), numerical integration techniques, solution of differential equations and random-number based methods. We emphasize on a deep understanding of both the advantages and the limitations of each numerical technique. The C++ programming language is used, so its main design features (inheritance, encapsulation and polymorphism) are explained, in the context of the object-oriented (OO) design and programming paradigm.
Expected learning outcomes
Upon completion of the course each student will be able to:
1) interact with the UNIX operating system, in particular its input/output and data storage subsystems.
2) write C++ code to acquire and/or analyze experimental data and compute the main statistical estimators.
3) implement a few numerical algorithms in C++ (function root finding, integrals, differential equation solution.
4) write numerical C++ code to study a few simple mechanics and electrostatics problems.
5) write a random number generator and understand its operation and limitations.
6) use a random number generator to compute one- and multi-dimensional integrals.
7) use a random number generator to simulate the operation of an experimental apparatus, and propagate the systematic error introduced by such a measurement.
1) interact with the UNIX operating system, in particular its input/output and data storage subsystems.
2) write C++ code to acquire and/or analyze experimental data and compute the main statistical estimators.
3) implement a few numerical algorithms in C++ (function root finding, integrals, differential equation solution.
4) write numerical C++ code to study a few simple mechanics and electrostatics problems.
5) write a random number generator and understand its operation and limitations.
6) use a random number generator to compute one- and multi-dimensional integrals.
7) use a random number generator to simulate the operation of an experimental apparatus, and propagate the systematic error introduced by such a measurement.
Lesson period: First semester
Assessment methods: Esame
Assessment result: voto verbalizzato in trentesimi
Single course
This course can be attended as a single course.
Course syllabus and organization
Single session
Responsible
Lesson period
First semester
Course syllabus
During the course some numerical techniques are presented to deal with physical problems of interest. The reference language for the implementation of these techniques is C++: during the development of course the main features of this language (classes, templates, polymorphism) will be discussed.
In more details the covered topics will be:
1) Experimental data analysis: reading data from a file, elementary statistical analysis and visualization of the collected data.
- Basic elements of the C language (data types, control structures)
- Introduction to object-oriented programming, the concept of class
- Template classes and functions
- Data containers and algorithms: elementary containers, STL containers (vector, list and map) and algorithms (algorithm.h)
2) Exercises on object oriented approach: calculation of electric and gravitational fields
- derived classes. encapsulation.
3) Methods for finding zeros of a function: bisection algorithm, secant and Newtown methods. Performance and limitations.
- virtual methods, abstract classes and polymorphism
4) Numerical quadrature techniques: midpoint method, trapezoid and Simpson methods. Estimate of the error in the calculation of an integral with numerical techniques.
5) Solution of ordinary differential equations. One step methods (Euler and Runge-Kutta). Application to various physical systems: pendulum, forced and damped harmonic oscillator. Error analysis.
6) Remarks of probability theory, random variables and central limit theorem. Random number generators for uniform, exponential and Gaussian distributions. Inverse function method and accept / reject. Monte Carlo methods for the integration of a function and for the simulation of experimental apparatuses.
In more details the covered topics will be:
1) Experimental data analysis: reading data from a file, elementary statistical analysis and visualization of the collected data.
- Basic elements of the C language (data types, control structures)
- Introduction to object-oriented programming, the concept of class
- Template classes and functions
- Data containers and algorithms: elementary containers, STL containers (vector, list and map) and algorithms (algorithm.h)
2) Exercises on object oriented approach: calculation of electric and gravitational fields
- derived classes. encapsulation.
3) Methods for finding zeros of a function: bisection algorithm, secant and Newtown methods. Performance and limitations.
- virtual methods, abstract classes and polymorphism
4) Numerical quadrature techniques: midpoint method, trapezoid and Simpson methods. Estimate of the error in the calculation of an integral with numerical techniques.
5) Solution of ordinary differential equations. One step methods (Euler and Runge-Kutta). Application to various physical systems: pendulum, forced and damped harmonic oscillator. Error analysis.
6) Remarks of probability theory, random variables and central limit theorem. Random number generators for uniform, exponential and Gaussian distributions. Inverse function method and accept / reject. Monte Carlo methods for the integration of a function and for the simulation of experimental apparatuses.
Prerequisites for admission
1) knowledge of the main syntax elements of the C/C++ language: types of variables, control structures (if, for, while), functions and how to pass data to a function.
2) basic elements of mathematical analysis: Taylor series, integration theory, differential equations
2) basic elements of mathematical analysis: Taylor series, integration theory, differential equations
Teaching methods
The course is divided into 12 two-hour lessons in the classroom and 12 three-hour laboratory sessions. In each lesson the basic theoretical elements are introduced for a new topic which is then deepened through concrete applications in the following laboratory session. In the laboratory sessions, mathematics and physics problems are addressed by implementing numerical algorithms discussed in the class lessons in C ++ codes.
Students carry out the laboratory course exercises following the indications on the reference site and leaning on the help of the teacher or assistants in case of need.
Students carry out the laboratory course exercises following the indications on the reference site and leaning on the help of the teacher or assistants in case of need.
Teaching Resources
D.S. Malik: Programmazione in C++. Apogeo, 2013.
N. M. Josuttis: The C++ Standard Library-A Tutorial and Reference, 2nd Edition, Addison Wesley Longman, 2012
W.H. Press et al.: Numerical recipes in C/C++: the art of scientific computing, Cambridge University Press
http://www.cplusplus.com/
https://en.cppreference.com/w/
Slides of the theory lessons and laboratory web site
https://myariel.unimi.it/course/view.php?id=3553
https://labtnds.docs.cern.ch/
http://labmaster.mi.infn.it/Laboratorio2/labTNDS/
N. M. Josuttis: The C++ Standard Library-A Tutorial and Reference, 2nd Edition, Addison Wesley Longman, 2012
W.H. Press et al.: Numerical recipes in C/C++: the art of scientific computing, Cambridge University Press
http://www.cplusplus.com/
https://en.cppreference.com/w/
Slides of the theory lessons and laboratory web site
https://myariel.unimi.it/course/view.php?id=3553
https://labtnds.docs.cern.ch/
http://labmaster.mi.infn.it/Laboratorio2/labTNDS/
Assessment methods and Criteria
The learning verification will be carried out starting from the evaluation of:
1) codes created by the student during the laboratory sessions for the solution of the proposed exercises.
2) a practical computer test
3) an oral discussion.
The final mark will be defined during the oral examination and will take into account the outcome of the three parts listed above. The exercises carried out will be evaluated in terms of correctness, completeness and efficiency of the code. The written test, lasting two hours, aims to verify the student's ability to apply the knowledge acquired during the course to a new physical problem: the student will have to create a C++ program that allows the solution of the proposed problem. In this test the student will be allowed to use the material he made during the laboratory. Finally, the oral test, lasting about an hour, will start from a discussion of the contents of the written test and then ascertain more generally the knowledge of the theoretical (algorithms) and methodological (coding) aspects covered in the course.
1) codes created by the student during the laboratory sessions for the solution of the proposed exercises.
2) a practical computer test
3) an oral discussion.
The final mark will be defined during the oral examination and will take into account the outcome of the three parts listed above. The exercises carried out will be evaluated in terms of correctness, completeness and efficiency of the code. The written test, lasting two hours, aims to verify the student's ability to apply the knowledge acquired during the course to a new physical problem: the student will have to create a C++ program that allows the solution of the proposed problem. In this test the student will be allowed to use the material he made during the laboratory. Finally, the oral test, lasting about an hour, will start from a discussion of the contents of the written test and then ascertain more generally the knowledge of the theoretical (algorithms) and methodological (coding) aspects covered in the course.
FIS/01 - EXPERIMENTAL PHYSICS - University credits: 6
Laboratories: 36 hours
Lessons: 24 hours
Lessons: 24 hours
Shifts:
Professor:
Carminati Leonardo Carlo
Turno 1
Professor:
Carminati Leonardo CarloTurno 2
Professor:
Carminati Leonardo CarloTurno 3
Professor:
Maino DavideTurno 4
Professor:
Tomasi MaurizioTurno 5
Professor:
Galli Davide EmilioEducational website(s)
Professor(s)
Reception:
On appointment
Reception:
Wednesday 14:30-16:00, or in other days by appointment (contact me by e-mail or telephone)
Dip. di Fisica, stanza A/T/S5b (piano 0 edificio LITA), via Celoria, 16
Reception:
Ask the teacher
Laboratorio di Strumentazione Spaziale, Department of physics (via Celoria 16, Milano)