Comparing Fortran and Pascal: Advantages & Uses

In summary, Fortran is a useful language for scientific computations and has a similar syntax to Pascal. However, Fortran is still preferred by physicists due to its legacy and large libraries of code. Pascal is not commonly used in research-level physics or the software job market, and is only taught in some high schools due to nostalgia. Delphi, the modern version of Pascal, is a more elegant language but lacks certain features necessary for science and engineering. C++ is designed for efficient coding, but can be difficult to read and understand. APL is a high-level language with many operators and is similar to BASIC in its use of matrix operations.
  • #1
Tom83B
47
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
  • #2
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).
 
  • #3
Thanks.
 
  • #4
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.
 
  • #5
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)
 
  • #6
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.
 
  • #7
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.
 
  • #8
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.
 
  • #9
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)
 

What is the difference between Fortran and Pascal?

Fortran and Pascal are both programming languages used for scientific and engineering applications. However, Fortran is primarily used for numerical computations and data processing, while Pascal is more versatile and can be used for a wider range of applications including software development and system programming.

What are the advantages of using Fortran?

Fortran is designed specifically for scientific and engineering applications, making it highly efficient for numerical computations. It also has built-in support for parallel processing, making it ideal for complex calculations. Additionally, Fortran has a large library of mathematical and scientific functions, making it easier for scientists to write code for their research.

What are the advantages of using Pascal?

Pascal is a high-level programming language that is easy to learn and use. It has a clear and structured syntax, making it ideal for beginners. Pascal also has a strong type system, which helps catch errors early on in the coding process. It also supports programming principles such as modularity and data abstraction, making it a good choice for software development.

What are some common uses for Fortran?

Fortran is commonly used in scientific and engineering fields for numerical simulations, data analysis, and computational modeling. It is also used in high-performance computing environments due to its efficient use of system resources and parallel processing capabilities. Additionally, Fortran is often used in developing weather and climate prediction models.

What are some common uses for Pascal?

Pascal is used in a variety of applications, including software development, database programming, and system programming. It is commonly used in the development of educational and business software, as well as in the creation of embedded systems. Pascal can also be used for web development and game development.

Similar threads

  • Programming and Computer Science
2
Replies
62
Views
10K
  • Programming and Computer Science
12
Replies
397
Views
13K
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
14
Views
4K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
4
Views
7K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
4
Views
9K
Back
Top