Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

MARTIN 1966 Fortran Code

JohnNichols
Valued Contributor III
6,867 Views

In the twitter account of the guru who owns the degenerateconic.com website, he refers to a paper published in 1966 by Martin, I assume the precursor to Marriet Martin. It includes a complete computer program in Fortran for determining space trajectories for vehicles, this is the oldest Fortran I have ever seen, I have worked on a lot of 1968 code from USC Powell's famous group, but not this old.  

It is interesting to read the problems they encountered. 

I did use punch cards in 1976 at Newcastle University and the long slog to the computing center. 

I enclose the paper for anyone who wants a historical read. 

This is 20 years before the PC. 

John

0 Kudos
55 Replies
JohnNichols
Valued Contributor III
1,439 Views

Is it any mistake that 42 is so good and is numbered 42 -- 

0 Kudos
JohnNichols
Valued Contributor III
1,439 Views

Found 120 on another web site 

Adapting old programs to fit new machines usually means adapting new machines to behave like old ones.

Seems to apply to this topic 

0 Kudos
FortranFan
Honored Contributor III
1,439 Views

Nichols, John wrote:

Alan Perlis said it best ..

Thanks to (non-)"geniuses" like Richards of BCPL language (precursor to C) and Dijkstra and others in computer engineering, zero-based indexing is ubiquitous and pernicious.  One can pay "homage" to their "success" with "zeroth" law of programming.:

0. Perlisisms may sound like words full of practical wisdom, they are words of no wisdom when it comes to practice.

 

 

0 Kudos
GVautier
New Contributor II
1,439 Views

A 3D view of the trajectory (thanks to Autocad)

yellow Moon

green spacecraft

cyan Earth

 

0 Kudos
John_Campbell
New Contributor II
1,439 Views

jimdempseyatthecove (Blackbelt) wrote:

I should comment that the pseudo Fortran code

R(1:16) = SQRT(Particles%X(I:I+15) - Planet%X)**2 + Particles%Y(I:I+15) - Planet%Y)**2 + Particles%Z(I:I+15) - Planet%Z)**2)

Is not written that way in your source code, rather the compiler optimizations will perform the above within a loop with statement of

R = SQRT(Particles%X(I) - Planet%X)**2 + Particles%Y(I) - Planet%Y)**2 + Particles%Z(I) - Planet%Z)**2)

IOW when R has local scope and the compiler can determine the loop is incremental, and properties are contiguous, then it will auto vectorize the code (to the extent of the vectorization options given at compile time).

Note, other than the type declarations (and allocations), the stylization difference in source code is... well style

DO I=1,nParticles
  R = SQRT( (Particles(I)%X-Planet%X)**2 + (Particles(I)%Y-Planet%Y)**2 + (Particles(I)%Z-Planet%Z)**2)

verses

DO I=1,nParticles
  R = SQRT(Particles%X(I) - Planet%X)**2 + Particles%Y(I) - Planet%Y)**2 + Particles%Z(I) - Planet%Z)**2)

Performance impact is quite different.

Jim Dempsey

Reading this "pseudo Fortran" I am struggling to understand the second option (and probably the first):

DO I=1,nParticles
  R = SQRT(Particles%X(I) - Planet%X)**2 + Particles%Y(I) - Planet%Y)**2 + Particles%Z(I) - Planet%Z)**2)

What does this produce ?
I can't resolve the brackets and arrive at the correct SQRT or appreciate the array syntax implied.

My preference would be to write the correct Fortran syntax with extra DO loops and allow the compiler to optimize/vectorize.

Hopefully this would produce the correct calculation.

0 Kudos
mecej4
Honored Contributor III
1,439 Views

Yes, Jim should have written:

 R = SQRT((Particles%X(I) - Planet%X)**2 + (Particles%Y(I) - Planet%Y)**2 + (Particles%Z(I) - Planet%Z)**2)

0 Kudos
JohnNichols
Valued Contributor III
1,439 Views

R = SQRT(((Particles%X(I) - Planet%X)**2) +( (Particles%Y(I) - Planet%Y)**2) +( (Particles%Z(I) - Planet%Z)**2))

That is why I prefer lisp - you do not have to worry about precedence - although Fortran is not LISP

0 Kudos
gib
New Contributor II
1,439 Views

On slide rules: my father, who was a professor of electrical engineering, had a circular slide rule.  He used to challenge his students that he could get answers more quickly on it than they could using calculators - to only 2 or 3 significant figures, of course.  I wish I knew what happened to that slide rule.

0 Kudos
JohnNichols
Valued Contributor III
1,440 Views

The answers are probably accurate to only 2 or 3 decimal places in reality in most engineering - we make so many assumptions that often the design is somewhat divorced from reality - especially in CIVIL. 

Intel's problem with the 7nm chips is an interesting example of engineering hitting physics. Physics always wins.

You can buy a slide rule 

My mother went to Hong Kong in 1985. She asked me what she could get me - a new HP calculator I said - I did not say HP12 - mum returns with a HP16 and says it was a 12 or 16 so i got the higher number. it was computer science - so no sin tan etc.. 

I still use that calculator and when I was doing a lot of design and teaching of statics I used to use it - just got to remember all the sines cos etc. of course you make it simple by only using 30 60 and 45. 

My students would be doing statics problems and were slow with calculators - you can do it often in your head quicker. 

 

 

0 Kudos
mecej4
Honored Contributor III
1,440 Views

See https://www.sliderulemuseum.com

There is even a section for the non-sliding variety: https://www.sliderulemuseum.com/Slidecharts.htm

 

0 Kudos
JohnNichols
Valued Contributor III
1,440 Views

My biggest problem is the students with the Texas Instruments calculators - they are no where near as good to use as the HP rpn. 

A bit like matlab and intel fortran 

0 Kudos
gib
New Contributor II
1,440 Views

Thanks, mecej4, that's a fascinating site.  I never knew about all those circular slide rules - mostly specialised for a single purpose, apparently.  Interesting comment from Seymour Cray about using a 10" device - my father's was small enough to fit in his shirt pocket.

0 Kudos
mecej4
Honored Contributor III
1,440 Views

There were even some cylindrical slide rules for use when one needed more accuracy than possible with the typical 6-in, 12-in and 24-in straight slide rules. Here is a picture of one with an effective length of 20 meters: https://www.sliderulemuseum.com/Switzerland.htm .

0 Kudos
gib
New Contributor II
1,440 Views

Amazing!  When I read of Cray's 10" circular slide rule I thought 10" was the diameter, but I now see that it was the circumference, implying a diameter of about 3.2", similar to my father's.

0 Kudos
Reply