Hacker News new | ask | show | jobs
by nivter 267 days ago
If it's about teaching and not about efficiency, why not just use plain Python? One could argue it is actually better since students don't have to worry about typing and syntax, and it allows a gentler introduction to commonly used tools like jax and numpy while getting comfortable with the language.
2 comments

Numerical linear algebra is intrinsically strongly typed. The same algorithms that work in double or extended double precision may not work at single or half precision.

Pure python has a tendency to silently widen every floating point type to double. Numpy overlays a C ABI on top of python’s oversimplified type system, which complicates matters further.

I wouldn’t teach numerical linear algebra in any weakly typed language.

> since students don't have to worry about typing and syntax

As someone who regularly teaches intro programming using Python, I assure you that students learning Python need to worry both about types and about syntax, and the fact that both are invisible does them less favours than you might think. Type errors happen all the time in Python, but they aren't caught until runtime and only when given the right test cases, and the error message points somewhere in the program that may be quite distant from the place where the problem actually is. Syntax errors are less common for experienced programmers, but newcomers struggle just as much with syntax in Python as they do in languages like C++ and Java (both of which I've also taught intro programmers using).