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.
Can anyone help me find a compiler/IDE for FORTRAN or C that can work with Windows Vista? I am a physics student and would like to learn some programing, but my computer runs Vista and I have yet to find a compiler that works.
Otherwise, are there any recommendations for a language I could...
Hello,
I am in need of assistance, not with code, but with simply setting Fortran up in XP.
I am under the impression that I need cygwin, gfortran/g95 and emacs. I installed Cygwin, and downloaded some file tree (gfortran-4.4-Cygwin-i686.tar). But I do not know where to get the 'emacs'...
Anyone have experience with Code::Blocks? I'm trying to get it to compile some FORTRAN for me, but getting some confusing errors.
While Compiling:
Compiling: horz.f90
mingw32-g++.exe: C:\Documents and Settings\...\horz.f90: linker input file unused because linking not done
Linking...
Hello, I've been trying to debug some Fortran 77 code so I can eventually update to 95. I keep receiving this message:
/test.f:2824:Unknown pseudo-op: .quad
/test.f:2824:Rest of line ignored. 1st junk character valued 48 (0).
Make:
*** Error code 256 from f95
assembler failed.
Build...
I am having trouble compiling code. Here's my code:
PROGRAM Sample1
IMPLICIT NONE
! Variables and constants
INTEGER, PARAMETER :: n=1000, m=10
INTEGER :: i
REAL, DIMENSION (1: n) :: x
REAL, DIMENSION (1:100, 1:m) :: y
REAL, DIMENSION (1: m):: colavg
INTEGER :: filestat...
it is my first post and It is very serious and urgent
I have a data ascii file composed of real and integer data.
these data are separated by commas.
would any of you write some code to change its format into this?
FORMAT(5I3,F7.2,F6.2,F8.3,F7.2,F10.3,2F7.2,F6.2,I4,f6.1,F6.2)
I am a...
I have a file with text and adjacent to it, the number i want to read. Below is the format. I was wondering how to read just the numbers without touching the text.
trhy 30.0
difje 30.0
sdjk 66.5
xmb 15.0
dcos 15.0
fjvm 2.573e-4
srht 9.05e-3
art3...
Hello,
I have a code in Fortran that I can compile but when I try to build it I get the following messages:
error LNK2001: unresolved external symbol _DEVCRG@24
fatal error LNK1120: 1 unresolved externals
I guess that it does not understand it cannot find the subroutine DEVCRG, but I do...
Hi,
We assume
Max hBy(y) = α1 for y ε (a1, a2) and Min hBy(y) = α2 for y ε (a1, a2)
Where -∞ < α2 ≤ α1 < ∞, and the complex phase speed must lie in the region defined by
(CR + α1 )^2 + CI^2 ≤ µγ^2/k^2, if CR <- α1
CI^2 ≤ µγ^2/k^2, if -α1≤ CR ≤-α2,
(CR + α2 )^2 + CI^2 ≤ µγ^2/k^2...
Hi,
Please bear with me on this because I'm really not a programmer at all but I need some help with modifying a code in fortran. This program is supposed to extract data for a single month of data at a time from the file highlighted in red below which contains 108 years of data. First of all...
I want Fortran to regconize trigonometric functions.
The trigonometric equation I am trying to right in Fortran is the Law of cosines
COS(c)=d^2+a^2-b^2/(2*a*d)
However, I want Fortran to calculate the inverse of the above equation:
How would I write the following equation in Fortran...
I have this line in a Fortran 77 program, and I don't understand how it works:
nran(i)=mod(int(i*ranw(Idum)),i) + 1
What I don't understand is that nran is not a function, nor is it dimensioned anywhere (its type is implicitly an integer). This line only works if it comes right after the...
I suspect that the runtime simulation for a star systems containing thousands of stars , many of those stars whose mass is way beyond the solar mass to be very very long. Is it possible and cost-friendly(i.e, not expensive) to simulate a globular star system cluster over a supermassive black...
Hi all,
I'm new to Physics Forums, but not to physics, since I'm now doing my MSc. I've had a persistent problem in a segment of my Fortran code that I've worked around, but would like to fix.
The long and short is that I'm integrating a six-dimensional ODE with a fourth-order Runge-Kutta...
Hi,
I am new to FORTRAN and am trying to work with a system of ODE's. Does someone know of a routine like DVERK for solving initial condition problems for FORTRAN 90?
In MATLAB I would simply use ODE45. I just need something similar.
Thank you!
I'm trying to make a program that can approximate a differential equation via the Euler's method.
Here is my program :
Program diff
implicit none
Real :: t_0, x_0, t_f, k_j, h
Real :: t,x
Integer :: n,j
Write(*,*)'Chose t_0 and x_0'
Read(*,*)t_0, x_0
Write(*,*)'Chose t_f'...
1. Is there a way to get the index of array, how many cells are nonzeros and have actual data. I can probably do it the hard way.
2. How do you pass an array to a function, the entire array I mean, do I do like function (array(i)) or function (array())
3. Is there an easier way to...
I must calculate \int_0^1 e^{-x} dx using the composite Simpson's rule, i.e. the common Simpson's rule but applied on many intervals between 0 and 1. This is not all : I must divide the interval [0,1] in 100 subintervals and then in 200, to compare the value obtained of the integral. And then...
I'm working on a program for Newton's method for solving equations.
This is my code:
=======================================================
program Newton
implicit real(a-h,o-z)
F(x) = x**2 - 4
!...&---1---------2---------3---------4---------5---------6---------7---...
Hello,
I am new with FORTRAN but experienced with PLI/I, Cobol (mainframe), Clipper (PC) etc.
As an exercise I'm writing some small pograms.
Now I have one problem/question:
I have an INTEGER array (ARPAS). When printing this array I want to suppress printing the zeroes; only # 0...
[SOLVED] Riemann Sum with Fortran 90
My assignment: Use Reimann Sums to estimate pi to 6 decimal places (ie: you can stop when successive iterations yield a change of less than 0.000001. For the Reimann Sums solution, an iteration equals 2X the number of segments as the trial before. Print out...
It's about Numerical Analysis and especially Newton's form of interpolation. That is, the program must ask us to input the nodes where the function (cos(x) in this case) is equal to it's interpolating polynomial.
From that P(x)=a_0+a_1(x-x_0)+...+a_n(x-x_o)...(x-x_{n-1}).
And then it must...
You are given a solid, homogenous block of material, 48x24x12 inches suspended in air at 70 degrees. The block is initially at 70 degrees as well. Then, a laser is used to heat one corner of the block to a constant 200 degrees. Model the heat transfer through the block and report the average...
I hope someone out there can help me out on this one. I have intermediate C++ experience, just a working level knowledge, however my prof. threw me a project to work on and where I am at now I have no experience with.
So this is what's up, I have a massive fortran 77 program...that does some...
I got a new project from my professor to calculate the form factor of the cavity for his particle detector thing. He told me to get some code from a colleague, decipher it, and use it for the new cavity.
The code is in FORTRAN. I've had some programming experience, so it's not so bad, but...
Hi!
I frequently have to solve systems of nonlinear equations with Fortran. So far I used a code which I didn't write by myself which is based on a Newtonian root finder from Numerical recipes.
I would like to write a Fortran code on my own, based on another Numerical subroutine available on...
Got to write a program that factors a given number(>1)
Here is what I have:
program Factors
implicit none
real::n, i
print*, "enter a number:"
read*, n
i=2
do while (n>1)
if (mod(n, i)==0) then
i=i+1
n=n/i
else
write (*,*) ' X= ', X
end if
end do
end program...
I have this program that needs to be written, but I don't know where to start. Can someone please help me with it.Thanks
*1 Problem Statement
Mrs. Deli is running the delicatessen store “Deli Deli”. Last year Mrs. Deli has decided to expand her business andbuild up an on-line store. She...
Is there any code that i can use to execute a file through a fortran compiler? For example i want to execute an excel file (kk.xls) just before the termination of the main code.
Thank you
In Fortran I need to output some data as a bitmap image, to visualise results. Problem is, with every WRITE statement it seems to append some unwanted bytes before and after the data itself. I have found out that these are called record delimiters, but I want to turn these off. How?
I have very large equations that I need to solve using numerical techniques. The equations are in latex. From these now I need to form matrix in fortran and then continue the solution procedure in fortran. Can anyone advice how I can do this conversion from latex code to fortran code. The number...
Hi
I need help with programming the following:
(T/(T-2*d))^(i*Nu)=exp(-i*Nu*ln|T/(T-2*d)| +Nu*arg(T/(T-2*d))
I don't know how to do the arg bit in Fortran90...this is what I've tried so far
A=T/(T-2*DELTA)
B=EXP(-CI*NU*LOG(ABS(A))+NU*ARG(A))
but obviously it threw back an error...
I'm trying to write a Merge Sort program with fortran 90. However, this is what I already could do:
program sorting
integer :: i,ialloc,error,n,d
integer, pointer :: a(:)
Print *,'How many numbers would you like to type in?'
Read(*,*)d
Print*,' Enter the values, separated by...
Why does does the following code not compile?
PROGRAM TYPES
INTEGER A(3)
A(1)=1
A(2)=2
A(3)=3
CALL SUBR(A)
print *,'Done'
RETURN
END
C --- Here is a subroutine -----
SUBROUTINE SUBR(A)...
I've written a program that repeats a calculation a certain number of times in single precision, then in double precision. The times are recorded by the cpu_time(real t1) subroutine. (Specifically, the calculation is aReal/(aReal+0.01) .) It seems that the time for the double calculation is 1.20...
I'm trying to get a fortran 77 program to run faster on a computer with a dual-core processer, so I'm trying to learn how OpenMP works. Unfortunately, I can't get the "hello world" file on the wikipedia page to compile.
(Here's the code:
PROGRAM HELLO
INTEGER ID, NTHRDS...
Hello, I have the following doubt, maybe someone can help me with this.
Suppose I have a general purpose routine that finds the zero of a function f(x), something like
subroutine fzero( func, x1, x2, xzero )
implicit none
real, intent(in) :: x1, x2 ! Upper and lower bounds where the...
How many bytes in DIMENSION?? - A Fortran Question
I'm looking at some Fortran code. Some variables are of type dimension. How do I tell if these variables are integers or floating points numbers? How do I know if they are signed or unsigned? How do I tell the number of bytes occupied by...
I have some code in Fortran 77 that executes at pretty good speed. I also have a highly optimized version of the same algorithm in C. When using g77 and gcc, the unoptimized Fortran is just slightly faster that the highly optimized C. When using MSVC++ and g77, than the C is a bit faster...
Hey,
I wasn't sure whether or not to put this in the homework section or not because I need to complete this code for an assignment, but I thought that someone with fortran knowledge might have a better chance of seeing it in this section.
PROGRAM testing
! Variable declarations
CHARACTER...
Hey everyone,
I have a course requirement for taking one programming class, the choices are Fortran and Visual Basic.
I am not doing well as i expect in fortran, but not sure if its becuase its my first time in programming or the language difficulty. I am thinking to swap to Visual Basic...
basic question really...can you have subroutines nested within subroutines? or are there any other types of subprograms within fortran95 other than functions and subroutines? (need one that can pass back an array)
if you can [use subs within subs], how do you link them? like in the main...
Hi - I expect this is quite a simple question.
What are fortran structures? I'm trying to convert fortran code into MATLAB and I don't know what a structure / endstructure statement is.
e.g.
structure /pixel/
union
map
INTEGER*4 cl
INTEGER*4 rw
endmap
map
INTEGER*4 x
INTEGER*4...
Mentor's note (May 2012):
This thread is closed to new posts. It is over five years old and has been resuscitated many many times by people finding it in Google searches or something. If you want to post a question about Fortran programming, please go to the parent forum...
i need to know if someowne can help me with a program that i have to do to resolve a heat problem of the Patankat(autor) book. exercise 5.1 is the problem and to solve it i need to use the upwind method and the CDS method..
please help
thanks
Being a newbie on Fortran I need some help with localizing an error.
When I run my executable I get the message:
I get that somewhere in my code there's a division by zero, which obviously will not be accepted, but my question is where?
Is there a way to get the position of the error pointed...
Hello
I have a bunch of data in a text file that got loaded into an array. Now the problem is that there are a lot of outliers. So let's say if I find the outlier, how do I get rid of it, by say move the next one to that spot. If I do that how do I redefine the arrary size. What would be...
Let's say you have an array A and a variable B (both reals). Apparently
parameter (A = (/1.2, 3.4, .../) )
is illegal, so you have to do
data A /1.2, 3.4, .../
instead. However, what if you have a statement afterwards like this?
1 parameter (A = (/1.2, 3.4, .../) )
...
2...