Need help with ComputationalPhysics?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

171 Stars 102 Forks Creative Commons Zero v1.0 Universal 886 Commits 7 Opened issues


Introductory course in Computational Physics, including linear algebra, eigenvalue problems, differential equations, Monte Carlo methods and more.

Services available


Need anything else?

Contributors list

Computational Physics

The material here aims at giving you an introduction to several of the most used algorithms in Computational Science. These algorithms cover topics such as advanced numerical integration using Gaussian quadrature, Monte Carlo methods with applications to random processes, Markov chains, integration of multidimensional integrals and applications to problems in statistical physics and quantum mechanics. Other methods which are presented are eigenvalue problems, from the simple Jacobi method to iterative Krylov methods. Popular methods from linear algebra are also discussed. A good fraction of the course is also devoted to solving ordinary differential equations with or without boundary conditions and finally methods for solving partial differential equations. You will also find material on popular Machine Learning algorithms, starting with various linear regression methods and ending with neural networks. The focus for the Machine Learning algorithms is on supervised learning.

The course is project based and through various projects, normally four to five, you will be exposed to fundamental research problems from various fields (Physics, Geophysics, Chemistry, Mathematics, Statistics etc), where, if possible, we aim at reproducing state of the art scientific results. You will learn to develop and structure codes when solving the projects, develop a critical understanding of the strengths and limits of the various numerical methods, become familiar with supercomputing facilities and parallel computing and learn to write scientific projects.

Instructors information

  • Name: Morten Hjorth-Jensen
    • Email: [email protected]
    • Phone: +47-48257387
    • Office: Department of Physics, University of Oslo, Eastern wing room 470
    • Office hours: Anytime! In Fall Semester 2020 (FS20), as a rule of thumb office hours are planned via computer or telephone. Individual or group office hours will be performed via zoom. Feel free to send an email for planning. In person meetings may also be possible if allowed by the University of Oslo's COVID-19 instructions (see below for links).
  • Name: Anders Kvellestad
    • Email: [email protected]
    • Office: Department of Physics, University of Oslo, Eastern wing room 447

Teaching Assistants FS20


This course will be delivered in a hybrid mode, with online lectures and on site or online laboratory sessions.

  1. Four lectures per week, Fall semester, 10 ECTS. The lectures will be fully online. The lectures will be recorded and linked to this site and the official University of Oslo website for the course;
  2. Two hours of laboratory sessions for work on computational projects for each group. Due to social distancing, at most 15 participants can attend. There will also be fully digital laboratory sessions for those who cannot attend physically;
  3. Three projects which are graded and count 1/3 each of the final grade, five projects in total;
  4. The course is offered as FYS4150 (Master of Science level) and FYS3150 (senior undergraduate level);
  5. We use Piazza for course communication, a special link on how to register to Piazza can be found at the official University of Oslo page for the course or just use the link here We use Canvas at UiO for delivery of projects;
  6. Videos of teaching material are available via the links below here;
  7. Weekly emails with summary of activities will be mailed to all participants;


Grading scale: Grades are awarded on a scale from A to F, where A is the best grade and F is a fail. There are three projects which are graded and each project counts 1/3 of the final grade. The total score is thus the average from all three projects.

The final number of points is based on the average of all projects (including eventual additional points) and the grade follows the following table:

  • 92-100 points: A
  • 77-91 points: B
  • 58-76 points: C
  • 46-57 points: D
  • 40-45 points: E
  • 0-39 points: F-failed

Required Technologies

Course participants are expected to have their own laptops/PCs. We use Git as version control software and the usage of providers like GitHub, GitLab or similar are strongly recommended.

We will make extensive use of C++ and/or Python as programming language and its myriad of available libraries. You can also use compiled languages like Rust, Julia, Fortran etc if you prefer. Beware that in case you use Rust or Julia we may not be able to help you properly at the lab.

The focus during the lectures will be on C++. Please read the intro to C++ programming at

This link contains info about installing compilers as well.

If you have Python installed and you feel pretty familiar with installing different packages, we recommend that you install the following Python packages via pip as

  • pip install numpy scipy matplotlib ipython sympy and obviously many other packages.

For OSX users we recommend, after having installed Xcode, to install brew. Brew allows for a seamless installation of additional software via for example

  • brew install python

For Linux users, with its variety of distributions like for example the widely popular Ubuntu distribution, you can use pip as well and simply install Python as

  • sudo apt-get install python

Python installers

If you don't want to perform these operations separately and venture into the hassle of exploring how to set up dependencies and paths, we recommend two widely used distrubutions which set up all relevant dependencies for Python, namely

  • Anaconda:,

which is an open source distribution of the Python and R programming languages for large-scale data processing, predictive analytics, and scientific computing, that aims to simplify package management and deployment. Package versions are managed by the package management system conda.

  • Enthought canopy:

is a Python distribution for scientific and analytic computing distribution and analysis environment, available for free and under a commercial license.

Furthermore, Google's Colab: is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud. Try it out!

Useful Python libraries

Here we list several useful Python libraries we strongly recommend (if you use anaconda many of these are already there)

  • NumPy: is a highly popular library for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays
  • The pandas: library provides high-performance, easy-to-use data structures and data analysis tools
  • Xarray: is a Python package that makes working with labelled multi-dimensional arrays simple, efficient, and fun!
  • Scipy: (pronounced “Sigh Pie”) is a Python-based ecosystem of open-source software for mathematics, science, and engineering.
  • Matplotlib: is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms.
  • Autograd: can automatically differentiate native Python and Numpy code. It can handle a large subset of Python's features, including loops, ifs, recursion and closures, and it can even take derivatives of derivatives of derivatives
  • SymPy: is a Python library for symbolic mathematics.
  • scikit-learn: has simple and efficient tools for machine learning, data mining and data analysis
  • TensorFlow: is a Python library for fast numerical computing created and released by Google
  • Keras: is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano
  • And many more such as pytorch:, Theano: etc


Recommended textbooks: - Morten Hjorth-Jensen, Introduction to Computational Physics, IoP, in press. The version from 2015 at will be updated shortly. - Philipp O.J. Scherer, Computational Physics, Simulation of Classical and Quantum Systems, (can be downloaded for free if you are connected with a UiO IP-number).

Face coverings.

As of now this is not required, but the situation may change. If face covering will be required during the semester, we will fill in more details.

Physical distancing

We will be practicing physical distancing in the classroom dedicated to the lab sessions. Thus, everybody should maintain at least one meter distance between themselves and others (excluding those with whom they live). This applies to all aspects of the classroom setting, including seating arrangements, informal conversations, and dialogue between teachers and students.

Personal Hygiene

All participants attending the laboratory sessions must maintain proper hygiene and health practices, including: * frequently wash with soap and water or, if soap is unavailable, using hand sanitizer with at least 60% alcohol; * Routinely cleaning and sanitizing living spaces and/or workspace; * Using the bend of the elbow or shoulder to shield a cough or sneeze; * Refraining from shaking hands;

Adherence to Signage and Instructions

Course participants will (a) look for instructional signs posted by UiO or public health authorities, (b) observe instructions from UiO or public health authorities that are emailed to my “” account, and (c) follow those instructions. The relevant links are and


Students will self-monitor for flu-like symptoms (for example, cough, shortness of breath, difficulty breathing, fever, sore throat or loss of taste or smell). If a student experiences any flu-like symptoms, they will stay home and contact a health care provider to determine what steps should be taken.

Exposure to COVID-19

If a student is exposed to someone who is ill or has tested positive for the COVID-19 virus, they will stay home, contact a health care provider and follow all public health recommendations. You may also contact the study administration of the department where you are registered as student.

Compliance and reporting

Those who come to UiO facilities must commit to the personal responsibility necessary for us to remain as safe as possible, including following the specific guidelines outlined in this syllabus and provided by UiO more broadly (see links below here).

Additional information

See and For English version, click on the relevant link.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.