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 Change directory using fortran

    I am using the following subroutine: subroutine plot_2pCF_2D(A_0,index_0,Point_color,Title) implicit none integer ret real A_0,index_0 character(len=*) :: Point_color,Title OPEN(10,ACCESS='SEQUENTIAL',FILE='gp.txt') write(10,*)'set terminal postscript eps color enhanced size 5,7'...
  2. S

    Fortran Should I use a Fortran module?

    Hello, I want to create one file test.f95 where i can keep all my subroutines and use them whenever i create a new program new.f95. Is the modules the right way to do it?? because when i create a file let's say test.f95 with the module and one other with my main program (new.f95) when i...
  3. B

    Fortran FORTRAN adding trailing zeros 0s

    Aloha all, I am reading in real data values in a FORTRAN program that are something like 23.134. The problem is that the program adds extra numbers on the end to make it 8bit, so I end up with 23.13451. This is throwing everything off. Is there a way to make the values have trailing 0s...
  4. P

    Fortran How to calculate vorticity using fortran

    Hi asking for help how to calculate vorticity using fortran ∇×c ⃗ where both nabla and c are three dimension vector, and c is the wind speed with three component
  5. S

    Fortran Can we compile fortran 90 on external hdd?

    Hi, I need to compile a programming written in fortran90 and the output will be in 10 000 data files(maybe more) size 3.5Mb each. My notebook's memory is not enough to store all the data file, I am using Linux 3.11.6-4-desktop with openSUSE 13.1 (Bottle) (x86_64). I have 1TB external hdd and...
  6. M

    Fortran [Fortran] Filling a disk with random points

    Hi My FORTRAN is rusty and my brain is even more rusty. I want to populate an annulus with a randomly distributed set of points. Any hints or tips to get me thinking about this would be gratefully received. Thanks D
  7. T

    Fortran Fortran programming help arrays and arithmetic

    Hi folks, To begin with, I have no past programming experience and have just begun to teach myself programming in FORTRAN 95 and I've hit a wall. I'd be very grateful for any assistance here. I have around 150 text files with three columns of data (I have attached one as an example, and...
  8. anorlunda

    Fortran [Fortran] Naming conventions for integers

    Long ago I learned Programming in FORTRAN. I got used to the convention that names starting with I,J,K,L,M,N were INTEGER while all other letters were REAL. I thought it was a convention of FORTRAN only. Since then, I came to realize that the same convention is widely used in science and math...
  9. H

    Fortran Fortran: How to make a long character made with an array

    Lets see if I explain myself. I want to FILL a string with the components of a character array. I have no idea, but seeing this example: character(len=*),parameter::fname=" Paul",lname="Scholes" character(len=20)::fullname fullname=fname//" "//lname I try this one...
  10. A

    Fortran How are the initial X values chosen? Fortran

    So, I had initially kept the values of X as 0.0D0 for all my 14 variables and it wouldn't populate any results. This was mainly done based on the guide that I was referring to. On contacting my tutor, he placed the following values instead? X(1) = 0.0D-01 X(2) = 0.0D-02...
  11. M

    Fortran Fortran branching statement confusion

    Folks: I have a FORTRAN program published in Multivariate Morphometrics (Blackith and Reyment - 1971). In this book they list a FORTRAN program that computes Canonical Correlates. I don't have a FORTRAN compiler and I'm trying to translate this program into PERL. The one FORTRAN book that is...
  12. A

    Fortran Why is the output format different for two similar Fortran codes?

    So, when I execute my code which is at http://sysden.com/dufing.f I get the results which are very well organized: PATH ========================================================================================== N INP JCASE JOB JBIF ILAM...
  13. Hepth

    Fortran Fortran 77 [F77] : Code in external file without subroutine?

    I have some F77 code and I am wondering if it is possible to inject external code into a separate file and call it without it being a subroutine, and placed into the code. An example would be : a = 1 + 1 b = a + 1 c = b + a a = c + b d = 4 + a and I want to take lines 3 and 4 and...
  14. S

    Fortran [Fortran} error in formatted

    Hi all, I got this error: rm -f *.o *.mod *.MOD *.exe *.stackdump main gfortran -g -I/usr/include -c main.f90 gfortran -g -I/usr/include -c subroutines.f90 subroutines.f90:21.16: 10 format(data,'i3.3','.dat') 1 Error: Positive width required in format...
  15. A

    Fortran Array Reference is out of bounds error? Fortran

    So, I have a bunch of errors which need resolving here but majority are based on the "out of bounds" error and hence the topic title :). Would be great if you are able to help me resolve the errors. Quite a newbie with fortran. So please bear with any silly questions that I may throw at you...
  16. S

    Fortran Why am I getting a NaN Error when Running my Fortran Program?

    Hi to everyone, I am quite new to forum and fortran. Basically, i am trying to calculate the bubble radius using RP model and this is my code: IMPLICIT DOUBLE PRECISION (A-H,O-Z) IMPLICIT INTEGER (I-N) C ! Declare local constant Pi REAL, PARAMETER :: Pi = 3.1415927D0 C...
  17. M

    Fortran Fortran DO loop sequence confusion

    I am trying to convert a FORTRAN version of a Canonical Correlates program listed in Multivariate Morphology - Blackith and Reyment. I've programed in FORTRAN decades ago and now I have to understand the language to rewrite the program into PERL. a) DO 260 I = 1 , M b) SX( I ) =...
  18. K

    Fortran Fortran issues - Not getting expected output

    Hey everyone, I've been working on this project for awhile (some of you may recall having seen a very early version), and I am so close to being finished, but I have a problem somewhere, and I can't figure out why. So what is happening here is that this code is supposed to calculate the...
  19. M

    Fortran Fortran Help for Meteorologist Student: 4th-End, 60-100

    Hi, i am a meteorologist student and I have some data I have to prepare using Fortan. I don't know how to make it read the file from the 4th row till the end and from the 60th line till the 100th. Can you please help me? I'm desperate!
  20. H

    Fortran Fortran 90 how to read how many characters are in a line?

    Hello everyone, this is the thing: (Before anything I have to say that I trying to make the program in fortran 90) I have a text to read, and in that text i have to know how many characters are in every single line. I make it to count how many lines are in the text with this code: n=0 do...
  21. H

    Comp Sci Fortran Program - Calculate the Function

    Homework Statement F(x) = exp(-a x^2) cos bx for -100 =< x >= 100 , a=13 and b=7. Homework Equations ... The Attempt at a Solution program main implicit double precision (A-H,O-Z) implicit integer (I-N) DO I = -100,100 X = I * 1D0 F = DEXP(-A * X**2) * DCOS(B * X)...
  22. B

    Fortran Fortran 90 - gfortran error - help

    Hi, I have written a fortran 90 program that finds the definite integral of a function using the trapezium method. Everything is fine, other than when I compile my program it produces the following error: assignment_2_final.f90:127.2: ITRAP = (z/2)((G(a) + G(b)) + z*area) 1...
  23. D

    Fortran [Fortran] Is anyone familiar with the Elk-code software?

    Dear all, Are you familiar with the Elk-code software? It is a software about FLAPW (full potential linear augumented plane wave).Recently,I am reading the source code,but I meet many difficulties. For example,I've a question related to charge density.In the Elk source code, the charge...
  24. T

    Fortran Fortran Error Unexpected data declaration statement

    Fortran Error "Unexpected data declaration statement" Hi all, I'm writing a program to perform a linear inversion on a set of magnetic data. I'm fairly new to Fortran, but I have coded Fourier and wavelet transformation programs in it. I'm having a problem when trying to declare my variable...
  25. N

    Fortran How to Write a Fortran Code to Read a Specific Data File?

    The input file: --------------------------------------------------------------------------------- S 1 S 2 1H,,1H...
  26. S

    Fortran 90, surface integrals

    I am dumfounded on how one would perform surface integrals in Fortran 90 over a platelet, or a rectangular box. I can do single and double integrals but I have no idea on how to do surface integrals Thanks in advance!
  27. M

    Fortran How to Use FORTRAN Do Loops for Solving Equations - Step by Step Guide"

    Hey guys, I'm new to fortran and I'm having a slight problem. I put my code below as reference. I first set up a my known values. Then I used an equation to solve for v. After I solve for v I then computed c which involves v. What I'm now trying to do is to loop the value I got for c back...
  28. S

    Fortran FORTRAN error array bound is not scalar integer

    FORTRAN error "array bound is not scalar integer" I'd like to know if a loop can be created, inside which I can call a subroutine in which there are arrays to be defined whose size varies as a function of loop variable. I tried as following, but got error "array bound is not scalar integer"...
  29. B

    Fortran How can I fix my program to calculate the average of a set of numbers correctly?

    Hi, I'm a first year physics undergrad studying the fortran language with NAG compiler for computer programming. Question 1: How do I write a program that finds the average of a set of n numbers? I've written a program already but my answers are continuing to be 0.0000, no matter what...
  30. T

    Fortran Using MODULEs in Fortran 90/95

    Hi! I require help in writing a code where I want to put FUNCTION definitions in one module and INTERFACEs to the functions (as I use assumed-shape arrays in the functions) in another. But I get multiple errors when trying to compile. Could anyone assist me in solving this problem? Please see...
  31. A

    Fortran Retake: Reading an existing file into a fortran code

    Thank you very much for the reply. I placed the file in the same directory as the program and opened the file before executing and everything was just perfect. But my other problem is that, in my data, there consists of negative numbers. Is there a way to read the positive inputs without the...
  32. A

    Fortran Reading an existing file into a fortran code

    I am programming in fortran 90/95 and i have a problem opening an existing file for input. I have written the code without any errors, but at compilation time, the file to be read cannot open. It is as if the program does not know the location for the file. I would like to know if there is a...
  33. D

    Fortran Numerical Minimization of many-variable function in Fortran

    I would like to find a FORTRAN subroutine or a good way to minimize function numerically.So basically my function has 20 variables and I am able to provide analytic form of the first and the second derivative of the function. Basically what I want is: have the form of the function of 20...
  34. S

    Fortran How can i create a random number distribution (FORTRAN)

    Hello, I am working on the two point correlation function in dark matter haloes. Right now i need to create an array of rundom numbers to compute the estimators. My question is: How can i create a random distribution of points in the unit sphere (having in mind its curvature). I...
  35. R

    Comp Sci Fortran programming to solve linear equation for ode

    Fint the exact solution of the system dy/dt = -15y-25z dz/dt=-47y-85z with inital condition y(0)=2, z(0)=5 either by writing the equation in matrix form as dx/dt =AX where x=(y z) and diagonalising the matrix A, or otherwise. Using fortran programming with second order adam bashforth...
  36. R

    Comp Sci Fortran programming for nonlinear ode

    Adapt the fortran programming using second order adams bashforth method to generate a numerical solution of the Lorenz system: dx/dt =-10x+10y dy/dy=28x-y-x*z dz/dt= x*y- (8/3)*z with initial condition x(0)=y(0)=0, z(0)=2 slightly perturbed. Plot x and z against t runs from 0 to 15, and also z...
  37. R

    Fortran programming to solve ODEs

    Consider the first order differential equation \[\frac{dy}{dy} = f(t,y) = -16 t^3 y^2\] with initial condition $y(0)=1$ Using second order Adams-Bashforth method, write a Fortran programming to generate an approximate solution to the problem. Solution Program adams Implicit None Real...
  38. R

    Comp Sci Fortran Programming for order differential equation

    Consider the first order differential equation dy/dy = f(t,y) = -16 t^3 y^2 with initial condition y(0)=1 Using second order Adams-Bashforth method, write a Fortran programming to generate an approximate solution to the problem. please forgive me for not trying because I really...
  39. Superposed_Cat

    Fortran Why do you need FORTRAN, C, C++ for physics

    Okay I get that FORTRAN was made for science and C AND C++ are fast but why do you have to know one of them? (or so I heard). Thanks for any help.
  40. O

    Comp Sci [Fortran] making a more efficient bilinear interpolation

    Homework Statement I'm trying to write an efficient bilinear (2D)-interpolation, after reading some recipes, as a fortran-mex for Matlab that is used extensively throughout a long algorithm of solar image processing, and therefore is one of my main bottlenecks. I'm not a Fortran expert and...
  41. K

    Fortran How to fix the Euler method error?

    Hi everybody, I am programming a new code for a problem. The problem is numerically solving the Simple Harmonic Motion using the Euler method. This approach is just an approximate solution and not a exact solution, however when I run the code successfully and plot my data, it comes up as an...
  42. B

    Fortran [Fortran] Problems with LAPACK routine

    I am trying to use the LAPACK routine dsyev to solve for the eigenvalues of a matrix, and I designed a program to test this and make sure I am getting the right results. It isn't recognizing the subroutine however. The subroutine is dsyev, which I can post or can be found on the LAPACK site...
  43. L

    Fortran Solving a system of equations with numeric variables - Fortran

    Hello, I've been trying to solve a system of equations but I'm getting a lot of troubles when I tried to insert inside a matrix a numeric variable. This is my code. I've tried both schemes, i.e., (1) introducing all elements of the matrix by hand (real numbers) and (2) introducing numeric...
  44. B

    Fortran [Fortran] Implcit type problem

    I'm writing a subroutine for solving Newton's method for the root of a function and I am coming across an interesting problem. This is the start of my code, where it is says the error is occurring SUBROUTINE Newton(f, x1, x2, dx, aroot, error) IMPLICIT NONE ! Declare Arguments REAL...
  45. K

    Fortran Fortran program for oscillator using Euler method

    I am trying to run a program with fortran. The program is about solving the Oscillator using Euler Method. I am trying to run this code and applying array arguments (as I want to extend it to 3 dimensions afterwards). When I try to compile, it comes up with an error "Unclassifiable statement at...
  46. M

    Fortran Transmitting values to functions and subroutines problems - Fortran 90

    Hi everyone, I hope everyone's doing good. I presently have a project at work and I'm having a hard time dealing with some programming techniques. To summarize my project, I have to modify some codes on Fortran so that it can be adapted to be used on a simulation software called PRO/II. All...
  47. M

    Fortran Fortran runtime error: End of file

    Dear all, I want to read file "d1.dat": 1.025000+7 5.794453+0 1.050000+7 5.770080+0 1.075000+7 5.750135+0 1.100000+7 5.734860+0 1.125000+7 5.724448+0 1.150000+7 5.719060+0 1.175000+7 5.718829+0 1.200000+7 5.723865+0 1.219440+7 5.730802+0 1.225000+7 5.732945+0 1.250000+7 5.743325+0...
  48. M

    Fortran  [Fortran] Problem reading formatted text file

    Hi all, I have a problem I'm trying to solve. I have a code that has written a simple ascii text file like this: write(ilun_out, '(E23.15,A,E23.15,A,E23.15,A,E23.15)' x, ' ', y, ' ', z, ' ', rho So this provides a nice looking ascii file with four columns, separated by a small space. Now...
  49. T

    MATLAB Passing 3D Array from Fortran to Matlab

    Hello! I'm working in a programm which has a 3D array with a DIMENSION(16,221,900). When I use the debugger option and I print out the value of the matrix I don't know how to read the info. I already know Fortran uses column-major order, storing the columns in sequence. My doubt is...
  50. Z

    Fortran Fortran (gfortran) compiling error

    Hello, I need help for programming my first program in Fortran, because it doesn't run. I think it's a problem with the compiler. What do you think? This is my code program Steifigkeitsmatrix implicit none real :: E,I,l,p real...
Back
Top