# PROGRAMMING APPLIED TO PHYSICS

## Learning outcomes of the course unit

Aim of the course is to familiarize with implementation of numerical methods for scientific calculus in mathematical physics using Matlab as programming language.

At the end of the course, the student must achieve the skills

- to understand a physical problem from the numerical point of view;

- to perform simple numerical experiments of Physics with a reasonable degree of autonomy,

- to develop and use numerical codes for data processing and for the simulation of physical processes.

- to elaborate and analyze the results obtained to derive representations in terms of the models of the physical system under examination.

The student must also demonstrate

- to possess personal skills in logical reasoning and in the critical approach to new numerical calculation problems;

- to be able to gather information independently through the autonomous consultation of specialized books, scientific or divulgative journals, even outside the topics explained during lectures;

- to know how to acquire new knowledge in an autonomous way in order to develop new numerical codes;

- to apply the acquired knowledge for the interpretation of some of the physics problems that can be solved with adequate means of calculation.

The student must also achieve the following communication skills:

- to present clearly what was acquired during the course

- to use specific scientific vocabulary inherent to the numerical calculus;

- to present in a synthetic and analytical way the results of data analysis and numerical simulations carried out in laboratory activities;

- to use computer and / or multimedia tools to communicate effectively and incisively his knowledge, in particular, on the results of the activity carried out for the final exam.

## Prerequisites

No compulsory prerequisites are required. Basic notions of Mathematical Analysis (I and II) and General Physics (I and II) are required.

## Course contents summary

The basic contents of the course concern the elements of numerical analysis aimed to solve elementary problems in Physics in both experimental and theoretical fields.

Numerical codes are developed in Matlab language.

The first part of the course is devoted to the Matlab language notions. Several examples are explained and the students are required to solve some exercises and numerical algorithms during laboratory lessons.

The covered topics concern the numerical codes to solve mathematical problems involved in physics problems: numerical derivates, multidimensional integrals, Fast Fourier Transforms, non-linear interpolation, numerical solutions of ordinary differential equations, numerical solutions of partial differential equations.

In the second part of the course, some numerical problems in Physics are proposed:

1) non-linear interpolation of experimental data and spectral signal analysis;

2) numerical simulations of experiments and comparison with real data (pendulum motion is deeply analyzed in order to compare real data with simulated ones);

3) numerical solutions of Newton laws in the case, as example, of gravitational interactions;

4) stability and caos in the Hamiltonian systems;

5) heat conduction in easy cases.

## Course contents

Elements of Programming in Matlab.

Numerical algoritms:

root finding, solution of linear algebraic equations, polynomial interpolation, non linear interpolation, Fast Fourier Transform and spectral analysis, quadrature integral, random numbers, Monte Carlo method, integration of ordinary differential equations.

Numerical codes:

data analyses and least squares method, numerical calculus in one or more dimensions and comparison between different algorithms, Monte Carlo simulation of a physics experiment, solution of ordinary differential equations and comparison between different algorithms in the case of easy problems of classical physics: simple pendulum with friction; variable length pendulum; gravitational two-body problem; gravitational three-body problem; n-body gravitational problem; basic concepts on the molecular dynamics; basic concepts on stability and chaos in hamiltonian systems; solution of Heat conduction equation in easy cases.

## Recommended readings

At the end of each lesson, the teacher gives slides, some lecture notes, numerical codes and suggests some readings on web.

The used software is also available to be installed on personal computers.

The students have to sign to the course on Elly platform in order to keep all the material.

## Teaching methods

The course counts 6 CFU which corresponds of 62 hours of lectures, including 14 hour of frontal lessons and 48 hours of exercises as computer training in laboratory. During computer training in laboratory the students are required to develop some numerical codes under the supervision of the teacher.

Before laboratory sessions it is necessary to download and study all the slides, numerical codes and any other material provided by the teacher during class hours and made available to them on the Elly platform.

## Assessment methods and criteria

After each frontal lesson, before the weekly exercises in the classroom computer, for every exercises and code, the teacher indicates the minimum expected results and any further insights the students can develop on their own.

During the course, the students are required to produce and present weekly their work done in the classroom and eventually finished at home. They can provide their work putting it on an assigned computer area where the teacher can verify the level of learning achieved on specific topics and eventually correct and/or suggest to study in deep.

To simplify the presentation of the work and any corrections, a brief summary is required (in word, power point, latex, etc.) which summarizes the results achieved, comments and notes. Students are strongly encouraged to study gradually and constantly and to interact with the teacher so that they can overcome any initial difficulties and they can progress in the knowledge of programming language and numerical techniques.

The final evaluation is based on an oral examination in a computer room by means of a computer. The student can use a personal computer, if he prefers. The student is asked for a brief report (in latex, word, power point, ...) that illustrates his own numerical programs and highlights the most interesting results obtained through significant graphs,. For this purpose it is possible to use the schematic summaries prepared weekly, previously delivered and corrected.

The final evaluation is based on three aspects having the same weight for the achievement of the final grade: i) comprehension of one or more developed problems and of the numerical methods adopted to solve them; ii) discussion on the developed numerical codes, on the implementation of the algorithms that make programs faster and more efficient, with particular attention to the evaluation of numerical errors; iii) presentation of the results obtained through significant graphs. Examples of final reports and questions can be found on the 'Elly' platform at the end of the course.

In order to reach the sufficiency it is necessary to achieve the minimum level required for all the exercises and numerical codes developed during laboratory activity as indicated by the teacher. The student must prove to have understood the faced problems.

In order to achieve ’30 cum laude’, the student will also have to develop one or more original numerical codes on specific topics of the Course

The final evaluation will be communicate at the end of the oral examination.

In order to attend the exam, it is COMPULSORY to register online.