Logo UAB

Numerical Methods I

Code: 103950 ECTS Credits: 3
Degree Type Year Semester
2500097 Physics OB 2 2


José Flix Molina

Teaching groups languages

You can check it through this link. To consult the language you will need to enter the CODE of the subject. Please note that this information is provisional until 30 November 2023.


Oscar Blanch Bigas


There are no special requirements in terms of physics lessons previously taken. It is convenient to have passed calculus from the first semester of the degree. It is recommended to get used to Python programming techniques and review the basics of programming (we will give indications and material along the course). Other necessary mathematical techniques are part of the subject and will be reviewed during the course.

Objectives and Contextualisation

In this course, basic concepts of probability theory and statistics are introduced, as well as fundamental notions of Python programming.
Physics is ultimately an experimental science, based on measurements made in scientific experiments. These measures are inevitably subject to errors that must be quantified, sometimes in form of parameters with their errors, others as levels of confidence, or on the basis of other concepts. In all the experimental sciences a similar process is carried out and the tool to do it in a rigorous way is the branch of mathematics called Statistics.
As physicists we have to invest a minimum of intellectual effort in understanding clearly the basic concepts of Statistics. This is valid both for the experimental physicists who carry out the measurements, and for the theorists who try to elaborate models or theories that explain the measurements. The language and concepts about probability theory are also essential in some of the foundations of physics, specifically in Quantum Mechanics and Statistical Mechanics. Familiarity with these concepts is necessary to address these disciplines.
In order to face and understand many of the concepts that we will learn in class, we will do some practical sessions using modern programming tools in modern languages, in particular Python programming on Jupyter Notebooks. Being aware of the little or no experience in programming, sufficient material is provided to be able to reach some elementary notions of programming in advance. The practices are arranged in order of increasing difficulty, from very elementary numerical methods (integration, derivatives), to cover many of the aspects that will have been explained in the theoretical part of the subject. We will review the basic data structures, as well as the fundamental control structures, and we will use the Python libraries commonly used in current physical-mathematical problems.


  • Communicate complex information in an effective, clear and concise manner, either orally, in writing or through ICTs, and before both specialist and general publics
  • Develop strategies for analysis, synthesis and communication that allow the concepts of physics to be transmitted in educational and dissemination-based contexts
  • Make changes to methods and processes in the area of knowledge in order to provide innovative responses to society's needs and demands.
  • Use computer tools (programming languages and software) suitable for the study of physical problems
  • Use critical reasoning, show analytical skills, correctly use technical language and develop logical arguments

Learning Outcomes

  1. Analyse and describe clearly the strategy in addressing a particular problem from the numerical point of view.
  2. Analyse and describe physical problems from an approximate perspective, modelling complex physical systems and solving them in an approximate manner.
  3. Apply the Monte Carlo method to solving specific problems and for some of the most common problems.
  4. Communicate complex information in an effective, clear and concise manner, either orally, in writing or through ICTs, in front of both specialist and general publics.
  5. Control errors produced in the various numerical methods, giving a fuller analysis of these.
  6. Develop programmes in a specific programming language.
  7. Develop programming strategies that allow the collaborative use of the programmes developed.
  8. Identify situations in which a change or improvement is needed.
  9. Present numerical results accurately, including the processing of statistical errors.
  10. Use critical reasoning, show analytical skills, correctly use technical language and develop logical arguments


Section 1. Theory of probability.

Chapter 1. Probability and Statistics, basic concepts.

The concept of probability and its interpretation. The frequentist and Bayesian schools. Axiomatic theory of probability. Probability distributions, concepts of probability density, mean, variance and other moments.

Chapter 2. Conditional Probability. Distributions of several variables

Distributions of several variables, conditional probability, marginal distributions. Correlation and covariance. Changes of variable.

Chapter 3. Most frequent probability distributions

Binomial, Multinomial, Hypergeometric, Poisson, Exponential, Normal and Gauss distributions. Properties of the Gaussian distribution in one and several variables. The Chi-2 distribution, the t-Student distribution, the Cauchy, Gamma and Landau distributions.

Chapter 4. The Monte Carlo method

Random numbers, Integration by Monte Carlo, the procedures of acceptance-rejection and transformation of variables.

Section 2. Statistical inference.

Chapter 5. Sampling a statistical population

The concepts of sample and estimator. Estimators of parameters of a population. Elementary examples

Chapter 6. The Maximum Likelihood Method

Likelihood concept. Variance of an estimator. The level of Cramer-Rao-Fréchet. Estimators of minimum variance. Applications of the method.

Chapter 7. Applications of the Maximum Likelihood Method

Examples of application of the Maximum Likelihood method. The method of Least Squares.

Chapter 8. Hypothesistesting

Contrast goodness adjustment. Lemma by Neyman-Pearson. Altrest tests. Examples Statistical Errors, Confidence Intervals, Limits.

Section 3. Programming.

Programming in Python. Use of Jupyter Notebooks and virtual machines in Google (Google Colab).
Basic control structures in programming.
Use of the Python libraries most frequently used in Science Date.
Practical sessions of numerical methods in increasing order of difficulty: numerical integration (MonteCarlo method), transformation method, central limit theorem, confidence intervals, correlation factor, maximum likelihood method, Kolmogorov-Smirnov method, ...


Theoretical lessons with discussions in class.
Execution of example problems.
Assignment of problems and corrections in class.
Possibility of discussion by electronic means.
Consultations with the teachers of the subject.

Annotation: Within the schedule set by the centre or degree programme, 15 minutes of one class will be reserved for students to evaluate their lecturers and their courses or modules through questionnaires.


Title Hours ECTS Learning Outcomes
Type: Directed      
Practical lessons 13 0.52 1, 2, 4, 9
Theory lessons 12 0.48 4, 7, 6, 9
Type: Autonomous      
Assignments 21 0.84 1, 4, 7, 6
Personal study 18.5 0.74 1, 2, 4, 7, 6, 9


30% Score: Evaluation and discussion of assigned problems. (15% first part - 15% second part)
70% Score: Partial exams.

The attendance to practical classes is mandatory.

To average the two parts of the course you must have a grade higher than 3.5 points in each part. There is a recovery exam for those who do not pass the subject in part or want to raise a grade. It is possible to take the recovery exam only if the two partial exams have been taken previously, and the deliverables will not be taken into account. That is, if in the 1st part one has a 10 in the deliveries and a 4 in the exam, it has a mark of the first part of 0.3 * 10 + 0.7 * 4 = 5.8, over 10. In the recovery to raise the note the score to pass is 5.8, not the 4 that was taken in the partial. At the end, a minimum cut-off grade per part (3.5) is applied to pass the course.

Unique evaluation

Attendance to practical classes (programming) is mandatory. At the end of each practical class, a delivery of the results must be made to be evaluated.

Students who have accepted the single assessment modality must take a final test that will consist of an exam that will cover both the first and second parts of the subject.

The student's grade will be the weighted average of the three previous activities, where the exam for the first part will account for 35% of the mark, the exam for the second part (programming) for 35% and 30% for the reports/evaluations of the practices. A minimum cut-off mark is applied for each of the parts (3.5) to pass the subject, in a similar way to those who carry out the continuous evaluation.

If the final mark does not reach 5, the student has another opportunity to pass the subject through the recovery exam that will be held on the date set by the coordination of the degree. Here, the practice part is not recoverable, and the final grade will be the weighted average that you get from the first and second parts, also applying 3.5 as a cut per part, tomake the average.

Assessment Activities

Title Weighting Hours ECTS Learning Outcomes
Evaluation and discussion of assignments 30 3 0.12 4, 7, 6, 8, 9, 10
Partial exam Probability and Statistics 35 2.5 0.1 1, 2, 3, 4, 5, 7, 10
Partial exam programming 35 2.5 0.1 1, 2, 4, 7, 10
Recovery exam 100 2.5 0.1 1, 2, 3, 4, 5, 7, 10


S. Brandt, "Statistical and Computational Methods in Data Analysis", North-Holland Publishing Co., 3rd printing, 1978 (https://cataleg.uab.cat/iii/encore/record/C__Rb1839823)

Glen Cowan, "Statistical Data Analysis", Oxford Univ. Press, 1998, ISBN 0198501552 (https://cataleg.uab.cat/iii/encore/record/C__Rb1675337)

Detailed notes of the teacher that will be available on the Virtual Campus.


For the practical part, we will use a computer, with a browser to access Google Colab and do the work in a Python environment in the cloud.