Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197940 > unrolled thread

Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra?

Started by"Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid>
First post2026-09-06 23:29 +0800
Last post2026-09-07 05:08 +0000
Articles 14 — 7 participants

Back to article view | Back to comp.lang.python


Contents

  Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? "Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> - 2026-09-06 23:29 +0800
    Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? Thomas Koenig <tkoenig@netcologne.de> - 2026-09-06 15:32 +0000
      Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? "Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid> - 2026-09-06 23:53 +0800
      Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? Cóilín Nioclásín Glostéir <thanks-to@Taf.com> - 2026-09-06 17:30 +0000
        Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? Thomas Koenig <tkoenig@netcologne.de> - 2026-09-06 19:47 +0000
      Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? "David Jones" <dajhawkxx@nowherel.com> - 2026-09-06 18:40 +0000
        Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? Thomas Koenig <tkoenig@netcologne.de> - 2026-09-06 19:49 +0000
      Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-06 22:00 +0000
        Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-07 10:48 +0800
        Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? "Steven G. Kargl" <sgk@REMOVEtroutmask.apl.washington.edu> - 2026-09-07 04:41 +0000
          Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-07 13:24 +0800
          Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-07 06:47 +0000
            Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-07 16:32 +0800
        Re: Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra? Thomas Koenig <tkoenig@netcologne.de> - 2026-09-07 05:08 +0000

#197940 — Blog: Is Fortran better than Python for teaching the basics of numerical linear algebra?

From"Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid>
Date2026-09-06 23:29 +0800
SubjectBlog: Is Fortran better than Python for teaching the basics of numerical linear algebra?
Message-ID<WFfnS.67381$kqHe.6119@fx07.ams4>
Dear comp.lang.fortran, sci.math, and comp.lang.python,

I came across this blog post about the question which is better to teach
mathematics, Fortran or Python.  I'm currently still reading it, but
will share with you this introductory paragraph.

 > I’ve been teaching an /Intro to Scientific Computing/ class for nearly
 > 10+ years. This class is intended for second year engineering students
 > and, as such, places a large emphasis on numerical linear algebra.
 > Like the rest of Academia, I’m using a combination of Python and numpy
 > arrays for this. Yet, after all these years, I start to believe it
 > ain’t necessarily the right choice for a first encounter with
 > numerical linear algebra. Obvisouly everything is not black and white
 > and I’ll try to be nuanced. But, in my opinion, a strongly typed
 > language such as Fortran might lead to an overall better learning
 > experience. And that’s what it’s all about when you start Uni:
 > learning the principles of scientific programming, not the quirks of a
 > particular language (unless you’re a CS student, which is a different
 > crowd).

 From https://loiseaujc.github.io/posts/blog-title/fortran_vs_python.html
and you are best served by reading the blog post on your own.


Best wishes, and happy switching from Python to Fortran 77!
-- 
Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | via Easynews.com
https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;

[toc] | [next] | [standalone]


#197941

FromThomas Koenig <tkoenig@netcologne.de>
Date2026-09-06 15:32 +0000
Message-ID<117k135$2fr7o$1@dont-email.me>
In reply to#197940
Johann "Myrkraverk" Oskarsson <johann@myrkraverk.invalid> schrieb:

> Best wishes, and happy switching from Python to Fortran 77!

Fortran 77 makes little sense, modern Fortran variants (Fortran
90+) are available with free compilers and offer much more comfort
and safety.

-- 
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.

[toc] | [prev] | [next] | [standalone]


#197943

From"Johann \"Myrkraverk\" Oskarsson" <johann@myrkraverk.invalid>
Date2026-09-06 23:53 +0800
Message-ID<r0gnS.44764$5D1.27272@fx06.ams4>
In reply to#197941
On 9/6/2026 11:32 PM, Thomas Koenig wrote:
> Johann "Myrkraverk" Oskarsson <johann@myrkraverk.invalid> schrieb:
> 
>> Best wishes, and happy switching from Python to Fortran 77!
> 
> Fortran 77 makes little sense, modern Fortran variants (Fortran
> 90+) are available with free compilers and offer much more comfort
> and safety.
> 

The author of the blog has this to say on the subject.

 >>> When I write Fortran, what I really mean is modern Fortran, not
 >>> FORTRAN. Anything pre-dating the Fortran 90 standard (or even
 >>> better, the Fortran 2018 one) is not even an option (yes, I’m
 >>> looking at you FORTRAN 77 and your incomprehensible goto, error-
 >>> prone common, artithmetic if and what not).


And it's purely a /skill issue/.  Of course Fortran 77 is the better
programming language.
-- 
Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | via Easynews.com
https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;

[toc] | [prev] | [next] | [standalone]


#197944

FromCóilín Nioclásín Glostéir <thanks-to@Taf.com>
Date2026-09-06 17:30 +0000
Message-ID<117k7up$2q3e2$1@paganini.bofh.team>
In reply to#197941
Thomas Koenig <tkoenig@NetCologne.De> hat geschrieben:
|-------------------------------------------------------------------|
|"Johann "Myrkraverk" Oskarsson <johann@myrkraverk.invalid> schrieb:|
|                                                                   |
|> Best wishes, and happy switching from Python to Fortran 77!      |
|                                                                   |
|Fortran 77 makes little sense, modern Fortran variants (Fortran    |
|90+) are available with free compilers and offer much more comfort |
|and safety."                                                       |
|-------------------------------------------------------------------|

Are new versions of Fortran still much slower than FORTRAN 77?

Ada is better for safety.
(S. HTTP://Gloucester.Insomnia247.NL/ fuer Kontaktdaten!)

[toc] | [prev] | [next] | [standalone]


#197948

FromThomas Koenig <tkoenig@netcologne.de>
Date2026-09-06 19:47 +0000
Message-ID<117kg1d$2lev0$1@dont-email.me>
In reply to#197944
Cóilín Nioclásín Glostéir <thanks-to@Taf.com> schrieb:
> Thomas Koenig <tkoenig@NetCologne.De> hat geschrieben:
>|-------------------------------------------------------------------|
>|"Johann "Myrkraverk" Oskarsson <johann@myrkraverk.invalid> schrieb:|
>|                                                                   |
>|> Best wishes, and happy switching from Python to Fortran 77!      |
>|                                                                   |
>|Fortran 77 makes little sense, modern Fortran variants (Fortran    |
>|90+) are available with free compilers and offer much more comfort |
>|and safety."                                                       |
>|-------------------------------------------------------------------|
>
> Are new versions of Fortran still much slower than FORTRAN 77?

Depends on what you're doing, but in general, no.

>
> Ada is better for safety.

Different domains. While both languages are general-purpose,
Fortran is more oriented towards scientific and technical
application, for which you won't find Ada used much.

-- 
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.

[toc] | [prev] | [next] | [standalone]


#197947

From"David Jones" <dajhawkxx@nowherel.com>
Date2026-09-06 18:40 +0000
Message-ID<117kc3a$2k4g1$1@dont-email.me>
In reply to#197941
Thomas Koenig wrote:

> Johann "Myrkraverk" Oskarsson <johann@myrkraverk.invalid> schrieb:
> 
> > Best wishes, and happy switching from Python to Fortran 77!
> 
> Fortran 77 makes little sense, modern Fortran variants (Fortran
> 90+) are available with free compilers and offer much more comfort
> and safety.

Recall that the modern bits of modern Fortran might well lead a student
to leap to use of MATINV, when MATINV should not be used. Etc..
Students need to think in detail about what the computations in linear
algebra are doing.

[toc] | [prev] | [next] | [standalone]


#197949

FromThomas Koenig <tkoenig@netcologne.de>
Date2026-09-06 19:49 +0000
Message-ID<117kg4k$2lev0$2@dont-email.me>
In reply to#197947
David Jones <dajhawkxx@nowherel.com> schrieb:
> Thomas Koenig wrote:
>
>> Johann "Myrkraverk" Oskarsson <johann@myrkraverk.invalid> schrieb:
>> 
>> > Best wishes, and happy switching from Python to Fortran 77!
>> 
>> Fortran 77 makes little sense, modern Fortran variants (Fortran
>> 90+) are available with free compilers and offer much more comfort
>> and safety.
>
> Recall that the modern bits of modern Fortran might well lead a student
> to leap to use of MATINV, when MATINV should not be used. Etc..

Not sure what you mean by MATINV, it is not part of Fortran.  Fortran
does have MATMUL (which can usually be mapped to a BLAS routine).

> Students need to think in detail about what the computations in linear
> algebra are doing.

Not only that... numerics in general is a difficult field.
-- 
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.

[toc] | [prev] | [next] | [standalone]


#197950

FromLawrence D’Oliveiro <ldo@nz.invalid>
Date2026-09-06 22:00 +0000
Message-ID<117knq7$2o0bv$4@dont-email.me>
In reply to#197941
On Sun, 6 Sep 2026 15:32:53 -0000 (UTC), Thomas Koenig wrote:

> Fortran 77 makes little sense, modern Fortran variants (Fortran 90+)
> are available with free compilers and offer much more comfort and
> safety.

Python offers custom operator overloads, so you can write actual
operator expressions for addition, dot product etc -- closer in
appearance to the actual maths -- instead of parenthesis-ridden
function calls.

For a simple example, this method constructs a 3D homogeneous matrix
that performs arbitrary scaling about an arbitrary centre point:

    @classmethod
    def scaling_about(celf, factor : Vector4, centre : Vector4) :
        "constructs a Matrix4 that scales by the specified offset Vector4" \
        " about the specified centre."
        return \
          (
                celf.translation(centre)
            @
                celf.scaling(factor)
            @
                celf.translation(- centre)
          )
    #end scaling_about

From the body, you can see intuitively how it works, as the dot
product (“@” being the recommended Python operator to use for this) of
3 separate transformations: from right to left, you move the centre
point to the origin, perform the scaling about the origin, then
translate the origin back to the original centre point.

[toc] | [prev] | [next] | [standalone]


#197962

FromJohann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid>
Date2026-09-07 10:48 +0800
Message-ID<5CpnS.47802$NMu2.12089@fx15.ams4>
In reply to#197950
On 07/09/2026 6:00 AM, Lawrence D’Oliveiro wrote:
> On Sun, 6 Sep 2026 15:32:53 -0000 (UTC), Thomas Koenig wrote:
> 
>> Fortran 77 makes little sense, modern Fortran variants (Fortran 90+)
>> are available with free compilers and offer much more comfort and
>> safety.
> 
> Python offers custom operator overloads, so you can write actual
> operator expressions for addition, dot product etc -- closer in
> appearance to the actual maths -- instead of parenthesis-ridden
> function calls.
> 
[snip some irrelevant B.S.]

Lawrence, Lawrence, Lawrence!

Why are you even mentioning Pythong in this context?  Don't you know
we are talking about the superiourity [sic] of Fortran 77?

You know that Lua also has operator overloading, right?  Or are you
too busy snogging Kruger and Dunning, both at the same time?  Why are
you constantly posting about your snogging adventures in alt.sex.bon-
dage.sco.unix- -- and what is the minus doing at the end?

/I/ know, and knew before, that Lua has operator overloading.  It's im-
plemented with metatables -- unrelated to the recent meta adventures of
the Meta C.E.O. -- and didn't think to mention it in the context of For-
tran 77.


So please, enlighten us about your snogging adventures!
-- 
Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | via Easynews.com
https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;

[toc] | [prev] | [next] | [standalone]


#197963

From"Steven G. Kargl" <sgk@REMOVEtroutmask.apl.washington.edu>
Date2026-09-07 04:41 +0000
Message-ID<117lfa2$2u9p1$1@dont-email.me>
In reply to#197950
On Sun, 6 Sep 2026 22:00:39 -0000 (UTC), Lawrence D’Oliveiro wrote:

> On Sun, 6 Sep 2026 15:32:53 -0000 (UTC), Thomas Koenig wrote:
> 
>> Fortran 77 makes little sense, modern Fortran variants (Fortran 90+)
>> are available with free compilers and offer much more comfort and
>> safety.
> 
> Python offers custom operator overloads, so you can write actual
> operator expressions for addition, dot product etc -- closer in
> appearance to the actual maths -- instead of parenthesis-ridden
> function calls.

Can we assume you know little to nothing about modern
Fortran?  One can write custom operator overloads in
Fortran.  Here's a Cartesian point with a translation
and scaling operators.

module pointm

   implicit none

   type point_t
      real x, y, z
   end type point_t

   interface operator(-)
      module procedure translate
   end interface

   interface operator(*)
      module procedure left
      module procedure rght
   end interface

   contains

      function translate(pt1, pt2) result(r)
         type(point_t) r
         type(point_t), intent(in) :: pt1, pt2
         r%x = pt1%x - pt2%x
         r%y = pt1%y - pt2%y
         r%z = pt1%z - pt2%z
      end function translate

      function left(c, pt1) result(r)
         type(point_t) r
         real, intent(in) :: c
         type(point_t), intent(in) :: pt1
         r%x = c * pt1%x
         r%y = c * pt1%y
         r%z = c * pt1%z
      end function left

      function rght(pt1, c) result(r)
         type(point_t) r
         real, intent(in) :: c
         type(point_t), intent(in) :: pt1
         r%x = c * pt1%x
         r%y = c * pt1%y
         r%z = c * pt1%z
      end function rght

end module pointm

program foo
   use pointm
   type(point_t) :: a = point_t(1, 1, 1),  b = point_t(0.5, 0.75, 2)
   print "(3F6.2)", a - b
   print "(3F6.2)", 3. * a - 4. * b
end program

-- 
steve

[toc] | [prev] | [next] | [standalone]


#197965

FromJohann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid>
Date2026-09-07 13:24 +0800
Message-ID<HUrnS.114879$Nn1.56963@fx18.ams4>
In reply to#197963
On 07/09/2026 12:41 PM, Steven G. Kargl wrote:
> On Sun, 6 Sep 2026 22:00:39 -0000 (UTC), Lawrence D’Oliveiro wrote:
> 
>> On Sun, 6 Sep 2026 15:32:53 -0000 (UTC), Thomas Koenig wrote:
>>
>>> Fortran 77 makes little sense, modern Fortran variants (Fortran 90+)
>>> are available with free compilers and offer much more comfort and
>>> safety.
>>
>> Python offers custom operator overloads, so you can write actual
>> operator expressions for addition, dot product etc -- closer in
>> appearance to the actual maths -- instead of parenthesis-ridden
>> function calls.
> 
> Can we assume you know little to nothing about modern
> Fortran?  One can write custom operator overloads in
> Fortran.  Here's a Cartesian point with a translation
> and scaling operators.
> 

[snip program]

Dear Steven,

I'm pleased you've met Lawrence.  He is in fact, not a programmer,
but a /Pythong influencer/.  I'm sure he gets paid by the post.

I in fact did not know modern Fortran has operator overloading, as I
haven't had a reason to use it since Fortran 77.  It was a delightful
experience I still remember.


Thank you for the enlightenment!
-- 
Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | via Easynews.com
https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;

[toc] | [prev] | [next] | [standalone]


#197968

FromLawrence D’Oliveiro <ldo@nz.invalid>
Date2026-09-07 06:47 +0000
Message-ID<117lmmb$30p2c$2@dont-email.me>
In reply to#197963
On Mon, 7 Sep 2026 04:41:38 -0000 (UTC), Steven G. Kargl wrote:

> On Sun, 6 Sep 2026 22:00:39 -0000 (UTC), Lawrence D’Oliveiro wrote:
>
>> On Sun, 6 Sep 2026 15:32:53 -0000 (UTC), Thomas Koenig wrote:
>>
>>> Fortran 77 makes little sense, modern Fortran variants (Fortran
>>> 90+) are available with free compilers and offer much more comfort
>>> and safety.
>>
>> Python offers custom operator overloads, so you can write actual
>> operator expressions for addition, dot product etc -- closer in
>> appearance to the actual maths -- instead of parenthesis-ridden
>> function calls.
>
> Can we assume you know little to nothing about modern Fortran? One
> can write custom operator overloads in Fortran.

Something else I can do in Python is write things that look a lot like
new custom operators. E.g. a cross product between two 3D vectors
could be written (with a suitable definition of the “cross” property)
as

    v1 .cross* v2

without unnecessary parentheses.

[toc] | [prev] | [next] | [standalone]


#197969

FromJohann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid>
Date2026-09-07 16:32 +0800
Message-ID<oEunS.271260$yky7.52191@fx09.ams4>
In reply to#197968
On 07/09/2026 2:47 PM, Lawrence D’Oliveiro wrote:
> On Mon, 7 Sep 2026 04:41:38 -0000 (UTC), Steven G. Kargl wrote:
> 
>> On Sun, 6 Sep 2026 22:00:39 -0000 (UTC), Lawrence D’Oliveiro wrote:
>>
>>> On Sun, 6 Sep 2026 15:32:53 -0000 (UTC), Thomas Koenig wrote:
>>>
>>>> Fortran 77 makes little sense, modern Fortran variants (Fortran
>>>> 90+) are available with free compilers and offer much more comfort
>>>> and safety.
>>>
>>> Python offers custom operator overloads, so you can write actual
>>> operator expressions for addition, dot product etc -- closer in
>>> appearance to the actual maths -- instead of parenthesis-ridden
>>> function calls.
>>
>> Can we assume you know little to nothing about modern Fortran? One
>> can write custom operator overloads in Fortran.
> 
> Something else I can do in Python is write things that look a lot like
> new custom operators. E.g. a cross product between two 3D vectors
> could be written (with a suitable definition of the “cross” property)
> as
> 
>      v1 .cross* v2
> 
> without unnecessary parentheses.

So?  Hasn't that been available since 1974 in the ML [1] programming
language?  Or was that added for the upgrade in 1997?  I admit I've
only read /The Definition of Standard ML (Revised Edition)/ (1997) and
not the original from 1974.

You're not gaining any /internet points/ by trying to pretend something
was invented by Guido van Rossum!


[1] Unrelated to /machine learning/, it's the /meta language/ of Edin-
burg.
-- 
Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
I'm not from the Internet, I just work there. | via Easynews.com
https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;

[toc] | [prev] | [next] | [standalone]


#197964

FromThomas Koenig <tkoenig@netcologne.de>
Date2026-09-07 05:08 +0000
Message-ID<117lgs2$2v762$2@dont-email.me>
In reply to#197950
Lawrence D’Oliveiro <ldo@nz.invalid> schrieb:
> On Sun, 6 Sep 2026 15:32:53 -0000 (UTC), Thomas Koenig wrote:
>
>> Fortran 77 makes little sense, modern Fortran variants (Fortran 90+)
>> are available with free compilers and offer much more comfort and
>> safety.
>
> Python offers custom operator overloads, so you can write actual
> operator expressions for addition, dot product etc -- closer in
> appearance to the actual maths -- instead of parenthesis-ridden
> function calls.

So does Fortran.

-- 
This USENET posting was made without artificial intelligence,
artificial impertinence, artificial arrogance, artificial stupidity,
artificial flavorings or artificial colorants.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web