Is Fortran better than Python for teaching basics of numerical linear algebra?
Language choice for teaching
- Many argue MATLAB/Octave is the best fit for an introductory numerical linear algebra course: matrix syntax matches notation, plotting is integrated, and there’s minimal boilerplate.
- Others prefer Julia, emphasizing: math-first design, multiple dispatch as ideal for linear algebra, good REPL/notebooks, and clean translation from blackboard to code.
- Fortran is defended as simple, regular, and still excellent for numerics; critics reply that its real-world use is shrinking and that teaching it is like teaching Latin for medicine.
- Several say the “right” language is whatever the students already know from an intro programming course; others counter that you must pick one, and Python is far more broadly useful afterward.
Fortran vs Python specifically
- Pro-Fortran points: strong static typing, clear function/subroutine interfaces, 1-based indexing matching textbooks, fewer “performance surprises,” and closer alignment with how arrays are treated in math.
- Anti-Fortran points: worse debugging experience than MATLAB/Python for some, weaker integrated plotting, extra friction from linking external libraries, and limited direct applicability outside numerics.
- Python is criticized as a general-purpose language with math “bolted on,” runtime type errors, implicit widening of floats, and opaque idioms like
import numpy as np. - Defenders say Python’s ecosystem (NumPy, SciPy, JAX, Numba, plotting) and ease of experimentation outweigh its warts for teaching and for quickly exploring numerics.
Julia and other contenders
- Some think the post underplays Julia, which already sees classroom use in numerical methods; they argue it addresses the Python complaints while remaining high-level.
- There’s debate over Julia’s performance vs Fortran/C; consensus in the thread: Julia can match Fortran if written in a low-level style but may surprise you more often.
- Concerns are raised about pedagogical use of Unicode/Greek variable names in Julia; others say you can simply avoid that subset when teaching.
- R, Ada, APL, and Chapel are mentioned as interesting but niche alternatives; APL is praised for mathematical notation but noted to have its own “bag of surprises.”
Pedagogy, tooling, and indexing
- Multiple commenters stress that teaching approach (avoiding unnecessary OOP layers, minimizing boilerplate) matters more than 0- vs 1-based indexing or language fashion.
- 1-based indexing is seen as pragmatically helpful because almost all textbooks use it.
- Fortran’s modern tooling (package manager, plotting bindings) exists but is less “batteries-included” than Python/Jupyter or MATLAB, which may increase setup burden for students.