Fortran Comparing Fortran and Pascal: Advantages & Uses

  • Thread starter Thread starter Tom83B
  • Start date Start date
  • Tags Tags
    Fortran Pascal
Click For Summary
Fortran is recognized for its effectiveness in scientific computations, largely due to its long-standing use in the field, which has resulted in extensive libraries and optimizations specifically for Fortran compilers on supercomputers. Despite its advantages, Pascal is considered outdated for such applications, with its use in modern physics education viewed as nostalgic rather than practical. While some institutions, like Charles University in Prague, still teach Pascal, it is largely overshadowed by languages like Fortran, C++, and mathematical software such as Matlab and Mathematica, which dominate both research and the job market. The discussion also highlights the limitations of Pascal's compiler support and the evolution of programming languages, with a growing preference for modern languages like Python for new learners. Delphi, an evolution of Pascal, is noted for its readability but lacks certain functionalities critical for scientific computing. Overall, the consensus is that while Pascal has historical significance, it is increasingly irrelevant in contemporary programming contexts.
Tom83B
Messages
45
Reaction score
0
Hi,
I heard that fortran is quite a useful language for some scientific computations, so I looked it up to see what is looks like and I was surprised that the syntax is very similar to Pascal. I know that syntax doesn't mean anything, but it seems to me that when languages have a similar syntax they are similar in most of the aspects...

Is Pascal ever used in the same way as Fortran? I know that at Charles University in Prague physics student are taught only Pascal in a subject called programming for physicist (later on they can probably choose some other languages as well, like C++ etc.).

Why is Fortran so good for these computations? Does it really have so many advantages or is it just the favourite language of physicist because they've been using it for decades?

Thanks for your answers.
 
Technology news on Phys.org
Tom83B said:
Why is Fortran so good for these computations? Does it really have so many advantages or is it just the favourite language of physicist because they've been using it for decades?
The fact that Fortran has been used for decades means there are huge libraries of Fortran code that would take years of recoding and debugging to convert to other languages. Another factor is that on some super-computers, more work has been done on adding extensions and optimizations to Fortran compilers on those computers versus other languages for those computers (a choice made because of legacy of Fortran).
 
Thanks.
 
Tom83B said:
Is Pascal ever used in the same way as Fortran? I know that at Charles University in Prague physics student are taught only Pascal in a subject called programming for physicist (later on they can probably choose some other languages as well, like C++ etc.).

Teaching Pascal to physics undergrads is '80s out-dated thinking. Pascal is nowadays seldom used in either research-level physics computation or software job market. The former is dominated by Fortran, C++, and mathematical packages like Matlab and Mathematica. The latter is dominated by Java, C#, C++ etc. The only reason to teach Pascal is nostalgia.
 
petergreat said:
The only reason to teach Pascal is nostalgia.
That's interesting. I think some high schools here teach Pascal as well. I always thought it was because of the easy syntax, but now it seemed to me, that most of other schools teach languages like Java, Fortran or C++ from the beginning (currently I'm on high school in Germany and they teach us Java)
 
Pascal's compiler support is dreadful nowadays. Borland / Turbo Pascal was a good product back in the DOS days, but it's outdated now. The open-source Free Pascal Compiler is way behind the free GCC/G++ compiler for C/C++, in terms of functionality, optimization, 3rd party support etc.. As for IDEs, Lazaurus is way behind Visual C++. Delphi may be good, but it no longer has a free student version, and the price is too high for amateurs. I actually liked pascal, but there's no longer any reason for me to continue using it. Pascal has been very influential in the historical development and evolution of programming languages, but it's fading away from the scene.
 
Tom83B said:
I think some high schools here teach Pascal as well. I always thought it was because of the easy syntax

That's a fair point. Pascal is a very neat language, unlike C++ which makes it so easy to make mistakes. Lately there seems to be lots of people advocating Python as the best language for new learners, since it's also a neat language, but much more modern. Having said that, I don't know whether that works well in practice, because I know few places which teach students Python as a first programming language.
 
Pascal has morphed into Delphi and has become a modern object oriented language that can do anything C++ can. Delphi's two biggest drawbacks IMO for science or engineering are the lack of an exponential operator and the lack of complex arithmetic. I find this inexcusable. There are ways around both of those inconveniences but there shouldn't have to be.

From what little I know of C, it was designed to contain as much programming as possible with as few keystrokes as possible. This makes it faster to write but harder to understand someone else's code.

Pascal and Delphi are the opposite. They are both much more wordy but much easier to read and understand. In addition, both Pascal and Delphi enforce strict typecasts which reduces errors in coding.

I agree with what's been written about Fortran so I won't add much except to say that I have translated Fortran programs to Delphi and found the Delphi structure to be much more elegant than the original Fortran.
 
petergreat said:
Borland / Turbo Pascal was a good product back in the DOS days, but it's outdated now.

Sad truth.
 
  • #10
skeptic2 said:
From what little I know of C, it was designed to contain as much programming as possible with as few keystrokes as possible. This makes it faster to write but harder to understand someone else's code.
This sounds more like a description of APL with all of it's greek symbols and a multitude of operators. Example of a APL program to find all the prime numbers from 2 to N.

aplprime.jpg
 
Last edited:
  • #11
APL and C are very different. In some regards, C is more like a high-level assembly language, with some statements/expressions pairing directly with their assembly counterparts (e.g., x++ and INC, && and AND, ^ and XOR). IMO, APL would be more like BASIC implementations on minicomputers back in the 70's, with support for matrix operations. A single line of BASIC code, like APL code, would be translated to many lines of lower-level assembly.
 
  • #12
A bit off topic, but since the OP's question was already answered earlier:

Mark44 said:
APL would be more like BASIC implementations on minicomputers back in the 70's.
APL dates back to the early 60's. It has a large number of operators that will operate on multi-dimensional dynamically created (via assignment) variables. Generally an APL program consists of lines of code where each line handles sets of data in a single propagation pass through a series of operations, while most programming languages operate on such data via an iterative process for each element.

http://en.wikipedia.org/wiki/APL_(programming_language)
 

Similar threads

  • · Replies 62 ·
3
Replies
62
Views
13K
  • · Replies 397 ·
14
Replies
397
Views
20K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
16
Views
3K
  • · Replies 4 ·
Replies
4
Views
8K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 4 ·
Replies
4
Views
9K