What is Fortran: Definition and 875 Discussions

Fortran (; formerly FORTRAN, derived from Formula Translation) is a general-purpose, compiled imperative programming language that is especially suited to numeric computation and scientific computing.
Originally developed by IBM in the 1950s for scientific and engineering applications, FORTRAN came to subsequently dominate scientific computing. It has been in use for over six decades in computationally intensive areas such as numerical weather prediction, finite element analysis, computational fluid dynamics, geophysics, computational physics, crystallography and computational chemistry. It is a popular language for high-performance computing and is used for programs that benchmark and rank the world's fastest supercomputers.Fortran has had multiple versions, each adding extensions while largely retaining compatibility with prior versions. Successive versions have added support for structured programming
and processing of character-based data (FORTRAN 77), array programming, modular programming and generic programming (Fortran 90), high performance Fortran (Fortran 95), object-oriented programming (Fortran 2003), concurrent programming (Fortran 2008), and native parallel computing capabilities (Coarray Fortran 2008/2018).
Fortran's design was the basis for many other programming languages. Among the better-known is BASIC, which is based on FORTRAN II with a number of syntax cleanups, notably better logical structures, and other changes to work more easily in an interactive environment.As of June 2021, Fortran was ranked 17th in the TIOBE index, a measure of the popularity of programming languages, climbing 17 positions from its ranking of 34th in January 2020.

View More On Wikipedia.org
  1. S

    Fortran Rules for Fixed Format Fortran: A Comprehensive Guide

    Are there any rule guides on fixed format Fortran such as in .f77, .f, .for files? For example, http://www.physics.nau.edu/~bowman/PHY520/F77tutor/03_basics.html has a few snippets of rules for Fortran 77 such as Col. 1 : Blank, or a "c" or "*" for comments Col. 1-5 : Statement label...
  2. NicolasPan

    Comp Sci Error while calculating arc length of curve in Fortran

    The program must calculate the length of the curve of ƒ=3.1*x^2-5.3/x between x=1/2 and x=3/2.The legth should be calculated as the sum of n line segments starting with n=1 and ending with n=20. I really can't find why the result I'm getting is wrong.Thanks in advance I am giving you the code...
  3. T

    System of ODEs with RK4 & step doubling in Fortran : damping

    Hello, I'm recently trying to code a solver for a system of differential equations u'(t) = F(t,u), using a Runge Kutta 4 method with an adaptative stepsize. For this, I'm using the 'step doubling' method, which is the following : suppose that we now the solution u(i) at time t(i). Then, the...
  4. NicolasPan

    Comp Sci Help with Fortran: Calculate Cos(x) from Equation

    Hello I was assigned the following problem:Make a Fortran program which will be able to read a degree[0-360] checking validity range(not type) and it will be able to calculate and print the cos(x) from the following equation: cos(x)=1-x^2/2! + x^4/4!-x^6/6!+x^8/8!-...,where x is in radiants.As a...
  5. S

    Fortran Fortran 90: Display values in an array

    I have a program that calculates the Fibonacci numbers from 1 to 100. The program runs fine. I am not sure how to take my output and display them in an ARRAY. Any ideas? I tired to pass the array variable through the equation, but my output was weird. I would have 1, 1, 3347...
  6. F

    Fortran Can I Use the Lucy Subprogram in Starlink Project for Fortran Routines?

    Hello! I'm trying to use a subprogram from the Starlink Project - Lucy in the library KAPPA - that is already installed and compiled. The idea is to be able to call it from my fortran routine. Something like this: PROGRAM ex INTEGER i REAL in(10),psf(10),out(10) DO i =1,10 in(i) = rand()...
  7. C

    Fortran Fortran Functions: How Are Variables Passed Around?

    Hi all Just to start with I should highlight my general ineptitude with programming, so I apologize if my question is totally basic. I have a program written (by someone else) in fortran 77. Contained within it is a call to a function which acts on a number of variables. My curiosity is about...
  8. D

    Fortran What is the correct way to handle a potential divide by zero issue in FORTRAN?

    Good day, I'm working with a FORTRAN program that has the line: EDEN=EDEN+(STVS**2)/(N(J)-1) I would like to check if N(J)-1 is equal to zero. If so make N(J)-1=1.0 The following doesn't work: IF ((N(J)-1).EQ.0.0) THEN N(J)-1=1.0 END IF I'm using gfortran and am getting...
  9. NicolasPan

    Comp Sci How to break a number into separate digits in Fortran

    Mod note: Fixed indents in code below !this program accepts a 5 digit integer !and calculates the harmonic and geometric means of it's digits !the program checks and denies numbers with length diffrent than 5 digits !The harmonic mean should be calculated only when !all of the number's digits...
  10. NicolasPan

    Comp Sci Fortran 95 code won't run

    Homework Statement . [/B]Hello all ! I am currently trying to make my fortran95 code run in vain.I would really appreciate it if someone could lend my a hand since I am a starter in programming.So the problem goes like that:Create a program capable of calculating the following function: f(x)=1/x...
  11. D

    Fortran What is causing the ARITHMETIC exception in my FORTRAN program?

    Good day. My FORTRAN program is throwing an ARITHMETIC exception on this line of code: SAREA(2,ISN)=SAREA(2,ISN)/IND(13)/1000./6080.2*IND(12)/1000. When I check this using gdb and print the contents of the variable SAREA(2,ISN), the value is 1432. gdb error message: Program received signal...
  12. H

    Fortran Solving Fortran Runtime Error 112 - Mach Number Calculation

    Hi, I try to write program to calculating mach number, with using bisection method. When I run program, fortran write to me an error in line 40. Can you help? I tried to calculating function by using wolfram sucesfully but I need to run it on fortran, An equation is 1.7795 - (0.334898 (1 + 0.2...
  13. Sirluke

    Fortran Reading Real Numbers in Fortran 95: Tips and Tricks

    Hi Guys I need some help with reading a row of real numbers on a text file using fortran. On my text file the row is: 74.05 112.91 154.03 193.90 236 276.71 61.12. I would like to point out that these numbers are chemical parameters that can vary but they usually have up to two digits in the...
  14. S

    Fortran Fortran (90) runtime error: End of file

    I am using fortran 90 to find the prime numbers (1-100). When I print to the console, everything works. If I try to write to an text file (.out). This is from my command line: Sues-MacBook-Air:FORTRAN sueparks$ gfortran PRIME.f90 Sues-MacBook-Air:FORTRAN sueparks$ ./MY_PRIME.out PROGRAM PRIME...
  15. ydonna1990

    Fortran Understanding IERR (FORTRAN): Error Detection & More

    DO READ(11,'(a)',iostat=IERR)line IF ((line(1:2)/='--').and.(line/=' '))THEN READ(line,*,iostat=IERR) posinumber EXIT ENDIF ENDDO What is IERR? Is it related to error? I couldn't find any good answer researching online. Thanks in advance
  16. ydonna1990

    Fortran Fortran Beginner: What is iostat=stat & buf Argument?

    Hello. I am a beginner in the Fortran language and I want to know what isotat=stat means. also what is exactly the "buf argument"?
  17. A

    Fortran Add Library to Fortran - Learn How to Launch Free Libraries

    Hi I'm completely new to fortran I've downloaded FGSL and I don't know how to run it and also I don't How should I launch the free libraries in fortran,can give me an outline?
  18. ogos

    Fortran Help with Fortran 77 Programming for Two-Dimensional Axisymmetric Flow Study

    [mentor edit added code tags to improve listing] Hey everyone! I am new in this forum. This thread I need help with my thesis. I'm doing a study of two-dimensional axisymmetric flow in a Kaplan turbine. So I am using a program called Force2.0 for programming in Fortran 77 but have several...
  19. D

    Fortran Why Does This Fortran Code Result in an Infinite Loop?

    I've inherited the code below. It's giving an infinite loop but I can't find what's causing it. This is code originally on OpenVMS written now for AIX. Can you help? SUBROUTINE MREAD3(N_VESSEL,N_TRIP,N_ICNAF,N_SPECIES,N_DELSTR, + N_SETDEL,N_SELSTR,VESSELS_TO_BE_SELECTED, +...
  20. G

    Fortran Solving Function Problem in Code Exchange

    Hello I am trying to exchange following code into two functions which I will need to use in further programs. The code is as follows: do i=0,k do j=0,k if (i/=j) then lj(i)=lj(i)*((xx-x(i))/(x(j)-x(i))) end if enddo l(i)=l(i)+y(i)*lj(i) write(2,*) x(i),y(i),l(i) enddo I would...
  21. Tone L

    Fortran Is FORTRAN still relevant in modern programming?

    This summer I was a research student and my advisor used fortran (case 1). Two of my professors at my college use fortran (case 2). My friend at BU who is just starting his phd says fortran is huge and I should probably get a grasp on it (case 3). On the opposite side of the spectrum, my...
  22. avikarto

    Fortran [FORTRAN] FFT of delta function, issue w/ MKL & Intel compiler

    I am trying to program something using a backwards FFT, and am attempting to feed it a delta function as a test condition since this result is known. However, my results are nonsense compared to what is expected. It should be the case that if we have...
  23. Z

    Fortran Fortran Linked List Program: Understand Logic & Assembly

    CAn anyone explain how this program in Fortran on linked lists is supposed to work. Actually it does work but I can not for the life of me follow the logic behind it or what is going on. I did some Fortran programming in F77 but now with this new 'pointer' type it is about impossible to...
  24. K

    Fortran [Fortran] Help Reading Complex 2D data

    Dear All, Please, I am trying to read in a data shown in array form but no luck. The data is 10 by 10 with each 10 by 10 depicted by a local array, for e.g. 0 0 0 0 0 0. A sample of the code I tried using is as shown below and the data is as attached. Please, any help or suggestion will be...
  25. avikarto

    Fortran How Do You Implement MKL's FFT Functions for Multidimensional Data in Fortran?

    This is my first time attempting to use the MKL's FFT functions, and I'm having trouble understanding them. The available examples (https://software.intel.com/en-us/node/522290) provide little insight into the reasons for doing things, and looking into the commands themselves doesn't provide...
  26. G

    Fortran [Fortran] How to loss different random number

    Hello I am wondering how can I make sure that every number which I am losing will be different? I am using the following code: program lottery implicit none real(kind=4) :: x real(kind=8) :: y integer :: i, seed= 64256 call srand(seed) do i=1,6 x=rand() ! to make the lossing interval...
  27. S

    Fortran Optimizing Makefile for LHS Code in Fortran

    I've always made my own makefiles and it hasn't been an issue because it's usually a small number of subroutines. However, I am working on modernizing and optimizing a Latin Hypercube sampling code in Fortran which has close to 80 functions/subroutines that I am splitting up into different files...
  28. K

    Fortran Fortran : generating different output files in a loop

    implicit none character*4 head1,head2,ext character*10 fn1,fn2 integer i,kev head1='jack' head2='jill' ext='.dat' do i=1, 50000 kev=int((i-1)/50)+1000 if(mod(i,50).eq.0) then write(fn1,'(a,i4,a)') head1,kev,ext write(3,*) fn1 write(fn2,'(a,i4,a)') head2,kev,ext...
  29. mariem.makh

    Fortran Mesh 2d of a complex geometry with FORTRAN

    I neet to do a structured triangular mesh 2D of a complex geometry with FORTRAN Can someone help me!
  30. G

    Fortran [Fortran] Filon's method Fourier Transform

    I was told to do a Fourier transform of function by using a Filon's method. I have found the code but I don't know how to include any function to the subroutine. I would be grateful for any example of how to use this code. SUBROUTINE FILONC ( DT, DOM, NMAX, C, CHAT ) C...
  31. G

    Fortran Bisection formula fortran90/95

    Hello, I was told to find the root of an integrand with using the bisection method. I am kind of new to such a stuff so I am kind of confused why I am not getting the expected result. Here is my bisection code: tl=3.0 tup=4.0 tempred=0.0 s=-0.234726128709272990292 do while (abs(total_calka)...
  32. kinbeat

    Comp Sci Laplace expansion in fortran

    Hi, I'm dealing with an exam problem (which i have 8 days to solve, with no outside help limitations), which is to write a fortran95 program that solves linear systems. the first part asks to find the determinant of a NxN matrix with the laplace expansion, implementing it as a recursive...
  33. avikarto

    Fortran Linking fortran libraries with g95 in Windows Powershell

    I am having some trouble getting all of my libraries included in my g95 call at the command line (using Windows Powershell). The confusion stems from the purpose and use of the "g95_library_path" variable native to the compiler, and how this enters with the "-L/..." option on the command line...
  34. angelos_physik

    Fortran Solving Large/Infinite Results w/Yee 1D FDTD Code

    Hello to all! I have written this 1D FDTD code but the results I take are very large and after some timestep they get to infinite/NaN... I really don't know what's wrong. The expressions I have used are the exact given solution for the Maxwell equations. Thank you for your help. program yee...
  35. avikarto

    Fortran [Fortran] Function implicit type error

    I am having an issue with the declared type of the return value of a function not being recognized in its call. This function clearly has its return value declared as complex*16: !----------4-vector dot product under Minkowski metric---------- function dot4(v1,v2) result(res) implicit none...
  36. avikarto

    Fortran [Fortran] Integer overflow for a real number?

    I am trying to define a real number as follows: real*8 r r=2.5*10**20 This results in the following warning: r=2.5*10**20 1 Warning(131): Integer overflow at 1 First off, I am not even declaring it as an integer, yet the warning is named as such. After searching around for...
  37. Matterwave

    Fortran [Fortran] Quick question about complex exponentials

    Hey, so I just have a quick question. I am trying to set a complex variable (in an array) as ##e^{i\alpha_1}## and the line I used in my code looks like this: hmajphasemix(2,2)=(cos(alpha1),sin(alpha1)) But the compiler is telling me that it "expects a right parenthesis" at this line. I'm...
  38. ognik

    Investigating a Parabolic PDE algorithm

    Homework Statement Hi - I'm on the last chapter of this book and am a bit stuck. I am given a very basic fortran program (code attached in the zip file) and asked to 'investigate its accuracy and stability, for various values of Δt and lattice spacings'. The program is an implementation of the...
  39. mlouky

    Fortran I to solve ODE with rk4 y" + 2y =0 in fortran

    How can i solve y" + 2y =0 with RK4 and their program fortran please I néed your helpe
  40. K

    Fortran Please, Help with Data Reading in Fortran

    I have been trying to read in a data using Fortran but for some reasons, it doesn't read the data correctly. Please, any help will be appreciated. To read the data, I used the following (Note, for the attached data, Nm=1, nw-nu=5, nw=10). The array data(i,j,m,n) is declared as...
  41. Md. Abde Mannaf

    Fortran Fortran 90 Program Factorial: Fixing Incorrect Output

    program factorial implicit none integer::fact,i,n print*,'enter the value of n' read*,n fact=1 do i=1,n fact=fact*i end do print*,'factorial is ',fact end program when input n largest number then answer is incorrect. how to solve
  42. Md. Abde Mannaf

    Fortran Combination is not working correctly -- fortran 90

    !subprogram for combination !Author:: mannaf function fact(n) implicit none integer ::fact,n,i fact=1 do i=1,n fact=fact*i end do return end program comb implicit none integer ::fact,n,r,combination print*,'enter the value of nCr' read*,n,r...
  43. F

    Fortran Fortran runtime error: Sequential READ or WRITE not allowed

    Dear Forum users, I am running a program called NMTO package for constructing Wannier functions for a material. It uses a code plotnmto.f90 to calculate wannier isosurfaces within the mesh defined by me. I compiled the code in gfortran. After defining the mesh when I ran the program for...
  44. waver.

    Fortran Inputting a Complex Number in Fortran 90 for DeMoivre's Theorem

    i have a a little problem in fortan90 i just wanted to know how to input a complex number ( input real and img part alone ) all i want to do is to make a simple program about DeMoivres Theorem i have been around in google all i know how to declare a argument as complex complex a then how to...
  45. A

    Fortran Fortran 77: Recording the output

    Hi, I am having a bit of trouble trying to record the output from my code and any help is highly appreciated. Attached is the code that needs to be looked into (changed extension to .txt from .f as PF wouldn't allow it) and a screenshot of output that I am trying to record. What I am trying...
  46. M

    Fortran Generating programs in fortran to .dat files

    I have a small problem to insert a code in fortran to generate me a graph in .dat only need to Fortran insert a command that I may run in the program of .dat
  47. O

    Fortran I can't find a small bug in this Fortran code

    So I'm writing a short subroutine to compute a QR factorization of an (mxn) matrix using the Householder method. To test this, I'm computing the factorization of the matrix 12 -51 4...
  48. L

    Fortran Can complex numbers be used in Fortran array constructors?

    Hi, so I need to write a fortran code with 2, 2x2 matrices. These matrices are in the form of B=(1 exp(i)(theta) 0 0) and D=(0 0 exp(i)(theta) 1) where i is sqrt of -1 and theta is an angle between 0 and 2pi. I've expanded the exponential so it reads cos(theta)+isin(theta) and let theta=pi/2...
  49. Matterwave

    Fortran [FORTRAN] How did I screw up my code?

    Hi guys, there's a bug in my code which I've been trying to get rid of for the last 2 weeks. I'm completely out of ideas now on what it is so I have to turn to you guys for help. The code is here: module helectron use params use parallel !* electron density parameters integer ...
Back
Top