Fortran Definition and 858 Threads

  1. A

    Return Multiple variables in Fortran

    Hey Guys, I am converting my code from MATLAB to fortran. Now in MATLAB it is rather convenient to write a function which returns multiple variables. I believe a function in fortran can return only one variable. I think a subroutine can return multiple variables. I was not able to find any...
  2. N

    Comp Sci Fortran 77: Reading CSV File & Outputting Time, Latitude, Longitude

    Hi guys and gals, I'm trying to use fortran 77 to read a csv file which has data like this...
  3. F

    Fortran Why isn't my Fortran program running properly?

    We made a program for our thermo class and when we go to run it, it tells us errors were encountered but will not display what errors it has. It won't print out anything. I appreciate any help you guys have to offer. Print *, 'Nicholas Grover / Corey Demers' Print *...
  4. W

    Fortran Which Fortran version to learn

    I have decided to learn Fortran over the summer. However there are various versions out there. Which version would you recommend learning? I will be using Fortran for computation in physics primarily. I will also be interfacing Python and Fortran together.
  5. R

    Fortran Why is my FORTRAN 90 Program Producing Unexpected Matrix Elements?

    Hi all, I encountered a problem while running a FORTRAN 90 program, which appears (to me) to be quite surprising. Can someone please explain the following things: 1. Why the (4,1) element of the beta matrix is 5.0 instead of being 2.0 ?? 2. Why the (5,8) element of the beta matrix...
  6. E

    MATLAB Fortran 90 vs Matlab: Comparing Program Speed

    Hello. I am trying to translate a program written in MATLAB to a fortran code and I have found out that the fortran code is slower. I couldn't believe it so I decided to do a simple program in fortran 90 and MATLAB in order to be sure. The code in MATLAB is: function D2D() Nx=2^11...
  7. W

    Fortran How Can I Integrate Two Fortran Programs for a Game of Hangman?

    Hello all, I am attempting to make a fortran program that allows the user to play a game of hangman. So far I have written a complete program that assembles piece by piece the base, gallows, rope, body parts, etc.. I have another completely separate program that reads from a file 264 random...
  8. C

    Fortran Formatted output problem in Fortran

    Hello, I have correctly defined my OPEN and CLOSE statements. When all of my WRITE statements with their associated FORMAT statements are at the end of the program I get the formatted output that I need. If I move one of the WRITE statements to the body of the program (within a particular...
  9. L

    Fortran Need help installing fortran compiler

    Hi! I wanted to install a f77 compiler, I am running Win7 but also have WinXP, I installed MinGW 5.1.3 and did everything mentioned in this pdf (https://docs.google.com/viewer?url=http://www.pns.anl.gov/instruments/scd/subscd/Fortran_and_C.pdf) So, basically its an automatic installer, I...
  10. Ƒ

    Fortran Can You Loop Numbers and Write an Output File in Fortran?

    Is it possible to loop a set of numbers? For example I wish to run a set of number 1,2,3,4,5...52 but when we get to 52 I wish to go back to 1 and start looping again. How do write an output file in Fortran? I have opened a file and moved each character so that each letter has moved for...
  11. N

    Fortran Fortran: help with I/O in Direct Access and Seq. access

    Hello, I am implementing simple check-pointing in an application so that the history is saved to a file and upon restart the data is read from this file. -> The history file contains an array of real*8 numbers and precision is very important in the program. I first implemented this using...
  12. C

    Fortran (Fortran) Does order of accessing a matrix affect the performance?

    Hello, In Fortran 90, will the performance (in terms of computational efficiency) of the following two be the same. If not, which one will be faster. Please advise with the reasoning: (i) do i = imin,imax do j = jmin,jmax do k = kmin,kmax Several statements (rigorous...
  13. S

    Finding Fortran Compiler & Running Clawpack on Windows XP

    I don't know fortran. I have to run few files from clawpack and I have to get results. I have windows xp 2002. Can anyone tell me what software/fortran compiler should I install ? and how do I get results? Thanks in advance
  14. O

    Fortran Simple Fortran Reading Values and Calculations

    I am trying to self-teach myself Fortran for an undergrad research position. A basic program that I am trying to develop is something will open a file, read a single value from a large table of data, do some calculations with it, and print it into a new file. I was hoping to get a little advice...
  15. S

    Fortran Merging arrays in fortran 90/95

    Hi, can someone help me with this one? I'm trying to merge several 1d-arrays into one 2d-array. Is there any intrinsic routine/function in fortran 90/95 to do so? I also thought of pointers. Can I assign a 2d-pointer to more than one object so I have a pointer array whose columns point to...
  16. N

    Fortran Help with formatted output in fortran

    Hello, I am trying to print in formatted output using the format specifiers but I am not able to get the correct output. I am trying to print an array with 11 reals, followed by one more real number and finally an integer. When I skip the integer, the format statement works and but when I add...
  17. Ƒ

    Fortran Simple Fortran Program With Random Numbers

    I have been busy trying to generate, using FORTRAN's random number generator, random x and y co-ordinates which follow a simple pattern such as x2-100x, but for some reason the FORTRAN compiler prints nothing. Anybody want to help me with this problem? program quadraticdistribution...
  18. R

    Fortran Learn Fortran Programming: Tips & Resources

    Hi , i need help in writing fortran code.? can any suggest me best site or where to approach?
  19. N

    Fortran Co-Array Fortran: Questions & Answers for Amateur Programmers

    Hi Guys, I have coded in f77/f90 for a few years in what I would consider a fairly amateurish way but I am now hitting the CPU wall for some programs and need to parallelize some programs to make use of multiple cores. Looking around Google, I quickly came across this co-array business...
  20. N

    Fortran Quantile subroutine, Fortran 90

    Hi all, I have been Googling for a Fortran 90 quantile routine but to no avail... I need a subroutine to which one passes an 1-D array plus the quantile range required... e.g. "call quantile(array,0.5D0,value)" would give me the median of array. Does anyone know of a handy (and...
  21. R

    Comp Sci How can I read an array from a specific part of a file in FORTRAN 77?

    Using Fortran 77, I'm trying write a program which will read in the coordinates of the atoms in a molecule from this input file: 21 Aspirin C 0.8641 0.1885 -0.0550 C 1.6904 1.2832 -0.0518 C 3.0579 1.1437 -0.0197 C 3.6120 -0.1296 0.0167 C 2.7571 -1.2117 0.0051 C 1.3999 -1.0697 -0.0319...
  22. B

    Fortran Printing 1D array in Fortran as 2D array

    Delete.. Delete..
  23. Ƒ

    Fortran Solving Problems in Fortran Code for Prime Numbers

    Everytime I try to compile the followng code, it fails to give me the values when n is greater than one, I have tried and failed to correct that mistake, can you help? program sieve implicit none integer*1 s(1000000), offset (10), sequence integer i, j, n c INITIALISATIONS: n=0...
  24. D

    Fortran What does errorfmt mean when running Fortran g77 code?

    Hi, I received a code written in Fortran 77, and I am trying to compile it and run it using g77. It compiles easily with no errors, but I keep getting the following error when I execute errorfmt: read unexpected character apparent state: unit 5 named jeffin last format: (10X,D13.7) lately...
  25. Ƒ

    Comp Sci What Is the Last Prime Quadruplet in the Sequence i, i+2, i+6, i+8?

    Homework Statement I am trying to find prime numbers that are i,i+2,i+6,i+8 apart. Could someone tell me the last set that this gives? Homework Equations - The Attempt at a Solution program sieve_t implicit none integer*1 s(1000000), offset (10), sequence integer i, j, n...
  26. C

    Fortran How Do I Determine Single-Precision Machine Constants in Fortran?

    Help! I know almost nothing about Fortran but need to use a program by others. I encountered a problem in determining the "Single-Precision Machine Constants" for my desktop computer (intel pentium dual core 5200 2mb l2 2.5ghz 800 fsb with Window Vista). Please take a look at following part or...
  27. A

    Fortran Solving Problem in Fortran Program - Bevington Polyfit.f

    hi all, greetings, i have a fortran prg to fit 2nd order polynomial to my data taken from (bevington--- polfit.f) i'm making some mistake, and i could not find what is the problem with this. When i give some other other random data it is fitting properly but not the data i have :( for...
  28. D

    Ising Model & Wolff's algorithm in FORTRAN

    Hi, I have the problema of implementing wolff's algorithm for ising model in 2-D lattice. Has anyone ever done this algorithm in FORTRAN ? I have questions of how to join the clusters. Alexandre
  29. B

    Fortran Help to a FORTRAN newbie with KIND, please

    Hi, I'm starting with FORTRAN (I have Microsoft Powerstation) and I was experimenting with KIND. Specifically, what I wanted was: integer (kind=8):: list of variables But the compiler doesn't let me use KIND with integers if kind>4, and I really need to use long integers. Can someone...
  30. fluidistic

    Fortran Simple program in Fortran, I get an error

    It's not an assignment. Rather I'm trying to learn back some fortran. I've found a website with some simple problems to do, that's where I got this one. See the first problem of this page : http://www.chem.ox.ac.uk/fortran/. Here's my program : Program vasy implicit none Integer ...
  31. Ƒ

    Comp Sci Solving Twin Primes with a Sieve Algorithm in Fortran

    Homework Statement I have been trying to come up with a program to calculate twin primes using a sieve algorithm in Fortran. So far I have been successful in creating one that finds primes, but I am having difficulty finding one that finds prime twins. If I knew how to do this I could find...
  32. D

    Fortran Fortran: Passing loop names to subroutines

    Hello, A Fortran program I'm working on has a few nested, recursive subroutines, with many entry points between each one (there are lots of places in the first subroutine where calls to the 2nd depth subroutine are made, etc.). I'm looking for a way to conditionally exit all subroutines...
  33. B

    LAPACK for Fortran under Cygwin

    I just installed LAPACK, but I'm not sure how to use it. The documentation tells about the routines, but the problem is my compiler isn't recognizing them. For example...I wrote a simple Fortran program to test a routine (SGESV): program testlapack implicit none...
  34. Somefantastik

    Fortran Finding a Good Fortran Intro Text: Examples & Exercises

    Can someone suggest a good fortran introductory text, with examples and exercises?
  35. K

    Comp Sci Fortran 90 Euler Scheme for Radioactive Decay

    Homework Statement in fortran 90 write a program to using the euler scheme to solve the differential equation for decay of a radioactive substance dx/dt = -j*x solving the equation we get x = e^(-j*t) following info is given 2. Homework Equations and values t0 = 0.0 tF =...
  36. A

    Fortran How to Call Gnuplot from Fortran to Plot Data Points?

    hello. I have a fortran code that has data points as output. How do I get fortran to plot these data points using gnuplot? Is there a way to call the external program from within fortran? I am using fortran95, gfortran compiler. I'm on a windows machine, but I'm connected remotely to...
  37. I

    Comp Sci Smoothing Data and Identifying Hot and Cold Spots in Fortran 90

    Homework Statement Write a program that that prompts the user for a filename of data, reads the data from the input file, smooths the data using the average value of the cell value and all of the nearest neighbors -9 cell average for interior cells -6 cell average for edge cells -4 cell...
  38. 5

    Fortran Gaussian Elimination in Fortran

    Hi, I am trying to recreate the naive gauss elimination method in fotran 95 but am having a few problems with it. The idea is to read in a nxn matrix of equations, so you can type in any number when u start the program and then the program will ask you to enter the relavant amount of...
  39. T

    Fortran Find Area Under Curve w/ Fortran Riemann Sums

    Hello, for my FORTRAN class it wants me to use the method of Riemann's sums to find the area under the curve for the function f(x) = -(x-3)**2 +9, and stop when successive iterations yield a change of less than 0.0000001. I know I am going to have to used double precision. I am just confused...
  40. C

    Fortran Fixing Fortran 77 Output Bugs with Negative Exponents

    I recently inherited some legacy code written in fortran77 which I'm going to be modifying quite a bit, and at this stage I find that I'm continually getting stuck on small fortran quirks... Just wondering if I could get some advice on this particular problem. I'm outputting the values of...
  41. E

    Fortran What is causing issues with WRF and Fortran compilation?

    Dear all, I am having some problems with WRF and Fortran. When I compile a software I got the following result: PGF90-S-0072-Assignment operation illegal to external procedure vfnsew. real (8) mm_vfnsew(mw,mw) real (8) vfnsew, vf_n_s, vf_e_w, vfns_f, vfns_s, vff_ns, vfew_f...
  42. N

    Fortran Understanding Fortran 90 Arrays and Variables: A Few Simple Questions

    Hey all! I have a few simple questions but they have been wrecking my head for a while now, for Fortran 90: 1. I have the following Complex (Kind=pr), Allocatable :: U(:,:,:) Does that mean that U is a complex array? And if so, I thought a complex number in Fortran is followed by an...
  43. M

    Fortran How to Read in Execution Flags in Fortran

    Hi All, Just like to know if it's possible for a Fortran program to read in data on execution. For example, in JAVA, say if I've written a program for matrix factorization, I can type in the command line: "java mfact q" for QR factorization or "java mfact c" for Cholesky...
  44. B

    Fortran FORTRAN ?: Trying to bypass significant slowdown

    I have experienced a serious program execution slow down and traced its source to one calculation...pseudo code below: do a=0, 360, 10 do b=0,85,5 do c=0,360,10 do d=0,85,5 bunch of calculations involving double precision real variables (stored in variable ele)...
  45. A

    Fortran Fortran 90 & elements array comparaison

    Dear all, I'm trying to figure about an efficient way to to get the redundant element in my array. For instance, let's take the array [0,2,3,0]. I'd like to get out [2,0,3] (or 3,0,2 it doesn't matter). So it find out which element is duplicated, an puts its value in between the 2 other...
  46. N

    Fortran How can you write sgn[Im(z)] in fortran?

    How can you write "sgn[Im(z)]" in fortran? Hello everybody; How can you write "sgn[Im(z)]" in fortran? , then what do you need to add in the header? also what does "sign(a,b)" mean? Much Thanks in advance
  47. A

    Fortran What Does the Fortran Statement 'IF ( IP - I1 ) 180, 170, 180' Mean?

    Hi all, What is the meaning of the following Fortran statement IF ( IP - I1 ) 180, 170, 180 kindly help, thank u,
  48. N

    Fortran What dose d-8 mean in Fortran?

    What dose "d-8" mean in Fortran? Dear friends; What dose "d-8" mean in Fortran? Thanks
  49. N

    Fortran Does Allocating a Pointer in FORTRAN Give it a New Address?

    Hi all. When I have the following code in FORTRAN: integer, pointer :: ptr ALLOCATE(ptr) then does "ptr" receive a new address (i.e. do we have "ptr => <new integer>") or does the pointer retain its address (i.e. we don't have "ptr => ...")?
  50. fluidistic

    Fortran Is it possible to take advantage of a multicore processor for fortran?

    I have a dual core processor (intel) but I think that fortran programs only uses 1 processor. Can Fortran use both processors to calculate faster?
Back
Top