Hello,
I'm making now a simple program (in Fortran 77) to find the roots of the quadratic function. When the discriminant is negative, imaginary numbers are to be used and the solution of the function is a complex number.
I'd like to define a complex variable so that:
complex x...
I have been trying to merge some python with fortran, to build a nice interface but still be fast. I spent the last two days learning how to use f2py, buy everything would be so much easier if I could call a Python function from Fortran instead of doing the other way around.
Anyone know how...
I've heard that there's some movement towards newer languages like Python. But is there some resistance to this movement? Is there a similar problem with physics departments?
Do astronomers prefer their grad students to be fluent with FORTRAN or with Python? I know one professor who doesn't...
I know there are tons of them out there, but I am looking for a recommendation on one. I know absolutely nothing about Fortran and very little about programming in general. I do know that I will be inheriting a bunch of code that was written in a g90 environment (if that is even the correct...
Hi there,
I've been puzzling over the following code (which works in serial). It produces radically different answers if the (blank) WRITE(*,*) is included or not. Any help greatly appreciated!
eps = 0.0
!$omp parallel do default(none) private(i, j, current_angle, current_energy) &...
I have made and compiled a programme,but the calculations are not good,because it has somehow problems with findfiff2d.o file(calulates travel-times on nodes).May be the problem is that findiff2d calls 6 other subroutines.So main=>findiff2d=>expand,sort,pass,stensilcs2d,fnod e,fside.So how to...
Can someone suggest a way to easily compile fortran 77 code so it will run on a Windows machine. For my research I need to use a computer code that was written by former students at my school several years ago in fortran. I have very little experience with this sort of thing but I really only...
The following question pertains to programming, but I have posted it here because I want the views of mathematicians (also of physicists and engineers), not those of computer scientists (which i already know) and I do not know how many of the former category care to look into programming...
Hey guys,
I am wondering if anyone could help me with a simple problem.
I want to remove key parameters from the "type declaration/parameter" portion of my code and into an external input file for easy access. The problem is, many of my variables (such as arrays) can't be defined until...
I have a program written in Fortran IV and tryed to run it with fortran77(g77). Nevertheless
it could be not problem in fortran IV it make some errors in fortran77. I am not programmer but trying to learn some. Here is the errors that compiler fortran77 is wrote:
found.f: In program...
Hi,
I have been struggling with the Fortran IO for a while. Here is the question, any comments will be much appreciated.
I output some double precision numbers with the format:
write (file_id,'(6(ES17.10E3,2X))'), a,b,c,d,e,f ! say the filename is 'data.dat'
It works fine.
But...
Hi everybody.
I am learning Fortran on my own, and I started doing simple examples like factorials, iterations, and stuff like that.
The problem comes in recursion, I'm trying to run this simple factorial program using recursion, but the outcome is completely wrong.
I asked to an expert in...
Dear all:
For a standard linear system, y(n*1)=A(n*n)x(n*1)
If y is exact and A is well-conditioned, it is easy to calculate x.
However, if y has some disturbances or some errors, at the same time, A matrix is ill-conditioned. It is difficult to accurately obtain vector x...
I am trying to input a txt file into my fortran program. My txt file is a 9x2 table of integers, all I want is to display the values in the same format in my program. I tried using,
program name
implicit none
integer :: input(9,2), I, J
open (unit=20, file="values.txt")
DO I =...
Hi guys,
I just wrote a simple code for delta function and print it out. Here it is.
program main
implicit none
integer i
real*8 del
real*8,parameter:: ep=1D-2
real*8,parameter:: pi=3.1415926
do i=-10,10,1
write(*,*)...
I'm trying to contruct a program that will generate a different random number between 1-10. I am not sure how to make it only 1-10.
PROGRAM guess
USE const
IMPLICIT NONE
INTEGER::i
REAL(kind=dp)::x
call random_number(x)
WRITE(*,*) 'x=',x
END DO
END PROGRAM...
Hello,
I think i heard somewhere that a multidimensional array in fortran 90 may be stored non-contiguously in memory. Is this true? Even if it the size was known at compile time?
If your answer is it depends on a compiler, what about ifort and gfortran?
Hello all,
I am new to programming and fortran, I have Intel Fortran 9.1 and using this via Microsoft Visual Studio 2005. To start with I have found a simple exmaple from the a Intel Fortran 90 book. I seem to be able to run a debug, but can't seem to create an executable? Its my first time...
Hi,
I'm trying to compile a code (.f95, compiling using gfortran) in which I'm using a 'do' loop to set the values in a complex array; the following little piece is giving me trouble:
double precision, dimension(n) :: x
complex, dimension(n) :: y
do i=1, n
x(i) = ...
end do
do...
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...
Hi all,
do i = 1, 79
open(2,file=afiln(i),status='old')
do k = 1,11
read(2,'(51a)')astr1
enddo
do j=12,2000
read(2,22,end=23,err=23)iyr,imn,id,ih,imt,flx
write(7,*)i,j
obstim =...
I am a student who is currently enrolled in a computer science class, and the program we are using is Fortran 95. I was wondering how I could get this program/compiler onto my own computer? I have almost no experience with programming and Fortran so I really want toget this on my own system...
hi
i have over flow error in FORTRAN for a program that do some function and summation on matrix elements , then multiply them and at last find its determinant, the dimension is SET by input
when it is more than 7 i have this error
what should i do?
Hello all,
Although I am currently working on implementing FORTRAN on my Mac, I would also like to find a compiler that works well with Windows 7 32-bit. I initially had Win7 64-bit installed on my computer, but when I went to use my (really old) DIGITAL Visual Fortran install disk, it said it...
If so, how did you install it? I have been looking at http://gcc.gnu.org/wiki/GFortran" and apparently you have to be a rocket scientist to install the compiler. I'm a little desperate here. I really know nothing about compilers. Most compilers I have dealt with simply require me to run a...
Dear all,
I am using f90 and trying to pass only one column/row of an array into a subroutine. So I want something like...
call test(x(1,:),...)
If "test" defines the first entry as a vector, will this work?
Natski
Hello there. I've doing a program that I do not know how many files will be needed, because it'll depend on user's choice. So, how to name them?
I tought that a command like, where n is a user-input number
Do While (i .LE. n)
Open (Unit=i, File=i'.dat')
i=i+1
EndDo
Would be enough, but I...
I have a short code that calculates the running median for three columns of data in an input file and writes the running medians out to three columns of data in an output file. I use Numerical Recipe subroutines and functions to compute the running median. If I include a WRITE(*,*) directly...
Hello.
I'd like to create an array containing characters (basically a word stored as a 1xn array). I have no idea how to do this, however. I thought that the most obvious way to do it (yes, it would've been highly impractical for long words) was to write
character, dimension(3) :: A...
Hi,
I require specific formatting for a quantum chemistry calculation. But for some reason I can't seem to write using formatting. I have checked tutorials, but to no avail. Here is my toy program:
program test_format
implicit none
real :: m
write(*,*) 'Enter a number'
read(*,*)...
27 Jul 10 2:35
Hello,
I have an error when I try to execute my python program which uses a fortran subroutine (which call date_and_time function) :
"undefined symbol: G77_date_and_time_0"
Do you know how can I fix this issue?
Thank you very much!
The instructions are to calculate the odds of winning if you are dealt King and 9 of clubs, what are the odds of winning? I am finding myself spending more time trying to figure out texas hold em (never played before) than writing the program. So far I found a list on wiki that breaks down the...
I've made a program that uses more than 72 characters per line. When I try to compile it on gfortran, using -ffixed-line-length-n, it returns several errors, all of them derived from a line truncated at the very beggining. How can I compile it or untruncate the line?
The code is as follows...
I am trying to write this program, it runs fine but I can't get the imaginary numbers to print correctly. I have been trying this for a few hours now and can't figure it out. Here is the code, I am running Force 2.0. Thanks in advance for the help.
Program Quad
Implicit None...
I am using one progran,have problem with char function.
rfile(3:4)=char(id1+48)//char(id2+48)
write(6,*)rfile
open(28, file=rfile, form='unformatted', status='old')
I have entered write line.This is what I get:
fd01.picks
open: No such file or directory
apparent state: unit...
Hi all,
When I use Present(x) to check for the presence of an optional variable, I am getting TRUE even when the subroutine call clearly does NOT contain the optional variable. See here the call to test_present(a,b):
program options
implicit none
real*8 a,b
real*8 c
a =...
I was just wondering if anyone can recommend any free Fortran compilers for OSX on Mac? I am going to be starting some work that requires the use of Fortran and though I have a Windows machine, I would like to use my Mac since it is faster.
I have Googled around, but I am really not sure...
I've to do a program which read "N" pairs of points and print the points which are contained in a two dimensions quadrilateral domain with vertices on (2,2), (2,5), (7,5) and (5,2),
Can anyone help me?
Thanks for the atention and patience.
http://www.nag.co.uk/sc22wg5/
It looks like Fortran 2008 is going through its final steps of standardization. What does this mean for scientific computing? Since people still use Fortran 90 despite new revisions up to 2003, will this go under the radar, or will this be a new and useful...
I can't figure out how to make a do-loop in Fortran to do the following:
I have 2 variables. Let's say:
and I need 10 fields printed out.
The first field will have the value:
level + step
<then the value of the one above + step>
<then the value of the one above + step>
<then the...
Hey guys,
I tried looking around on the web and came back without much luck..
Is it possible to print FORTRAN output using FORTRAN code? When I say "print," I mean to a local printer such as a laserjet.. not just printing to the terminal screen..
I've searched pretty intensely on the...
Hey all,
I'm in the process of writing a Suggested Reorder Program for my father's small business..
His current computer program exports its item data in the form of .CSV files. I'm trying to read the file into FORTRAN to manipulate. However, I run into the following problem:
Even...
Hello all, first time I post here. I'm doing a PhD in Plasma Physics at the moment and have always been using MATLAB. It seems the research industry however does not look kindly on MATLAB and develops solely on FORTRAN (!)..
Anyway, I don't need to go into a lot of detail. I have a big 10x10...
Hi,
Is there a command available that makes the compiler ignore all write(*,*) statements?!
The thing is, I'm working on a code which will eventually run for several hours (perhaps days) to complete a single run. At the moment I'm testing so I write a lot of data to the screen in order to...
Hello,
I am trying to write a Fortran subroutine to solve non-linear equations (given by external function fnxname) using Newton's method, where the derivative is given by finite difference calculation. How may I use the function in the program.
Suppose the desired function name is given...
Hi FORTRAN experts,
I have two arrays of data, called data1.dat and data2.dat. each contains 60 data. What I want to do is to compare the data in each file and write the counting into bins. It goes like this. First, take the first data in data1.dat file and compare with the 60 data in...
Salford fortran library compiler error??
Dear all,
I have install the NAG fortran library, firstly, I compile the fortran program by using the
Salford Fortran compiler with NAG static Lib. Command Prompt
by typing
ftn95 -c ProgramName.f95
It got a few warning, not error. But I...