Course detail

Programming in Python for Physicists

FSI-TPY Acad. year: 2027/2028 Winter semester

The course introduces students to the fundamentals of programming in Python and its application to the numerical solution and visualisation of physics problems. Teaching combines algorithmic thinking, data processing, numerical methods and simple modelling of physical processes.

 

Students learn to work with variables, data structures, control flow constructs, functions, modules and basic program organisation. They become familiar with NumPy, SciPy and Matplotlib and their use for array computations, numerical differentiation and integration, solving ordinary and partial differential equations, interpolation, Fourier analysis and graphical presentation of results.

 

Practical classes focus on writing, testing and modifying programs that solve selected problems in mechanics and other areas of physics. Students complete an individual programming project demonstrating a working simulation or numerical solution of a simple physics problem.

Language of instruction

Czech

Number of ECTS credits

2

Learning outcomes of the course unit

Students demonstrate that they can:

  1. Create and run a Python program using variables, loops, conditionals and user-defined functions.
  2. Load and process data and produce an appropriate plot using NumPy, Pandas and Matplotlib.
  3. Numerically calculate a selected integral or derivative and assess whether the result is reasonable.
  4. Use an available numerical tool to solve a simple ordinary differential equation.
  5. Implement a simple simulation of a physical process and appropriately visualise its results.
  6. Submit functional, clearly organised source code with instructions for running it.
  7. Explain the chosen algorithm, the basic assumptions of the model and the limitations of the results.

Entry knowledge

Basic knowledge of Python at the level of the introductory Computer Science 1IN course and general secondary-school computer literacy are expected. The course also assumes knowledge of mathematics and physics, particularly functions, equations, vectors and the description of motion. A basic description of each physics problem being solved is always included in the teaching.

Rules for evaluation and completion of the course

The course is completed by a pass/fail course credit based on the submission of an individual semester project. Attendance at lectures is optional; attendance at computer-based practical classes is compulsory. The instructor records attendance during practical classes. Two unexcused absences are permitted. Students must independently make up the material missed using the e-learning resources.

 

The semester project consists of developing a working Python program that solves or simulates a simple physics problem. Students submit the source code, a brief description of the problem and the numerical procedure used, instructions for running the program and sample results. The program must be executable, and the results must be appropriately interpreted. During the review, students explain the essential parts of the algorithm and how they verified the correctness of the results.

 

 

The use of AI tools in programming is permitted; however, students must understand the code they submit and remain responsible for its correctness.

Aims

The goal is to develop proficiency in using Python for engineering practice.

Upon completion, students will be able to:

  1. Explain the basic programming constructs of Python and the principles of structuring a simple program.
  2. Use standard data structures, functions and modules to solve computational problems.
  3. Use NumPy, SciPy and Matplotlib for numerical computations and graphical presentation of results.
  4. Explain the principles of selected numerical methods and their limitations.
  5. Design and implement an algorithm for a simple physics simulation and verify that its results are physically reasonable.
  6. Clearly document and present their own programming solution.

Study aids

Teaching materials, exercise assignments and semester-project instructions are provided through the VUT e-learning course listed for the subject. Practical work uses Python and the NumPy, SciPy, Pandas and Matplotlib libraries, as well as the Jupyter environment where needed.

The study programmes with the given course

Programme B-FIN-P: Physical Engineering and Nanotechnology, Bachelor's, compulsory-optional

Type of course unit

 

Lecture

13 hours, optionally

Syllabus


  1. Introduction to Python and the scientific computing environment. Scripts, libraries, Jupyter and work organisation.

  2. Variables, basic data types, lists, tuples and dictionaries, conditionals, loops, functions, modules and program structure.

  3. NumPy: vectors, matrices, indexing and vectorised computations. Linear algebra and solving systems of equations.

  4. Numerical differentiation and integration. Errors and computational accuracy.

  5. Ordinary differential equations. Euler’s method and Runge–Kutta methods.

  6. Git – code management and version control.

  7. Partial differential equations, finite difference method.

  8. Partial differential equations, time evolution, convergence criteria.

  9. Fourier transform (FFT) and basic signal processing. Damping and Q factor.

  10. Loading, processing and filtering data. Data parsing and regular expressions.

  11. Object-oriented programming, simulation of the motion of multiple bodies.

  12. Review of numerical methods, verification of results.

  13. Presentation of semester projects.

Computer-assisted exercise

13 hours, compulsory

Syllabus


  1. Setting up the working environment, running a script and working with files.

  2. Data types, lists, tuples, dictionaries and simple exercises.

  3. NumPy: arrays, matrices and vector computations. Linear algebra.

  4. Numerical differentiation and integration.

  5. Numerical solution of ordinary differential equations. Damped oscillations.

  6. Git – code management and version control.

  7. Partial differential equations. Laplace’s equation, use of sparse matrices.

  8. Partial differential equations. The heat equation, stationary and time-dependent cases. Animation of time evolution.

  9. Fourier transform (FFT). Analysis of a simple signal and analysis of a damped-oscillation simulation.

  10. Loading data, filtering values and fitting relationships. Use of regular expressions.

  11. Object-oriented programming, simulation of the motion of multiple bodies.

  12. Consultations and ongoing testing of the semester project.

  13. Submission and review of the semester project.