FYSS5120 Efficient Numerical Programming
Hi, I'm Vesa Apaja, and I'll be lecturing this course starting September 2025.
My office is in JYU Nanoscience Center YN223, and my email is vesa.apaja at jyu.fi
I'm a Linux guy with very limited experience on Microsoft or Apple products (for historical reasons,
I didn't have any money when I got to this business).
I've taken a couple of courses on C++ (ancient C++, before there was any standard), none on Python or Julia.
Given the circumstances, I had to self-learn programming. Some think I did learn something,
so the first programming language I was teaching was C, following the legendary The C programming language by
Dennis Ritchie and Brian Kernighan.
Despite of little or no tutoring, I have written way too many lines of code.
These lectures and demos are intended to give you enough confidence to use Python, Julia or C++
in the challenges you face during your studies and ever after. Learning programming is not much different
to learning a spoken language: start programming and make mistakes.
Fortunately, it's very hard to upset a computer.
This course covers only programming from the point of view of numerics.
The attribute "efficient" was added for sales purposes by someone else. People used to
call numerics "number crunching", but we've come to value also the human time spent in coding
- mainly because coders are well paid. So I've been told. Fast coding is were Python excels.
Sometimes you need to spend hours to push your code to the speed that will quarantee
some output in a reasonable time. C++ stands in that corner. Julia is somewhere in between.
Motto: If I could learn programming, so can you.
Welcome!
Structure
- 4 cr, evaluation accepted/rejected
- 14 Lectures on Tuesdays and Thursdays at 12:15-14:00 in FYS2 (YFL343)
- First lecture 2 September 2025
- 6 demo sessions on Thursdays at 10:15-12:00 in FYS5 (YFL226)
- First demo 11 September 2025
Requirements
- Accepted solutions to programming assignments (demos 2-6)
Demo 1 solved in the first demo session.
Demos 2-6 will be tutored in demo sessions.
- No Exam
- For the programming tasks you need a computer.
A laptop will do.
Three options:
- Option 0.1: Use Python from Google Colab
- Pros: Install nothing, just start using Python
- Cons: System and hardware limited, no long jobs, pip installed packages
vanish after session, GPU availability varies. No Julia or C++.
- Option 0.2: Use Jupyterlite notebook from
jupyterlite.github.io
- Pros: Install nothing, just start using a Jupyter notebook. Many packages available
via Pyodide (NumPy, Pandas, Matplotlib, SciPy, etc.).
- Cons: System and hardware limited, low performance, no GPU. No Julia or C++.
- Option 1: Install the necessary programs to your computer.
- Pros: You learn a lot, only sky is the limit
- Cons: You do all the work, consume disk space, and the laptop heats up.
What you need to install:
- A recent Python (3.6 or newer, install NumPy, Scipy etc.)
- To try out the C++ codes, a recent C++ compiler, GSL and armadillo libraries.
- Option 2: For JYU students
- Pros: Almost nothing to install
- Cons: Poor graphics, the server is often under heavy load.
Prerequisites:
Go to account.jyu.fi/oma/services
and check the box "Unix shell server logon right". Activation may take a few minutes.
Log in the Physics Department server kone.phys.jyu.fi using JYU user name and password.
Use the environment modules (version numbers may change)
- python/3.10.6
- julia/1.8.0
- gcc/12.2.0
- boost/1.80.0
- mpi/openmpi-x86_64
- pmi/pmix-x86_64
For example, the command "ml add python" makes available a fairly recent Python.
(Why modules? Because the system versions of the programs are from dark ages)
Material
-
Lecture notes (all.pdf)
The lecture notes contain mostly Python, Julia, and C++. The C++ portion
has shrunk to give way to Python.
Lecture timetable: TBA
- Programming tasks
Demo 1 will be "solved" in the first demo session.
Demos 2-6 will be tutored in demo sessions, but I'll leave some programming for you.
- Sample code
Extra material