Course program
ORDINARY DIFFERENTIAL EQUATIONS MODULE (30 hours)
Integration of differential equations with initial conditions. Euler method. Local error and global error. Harmonic oscillator. Euler-Cromer method. Study of the integration error.
The prototype of the main function and the command line arguments. Input / output management: stdin, stdout, stderr. Input and output redirection from the command line.
Remote file transfer between machines. Use of gnuplot to generate data graphs.
Stability: the case of oscillations and exponential growth / decrease. Stability properties of Euler and Euler-Cromer methods. The role of characteristic time scales.
Integration methods: Reversibility in the Euler-Cromer method and Verlet method.
Conservation laws along the approximate trajectories of the harmonic oscillator.
Simple pendulum. Measurement of the period and study of small oscillations. Oscillations with linear damping. Estimation of the decay rate and critical damping.
Use of precompiler macros for conditional compilation: #if, #elif, #else, #endif, #ifdef. The -D option of the gcc compiler. Conditional compilation and macro functions.
Insights on the use of gnuplot: graphs in a bilogarithmic scale ("set log"), definition of functions of an independent variable, adjust the parameters of the functions with gnuplot ("fit via").
Runge-Kutta methods of order II and IV.
C: struct structures, struct pointers.
Forced pendulum. Elements of chaos. Poincaré section. Basins of attraction. Bifurcation diagrams.
Motion in a plane. Coupled equations. Motion of planets around a fixed star. Astronomical units of measurement. Calculation of the period of a closed orbit in the phase space.
Considerations on the precision of the floating-point calculation in the choice of the integration step.
Three-dimensional graphics with gnuplot.
Stability due to oscillations and relative error in the energy calculation with Runge-Kutta methods.
RANDOM WALKS MODULE (20 hours)
Dynamical memory allocation: malloc (), calloc (), realloc (), free (), sizeof ().
Brownian motion. Random Walk in one dimension.
Generation of pseudo-random numbers with the linear congruence method.
Generation of random numbers with any distribution: inversion of the cumulative, "accept or reject" method and Box-Müller transformation.
Notable generators (for good or for bad) and commonly used ones: Minimal Standard, Randu, purely multiplicative of the Ecuyer.
C library functions: rand (), lrand48 (), drand48 ()
Building the histogram of the values of a one-dimensional random walk at fixed time. Binning of a histogram. Random walk in multiple spatial dimensions. Probability of return.
Review of positional numerical systems. Hex system. Representation of integers on the calculator. Bitwise operators "&", "|", "^", "~". Bit shift operators "", "
Prerequisites
Basic knowledge of unix, bash and the syntax of C
Books
L.Barone, E. Marinari, G. Organtini, F. Ricci Tersenghi,
"Scientific programming: C-language, algorithms and models in science",
World Scientific, Singapore (2013)
Teaching mode
Approximately 30 hours of teaching in class and 10 practical
experiences in the lab
(https://elearning.uniroma1.it/course/view.php?id=2315)
Frequency
Attending the numerical lab is mandatory.
Exam mode
COMPUTATIONAL PHYSICS LABORATORY 1
STRUCTURE OF THE EXAMINATIONS
The Computational Physics Laboratory 1 course (first semester of the second year of the Bachelor's Degree in Physics) is a theoretical and practical course, which includes mandatory attendance of computational laboratory sessions. The course includes a total of approximately thirty hours of lectures and approximately thirty hours of computational laboratory attendance. Profitable participation in the laboratory sessions is mandatory: any unavoidable absences can be made up in agreement with the course instructors. Laboratory work is carried out in groups, each composed of two students, but it is naturally crucial that both members of the group contribute actively to the common work.
The characteristics of the course require an articulated form of assessment, different from the assessment of courses that take place only in the classroom. The fundamental components are the evaluations of the two intermediate tests, both mandatory, and the evaluation of the work done in the laboratory, both during the sessions and in its final form, with an assessment of the codes and results produced in the lab.
The first intermediate test is usually offered around the middle of the course (early November) in class on the computer.
The second intermediate test usually takes place the week after the last laboratory session. Like the first, it is an individual test to be taken on the computer in our computational laboratories, and serves to demonstrate the skills acquired during the laboratory course. The main part of the test usually involves correcting a code and/or writing code fragments or short complete codes, and finally producing plots, fits, and histograms. In cases of certified force majeure, such as illness or absolutely unavoidable commitments, the student can take a make-up test.
Both intermediate tests may contain "theoretical" questions relating exclusively to the material discussed during the lectures and included in the syllabus.
The codes produced in the laboratory are evaluated, both during the individual sessions and at the end of the course in the definitive form in which they are officially submitted. The correctness, completeness, and cleanliness of the codes, their efficiency, as well as the conclusions reached with those codes (figures and data) are assessed. In this case, explanatory reports are neither required nor expected.
The final grade for "laboratory exemption" is composed of a combination of the grades discussed in the previous paragraphs, with different weights, which may vary depending on the actual difficulty of the tests presented (typically, as an order of magnitude, the first test and the second test will have weights close to 0.3 for the first and 0.4 for the second, and the laboratory assessments will have a total weight close to 0.3). Obtaining a passing grade for laboratory exemption certifies that the laboratory was completed successfully and is a necessary condition for passing the exam. Those who do not obtain the laboratory exemption statement have not achieved a level of proficiency that allows them to pass the exam and will have to attend the laboratory sessions again in a future academic year.
The intermediate tests of the course are mandatory precisely because they are the main assessment tool, aimed at certifying the student's actual learning during the laboratory. As mentioned, those who were absent for serious reasons can make them up immediately after the date of the tests themselves. However, the tests cannot be repeated at other times of the year because they are intermediate tests and are an integral part of the laboratory, which concludes with the end of the course.
In most cases, the final "laboratory exemption" grade is proposed to the students, who can accept it as their final grade. For students who accept the grade, it is recorded at the first available exam session, without further checks of the knowledge acquired. Only in some cases, where the results of the intermediate tests, although potentially sufficient, do not provide clear evidence of the level of knowledge and skills reached by the student, a final oral-practical examination is required. These cases are individually motivated in detail.
If it is necessary to take an additional oral-practical test, or if the student decides not to accept the proposed grade as the final grade to be recorded, it is possible to take the oral-practical test in all the sessions provided for by the regulations and set by the instructors. In these cases, the "laboratory exemption" grade, which will remain unchanged and valid for the entire academic year, will be averaged with the result of the oral-practical exam, and to pass, this average must reach a sufficient level.
The oral-practical test covers both the theoretical topics contained in the syllabus and illustrated during the lectures, and programming and debugging practices that may be carried out on the computer during the oral-practical exam.
Bibliography
“Numerical Recipes in C”, Press, Teukolsky, …
Lesson mode
Approximately 30 hours of teaching in class and 10 practical
experiences in the lab
(https://elearning.uniroma1.it/course/view.php?id=2315)