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. R

    Comp Sci Fortran DO Statements (how many loop times)

    Hello, Examining the following DO statements and determining how many times each loop will be executed. Assume that all loop index variables are integers. (a) DO irange = -32768, 32767 (b) DO j = 100, 1, -10 (c) DO count = 2, 3, 4 (d) DO index = -4, -7 (e) DO i = -10, 10, 10 The loop will...
  2. R

    Fortran Why Is My FORTRAN If/Else Statement Not Working Correctly?

    I am not able to get what's wrong in below. IF ( temp < 97.5 ) THEN WRITE (*, *) NTemperature below normalN ELSE IF ( temp > 97.5) THEN WRITE (*, *) NTemperature normalN ELSE IF ( temp > 99.5) THEN WRITE (*, *) NTemperature slightly highN ELSE IF ( temp > 103.0) THEN WRITE (*, *)...
  3. R

    Fortran FORTRAN PROGRAM FOR MEANS (Beginner)

    I am learning Fortran and I am able to write code for 3 number means. Now For computing it for set of numbers is not getting in my mind. I am not able to do it. Writing a single Fortran program that calculates the arithmetic mean, rms (root-mean-square) average, geometric mean, and harmonic...
  4. R

    Fortran How Can I Improve My Fortran Program for Calculating Different Types of Means?

    Trying to write a single Fortran program that calculates the arithmetic mean, rms (root-mean-square) average, geometric mean, and harmonic mean for a set of numbers (for example - 4 4 4 4 4). I don't know if I am doing the write way. Please guide me. PROGRAM ComputingMeans IMPLICIT...
  5. Nugso

    Fortran Fortran - Having to add integer command

    Hello everyone. Today I learned how to write a program which calculates and prints integer squares roots from 1 to 1000. Here is what I wrote: program example real::i do i=1,1000 if(sqrt(i)**2==i) then print*,i end if end do end program example After compling this, 25, 49 etcs can't...
  6. T

    Fortran How to handle empty txt files when reading data in Fortran 90?

    Hi I have a problem with reading data in fortran 90. my programs try to read a txt file that only contains one number in it but if the txt file is empty it stops. i want to make it continue what should i do?
  7. N

    Fortran How to Modify a FORTRAN Program to Exclude Multiples of 5?

    How would I modify the program so it doesn't generate an output for integers that are multiples of 5? (e.g. if range was 1-20, then no lines would be printed for 5, 10, 15, 20.) program squares implicit none integer*2 start, finish, i ...
  8. F

    Fortran Problem compiling FORTRAN code

    Hello, I received some very old cold, and I don't even know for which FORTRAN standard it was originally written, only that it has existed since at least 1993. I'm trying to compile it in gfortran, and I get the following error: 'Error: Expected a right parenthesis in expression at (1)'...
  9. X

    Fortran Why is My Fortran Program Only Showing Output Data After Completion?

    Hi all, I encounted a write file problem for Fortran 90. I appreciate it a lot if you can help me. I open a file at the beginning of the program. Then everytime I rewind the unit number and write one new line to the first line of the file (the previous data on the first line is replaced)...
  10. S

    Fortran Creating a distribution with specific mean and variance in FORTRAN 90

    Hi, I'm trying to create a normal distribution with mean 0.5 and variance 0.05. I tried it initially with MATLAB, for which I used newdist=0.5+(randn(1,1000)*sqrt(0.05)); Could you please help me in doing this in FORTRAN 90? Would generating a sequence using RANDOM_NUMBER and using the...
  11. O

    Fortran Fortran, File Read Error( Tried to read past )

    Fortran, File Read Error[Resolved itself, fixed] Basically I'm writing a simple fortran program to read in a data file formatted as shown below and then calculate the line of best fit for the given data points. N x1 y2 x2 y2 . . . . . . xn yn Where N is the...
  12. D

    Fortran Reading Universal File Type 58b in Fortran

    Hi there, I am trying to read a universal file (*.unv) in fortran. The file is type 58b (mixed ascii and binary format). I can read the ascii part fine but am having trouble reading the binary part. Does anyone know of anywhere I can access some source code to read this correctly. I suspect...
  13. N

    Fortran How to Prompt User for Desired Payment in Loan Payment Program?

    Can someone give him a head start re: the following Q: We can make the program test itself by having it plug in the found root and evaluate the LHS (it should be zero). Complete the program by having it evaluate the LHS at x = root1. ! This program finds the roots of equations of the 2nd...
  14. Y

    Fortran Can Fortran read input data from Excel?

    I have prepared the coordinate of a pipe layout in excel. Now I have to input them into a FORTRAN code. Although I know it is possible to generate these coordinates inside FORTRAN, but working with Excel is much easier for me. Making these coordinate data inside FORTRAN is a very hard work and...
  15. M

    Fortran How can I fix a Fortran compiling error?

    I Just finished installing gcc and SciTE . when i try to run a basic code ..the following error is returned(refer attached file) many thanks PS:I have saved fortarn.properties file in the installation folder of scyntilla
  16. M

    Fortran Error 112 /undef when running fortran code

    Hi, I am a new Fortran User. I have a problem when I run my code (not errors during building), in fact the code is stopped in the last line and this message appears "Error 112, Reference to undefined variable, array elements or function result" ... write(number,100)k1 open...
  17. D

    Comp Sci Implementing Simpson's Rule in Fortran for Accurate Numerical Integration

    I am trying to program Simpson's Rule in Fortran I=(1/3)*h*(y0 + 4*y1 + 2*y2 + 4*y3 + 2*y4 + ... 2*yn-2 + 4*yn-1 + yn) n=100 (number of strips) I have generated the y values but I don't know how to get Fortran to follow the pattern in the brackets after h to add up the y values. Any...
  18. D

    Comp Sci Help with FORTRAN error message

    Homework Statement I get the follwing error message in the FORTRAN program I am trying to code. P(i)=(1/(sigma*sqrt(2*Pi)))*e^(-(x-xbar)^2/(2*sigma^2)) ----------------------------1 Error: Invalid character in name at (1) I assume this means there is something it doesn't like about...
  19. Y

    Fortran Looking for a Lamczos program in fortran

    Anyone can help me getting a source deck of Lanczos in f77 for large sparse Hermitian matrices? I need one that is user friendly. There is one written by Jane Cullum and Ralph Willowghbi that I find too difficult to use. Or is there some library that has it and can be linked? Thanks in advance
  20. J

    Fortran Running FORTRAN executable from Linux SHELL

    I have noticed an issue I must resolve before writing a GUI for my FORTRAN program in Linux. If I move into the directory (cmd line) and type ./myprogram it works fine. It reads the input file from that directory and creates an output file. If I run it from the file manager it gives me 2...
  21. G

    MATLAB Is fortran 90 or matlab better for simulating non-linear dynamics (Chaos)?

    I am going to be simulating damped driven oscillators for my project and I was wondering if someone could give me a definitive answer on the matter. I know MATLAB is more of a 'tool' than a language so I'm thinking the maths behind damped driven oscillators might be easier to implement into...
  22. J

    Fortran FORTRAN in linuxread file problems

    I wrote a simple FORTRAN program to show my read problem. This works fine in windows. On the Linux machine I always get this eof error when I open a file and read. This means that every program I have written doesn't work :) The error is line 12 EOF. What is the problem? (I am using GFORTRAN in...
  23. Y

    Fortran A FORTRAN code for solving Sudoku puzzle

    For few days I am thinking to write a code in FORTRAN to solve the sudoku puzzle. At first it seams simple but I have no luck writing this code. I am wondering if there is any written code to solve this puzzle. I hope Sudoku puzzle is known for members here. en.wikipedia.org/wiki/Sudoku
  24. Y

    Fortran What is the meaning of COE & COK in Fortran?

    In an old (1974) FORTRAN program, I have following two lines IF(FX.GT.COE(KOP,1)) GOTO 1 F=X*COK(KOP,1) I can't understand the meaning of COE and COK commands. Are they standard FORTRAN commands? PS) If you could kindly guide me to a site whee I can find list of fortran commands, I...
  25. A

    Fortran Using FORTRAN to Read & Output Text Data in Column & Row Format

    Hey I have a text file with 2 blocks of Data Example Numbers 1: 1,2,3,4,5,6 7,8,9,10,11 ... Numbers 2: 92,93,94,95,96 97,98,99,100,101 ... How would i use FORTRAN to read the text file and output in a column and row format.. Example 1 92 2...
  26. L

    Fortran Fortran tutorial for someone with no prior programming experience?

    Hi there, As the title suggests, I am looking to start learning my first programming language. I am a mature student (24) who has recently returned to school to pursue physics. A friend of mine who does physics suggested that I learn Fortran (90/95) as my first language. I am looking online...
  27. H

    Fortran Array reading error when opening multiple files in Fortran

    Guys. I really need help. I have been working in this little problem for hours. I had a problem in array reading when I opened more than 1 files, it seems like an array with different names mixed each other. Here is my code integer, parameter::size=11 real, dimension(101) :: cldata...
  28. M

    Fortran Integration of functions in Fortran

    I've recently stated using Fortran (I downloaded 'Silverfrost') and am hitting a block. I've learned the basics, but I can't find any more tutorials. My professor (who I plan on doing research for) suggests that I get familiar with Fortran, especially integration of functions. I do not have...
  29. M

    Fortran Fortran 90, changing 8 bit stream into a 10 bit one

    Hello, I'm having a bit of trouble converting an 8 bit stream into a 10 bit one. First i create intvalbin8, a Nx8 zero/one array where N is the byte length of the input data: (6198 is the header offset factor) j=1 do while (intvalout(i).gt.0)...
  30. M

    Comp Sci How can I calculate pi in Fortran without using intrinsic functions?

    Homework Statement I have a project about pi. We are wanted to calculate pi in Fortran 90/95,without use intrinsic functions. For example, we must think like a computer. Homework Equations We must use formula of sin(x) and cos(x) for find 'pi'. When Sin(x)=cos(x) (and error is 10**-4)...
  31. Aaronvan

    Fortran Will FORTRAN always be the premier programming language for science?

    Fortran has been around since the 1950s and obviously there is a large amount of Fortran code lying around. However, I'm curious if C or another programming language will someday supplant Fortran. Perhaps scientists will gravitate towards high-level math packages like Matlab and Maple, and...
  32. J

    Fortran What Should Be the Values of Ax and Ay in This Fortran 90 Code?

    I have the code. program star implicit none real (kind=8) :: x integer :: i dt=0.001 pi=4*(atan1.0) do i=1, Nsteps t = n*dt !calculate acceleration ax= ay=... !calculate values at next step vy=vy+ay*dt vx=vx+ax*dt x=x+vx*dt y=y+vy*dt end do...
  33. R

    Fortran I can not read character 0A in a bmp file with Compaq Visual Fortran 6.6C

    I can not read character "0A" in a bmp file with "Compaq Visual Fortran 6.6C" Hi, How to read character "0A" in a bmp file with "Compaq Visual Fortran 6.6C" Here's an excerpt from bmp file: 42 4D 16 02 00 00 00 00 00 00 36 00 00 00 28 00 00 00 10 00 00 00 0A 00 00 00 01 00 18 00 00 00...
  34. J

    Fortran Bisection method in fortran 90

    Bisection method for the equation x3−2x−2 = 0 which has a single root between x=−4 and x = 2. here's the code I have program bisection2 implicit none real :: fxa, xnew, xu, xl, fxb, fnew xu=4 xl=2 1 xnew=(xu+xl)/2 fxa=(xnew**3-(2*xnew)-2) fxb=(xl**3-(2*xl)-2)...
  35. C

    Comp Sci FORTRAN: second-order ODE with Euler Method

    Homework Statement Dear all, please help. I have tried this question and came up with strange numbers, my fortran is definitely not correct. Please help! When the effect of the air resistance is taken into account, the equation of motion for a particle of mass m falling vertically in a...
  36. S

    Fortran Fortran Call Troubleshooting: Passing Integers & Strings

    ok, Been programing for awhile, come from a visual basic background. We have a new server with newer compilers. Compiling with -f77 switch. Seems the old software allowed passing of integers, and strings in a call statement. New compilers seems to be inconsistent in passing the...
  37. J

    Comp Sci Computational Physics Programming using fortran g95

    Homework Statement Create a program that computes for the value of sine function. Then compute for its integral from 0 to pi with N intervals, where N=4,8,16,256 and 1024 and compare the result for the trapezoid and simpson method. Homework Equations Trapezoid rule of Integration...
  38. R

    Large-scale eigen solver package for Fortran?

    Dear All, I would like to know what type of solver packages can be used for solving the Large scale eigen problems, implemented in the Fortran language. Especially the simultaneous, subspace, ritz vectors, Lanczos etc.. methods is a must in the package. Does any of you aware of such...
  39. A

    Fortran Read problem in fortran for matrices

    Have data that is coming from Matlab and want to read it into Fortran. Simple example of what I have: PROGRAM file_read IMPLICIT NONE REAL, ALLOCATABLE :: read_matrix(:,:) INTEGER :: i,j OPEN(1,FILE = 'data_wanted.prn', ACTION = 'READ', STATUS = 'OLD') do i = 1,50 do j = 1,25 READ(1,*)...
  40. S

    Fortran Problem with a fortran program

    Hi; I am trying to run a program which includes; call AB write(6,*) 'finished AB' c--------- call ABp(Vup,gup) call ABp(Vdn,gdn) write(6,*) 'finished ABp'...
  41. C

    Fortran Wanted: Ancient Fortran FFT source code

    Hi. I'm new here and wasn't sure which forum to post this request on, but this one seemed a good start. I am developing a talk/seminar on dealing with legacy code. In the late 1990s I was working for a large corporation in a software capacity and one day idly wondered what the source code...
  42. T

    Fortran Can Fortran 90 Arrays Be Dynamically Allocated Based on a Variable?

    Hello forum, I was wondering if there is a way to declare/define arrays depending on some previously defined variable. example: if a=2, then declare/define 2 arrays if a=3, then declare/define 3 arrays If doable, how does one assign names to these arrays?
  43. M

    Desperate Student - Fortran G77 Compiler Help

    I recently asked my professor if he had any research opportunities in the following semesters and he told me that I should download and play around with 'Fortran G77 Compiler' and get back to him. So, I've looked into it but didn't make much progress.First off, I'm confused with which program...
  44. A

    Fortran Dealing with IMPLICIT Definitions and Variable Type Errors in FORTRAN Code?

    So I have been trying to write a code which calls from REFPROP subroutines to get thermodynamic properties and then uses these to do some other calculations. I am facing two issues: 1) The REFPROP subroutines require IMPLICIT definitions so I can't say IMPLICIT none at the top, and this may...
  45. A

    Fortran Why Am I Getting an 'Out of Range in G Table' Error in FORTRAN?

    Ok so basically I am trying to write code that can call from a fluid properties subroutine similar to refprop but it is called FLUID. I need to call the subroutine with temperature and pressure, and have it come back with density, compressibility, and etc. It should be able to do this, however...
  46. G

    Fortran Fortran has this type of If ?

    Fortran has this type of "If"? Hi, I was reading a code from a thesis, obviously the quality of the scan was not good and I reached to this point in the image below, that the programmer uses "If" statements: http://i48.tinypic.com/x5z7n.jpg I am not sure if he uses a "=" sign or a"-"...
  47. M

    Comp Sci How Do I Start Programming in Fortran 95 for a Math Problem?

    Please help in the work of this program : http://www.picpanda.com/ thanks
  48. Z

    Fortran [FORTRAN] Division by zero allowed?

    Hi, I have an issue where I am squaring a very small complex number 1e-20 (FALFA2) which seems to make the value zero (both the real and imag part) and then dividing by it, the problem line is (all the numbers are complex): GALFA = ( FBETA * FAA / FALFA2 ) - ( FAB / FALFA )...
  49. Q

    Fortran Fortran code for geometry of fcc

    Hi friends . is there anybody here who can give me a fortran code for describing fcc lattice and give us the neighbours of each site and also which pay attention to periodic condition ? thank you for your help my friends.
  50. D

    Comp Sci Fortran: How to work out if 3 variables make a right angled triangle

    Homework Statement I have a program which will sort out three inputted variables into order from lowest to highest. I now must get the program to work out if these 3 values could be the sides of a right angled triangle. Homework Equations I am going to use a^2+b^2=c^2 to solve...
Back
Top