Fortran Definition and 858 Threads
-
J
Fortran What is the purpose of #ifndef statements in Fortran code?
Hi all I'm using Fortran code written by someone else, and a lot of the files have #ifndef statements in them. For example: #ifndef global REAL array(2500) #endif I've tried searching online, but can't find anything useful that actually explains what this bit of code does...- jf22901
- Thread
- Fortran
- Replies: 4
- Forum: Programming and Computer Science
-
M
Comp Sci FORTRAN Help: Functions and Subroutines
I'm having some difficulty figuring out exactly what the issue is here. The compiler tells me that I'm lacking types for certain function variables, but when I define them in the module it tells me they are defined in multiple locations, and still won't compile. what can I do to absolve this...- mattmac.nuke
- Thread
- Fortran Functions
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
H
Fortran Fortran 95: formatting of output (ints and chars)
Hello. I am a physics student working on research project which involves Fortran 95 code. I am very new to Fortran but I do have an intermediate knowledge of Java. The task I am attempting seems like it should be very simple but there are many subtleties to learning a new language that are...- hetanquary
- Thread
- Fortran Output
- Replies: 2
- Forum: Programming and Computer Science
-
M
Comp Sci FORTRAN Help: Concept of User Defined Functions
Alright, I have a situation where I need to create a user defined function (I've done that) next I need to write a subroutine that uses the bisection method to find the zeros of said function (I've also done that) but I can't figure out how to call on the user defined function to evaluate at...- mattmac.nuke
- Thread
- Concept Fortran Functions
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
D
Comp Sci What is the error in my Towers of Hanoi Fortran 90 program using recursion?
Homework Statement Write a Towers of Hanoi program in Fortran 90 using a subroutine. Homework Equations The Attempt at a Solution hello all Ive been trying to write a simple Towers of Hanoi problem in FORTRAN 90 dealing with recursion. Ive got my program to compile but it...- Dylicious
- Thread
- Fortran
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
M
Comp Sci Need fortran help Trapazoid riemann sum
Alright, I cannot seem to get this subroutine to return the correct sums for the trapezoidal rule... Where do I need to fix? SUBROUTINE atrap(i) USE space_data IMPLICIT NONE INTEGER :: i, j REAL :: f_b1, f_b2, f_x1, f_x2, trap_area REAL :: delta_x trap_area = 0 f_b1 = lower f_b2...- mattmac.nuke
- Thread
- Fortran Riemann Riemann sum Sum
- Replies: 5
- Forum: Engineering and Comp Sci Homework Help
-
T
Fortran [FORTRAN] Writing to same file from multiple processors?
I am working in FORTRAN I need to avoid writing to the same file at the same time while working in a parallel environment. I have a program (that I have not written and cannot edit) that calls a subroutine (that I have written and can edit). The subroutine is called over and over again by...- tav98f
- Thread
- File Fortran Multiple Writing
- Replies: 9
- Forum: Programming and Computer Science
-
C
Comp Sci FORTRAN 90 Help- reading input in format DDMMYYYY + more
Homework Statement This is assignment is on FORTRAN 90: In an assignment i have, i am to enter a date in the format DDMMYYYY, and its suppose to compute and display the day of the week that date falls on (based on a given algorithm). I was able to code a program that would give me the right...- cooljosh2k2
- Thread
- Format Fortran Input Reading
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
C
Comp Sci How Can I Install Fortran on a MacBook Pro for Numerical Analysis?
Well I am taking a Numerical Analysis course, and I just bought a MacBook Pro. My problem is that I just barely can handle Mac's software, I need to install fortran and I don't have any idea of how to do it, also I need a program similar to Origin on windows for my mac, for the data analysis...- Casco
- Thread
- Fortran install Mac
- Replies: 7
- Forum: Engineering and Comp Sci Homework Help
-
C
Comp Sci Spring pendulum system fortran program
I just want to know if someone has the fortran code for the numerical solution of the pendulum with a spring. And if it is so, can it write it here?- Casco
- Thread
- Fortran Pendulum Program Spring System
- Replies: 6
- Forum: Engineering and Comp Sci Homework Help
-
K
Fortran How can I fix issues with passing values between subroutines in FORTRAN?
Hi all, Greetings. This could be a basic question, and if it is, pardon me for my ignorance as I am a newbie to FORTRAN. I am trying to modify a FORTRAN code where I have added a subroutine (say SUB1) to calculate a variable, say (QX). What I did is to call this subroutine in another one...- krishvk
- Thread
- Fortran Programming
- Replies: 2
- Forum: Programming and Computer Science
-
M
Comp Sci FORTRAN Help: Using Functions and Arrays
Alright, so I've updated it once more... The only thing I need to do is figure out how to convert the functions x_data, y_data and choi_1 that store all 3 of the inputs I need for the main program and other functions. program calculator IMPLICIT NONE REAL :: addition, subtraction...- mattmac.nuke
- Thread
- Arrays Fortran Functions
- Replies: 6
- Forum: Engineering and Comp Sci Homework Help
-
M
Comp Sci FORTRAN Help: Bisection Method & Roots of Functions
Homework Statement The purpose of this program is to calculate the approximate roots of the Sine function on given intervals. The intervals are input by the user, and then the do loop continues until the condition (m becomes very close to 0 or equals 0) is met. The Attempt at a Solution...- mattmac.nuke
- Thread
- Bisection method Fortran Functions Method Roots
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help
-
M
Comp Sci FORTRAN: Problem with converting reals to integers
Homework Statement I'm trying to convert data that's entered as a real number into integer data to be used in a do loop. The problem is that it keeps telling me that the numbers I've just converted are not scalar integers... The Attempt at a Solution program interest IMPLICIT NONE...- mattmac.nuke
- Thread
- Fortran Integers
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
C
Fortran What Is the Best Fortran 77 IDE for Beginners?
Hi everybody, I am currently enrolled in a course in university based on scientific programming in fortran 77. The issue that I have is that I cannot find a decent IDE for fortran. I have tried multiple other IDE's such as eclipse, netbeans (both requiring additional add-ons) and other stand...- chris_0101
- Thread
- Fortran
- Replies: 8
- Forum: Programming and Computer Science
-
H
Fortran Can Fortran help with data file problem?
Hello guys. I want to save the numbers between 0 and 1 with 0.01 increasement to a dat file. I wrote a code for this using Fortran however, after a point I get 0.314999 instead of 0.315000. Can you help me to solve my problem? <code> REAL, DIMENSION(:), ALLOCATABLE :: Y REAL STEP, JEND...- hcelik
- Thread
- Data File Fortran
- Replies: 5
- Forum: Programming and Computer Science
-
S
Fortran Fortran: Read data from a line in a file
This is my problem: I would like to read data (saved in a text file) from a file. My data is written in a matrix format (1,000,000 rows x 3 columns). I want to read a data from a particular line, say row number 90,000. Since the number of rows is large, it will be very expensive if I have to...- sourish_SUNY
- Thread
- Data File Fortran Line
- Replies: 1
- Forum: Programming and Computer Science
-
M
Fortran Truncated Sin Series in FORTRAN
I am very much confused and frustrated at this point and would just like to understand what I'm doing wrong... This program is supposed to calculate a truncated value of sine using it's series expansion beginning at i = 1. At values under 20 degrees it compares almost exactly with the intrinsic...- mattmac.nuke
- Thread
- Fortran Series Sin Truncated
- Replies: 4
- Forum: Programming and Computer Science
-
1
Fortran Fortran 77 making an array but changing the increment value
Hi I have an array going from 0 to n (where n has been previously defined) but I want the array to be in steps of 5 rather than increasing each value by 1 eg 0,5,10,15,20,25...n how can I do this? Thanks- 1ytrewq
- Thread
- Array Fortran Value
- Replies: 10
- Forum: Programming and Computer Science
-
J
Fortran What could be causing a dynamic space array error in a Fortran 77 program?
Hi all I am trying to run an executable compiled from some Fortran files (not my own), which look like they are written in Fortran 77. One of these includes some dynamic space arrays, where the number of elements depends on an integer value passed to the subroutine, e.g. subroutine...- jf22901
- Thread
- Arrays Dynamic Fortran Space
- Replies: 5
- Forum: Programming and Computer Science
-
S
Understand Fortran Coding Do Loop: VBA Translation Help
Can some1 kindly help me understand the following code, I am trying to translate the following code in VBA: Thanks in advance FFLC = FLC ...i understand this part ANGLE=PI/6 !Suppose 30 Degrees ...i understand this part Do 21800 I=i,5 ...Don't understand this FLC=FFLC-COS(ANGLE)*NDIA...- shei7141
- Thread
- Coding Fortran Loop
- Replies: 29
- Forum: General Engineering
-
G
Fortran Fortran: Word input rather than number?
I would like to input a word in the fortran command line rather than a number. For example, if I wanted to exit a program with the word 'exit' how would that be done? Thanks for the help :D -Glenn- gmcke1
- Thread
- Fortran Input
- Replies: 2
- Forum: Programming and Computer Science
-
G
Fortran What is the Best Fortran Compiler for OSX?
I am making the switch to OSX from Linux and am unable to find any solid reference to the best way to get gfortran onto my mac without using MacPorts? What (other?) compilers are people using on OSX? I will have xcode installed as I typically develop in C and am looking to target the new Mac...- Gavin Harper
- Thread
- Compiler Fortran
- Replies: 12
- Forum: Programming and Computer Science
-
G
Fortran How do I use Control Characters in Fortran?
Hello, I am having trouble figuring out how to use Control Characters in Fortran. My professor skipped over that chapter back in my Computational Tools 1 course and I am trying to figure out how to use them. I am currently compiling my programs in the GNU Fortran compiler if that helps any. I...- gmcke1
- Thread
- Control Fortran
- Replies: 9
- Forum: Programming and Computer Science
-
G
Fortran Fortran updating number problem
Hello, I am wondering if there is a way to update a number without printing a bunch of stuff in the CMD window. For example this is what I don't want (below). I don't want a long list of totals.. Total = 1 Total = 2 Total = 3 Total = 4 This is what I do want. Total = # <=== I...- gmcke1
- Thread
- Fortran
- Replies: 7
- Forum: Programming and Computer Science
-
P
Fortran What Causes a Segmentation Fault in Fortran Programs?
Hi, I am new in fortran. I have this code in fortran 90, I get segmentation fault when I run my program, can you help me please, I am desperate! SUBROUTINE COUNTX(NX,ncov) IMPLICIT NONE INTEGER, INTENT(IN)::ncov INTEGER,DIMENSION(ncov),INTENT(INOUT)::NX(:) INTEGER...- pandroza
- Thread
- Fault Fortran
- Replies: 5
- Forum: Programming and Computer Science
-
Z
Fortran Increasing Size of FORTRAN Array without Reallocation
Is it possible to increase the size of an already allocated array in FORTRAN, without reallocation? e.g. if in start A(3)=[4, 5, 6] and now I want something like A(4)=[4, 5, 6, 7]. Currently I am using a temporary array to do this allocate(A(3)) A=(/4, 5, 6/) allocate(temp(3)) temp=A...- Zahur
- Thread
- Array Fortran Increasing
- Replies: 1
- Forum: Programming and Computer Science
-
X
Fortran [Fortran] How to do I/O jobs and computing jobs at the same time
It takes a lot of time for my Fortran program to do I/O jobs. Is there any way to do I/O jobs while at the same time it is doing computing jobs? To do I/O jobs and computing jobs at the same time would save a lot of time. Thanks.- xuphys
- Thread
- Computing Fortran Jobs Time
- Replies: 4
- Forum: Programming and Computer Science
-
H
Fortran Fortran function calling with wrong arguments
I have a program I am trying to understand. According to the function definition(vdot), the function acccepts arrays as inputs. But the function is called with a scalar input and it works just fine. Shouldnt it throw an error ? w and v are arrays of different sizes. ms is a scalar constant...- harish88
- Thread
- Fortran Function
- Replies: 4
- Forum: Programming and Computer Science
-
D
Fortran Implementing Generalized Laguerre Polynomials in Fortran
Hi! Im trying to do some rather easy QM-calculations in Fortran. To do that i need a routine that calculates the generalized Laguerre polynomials. I just did the simplest implementation of the equation: L^l_n(x)=\sum_{k=0}^n\frac{(n+l)!(-x^2)^k}{(n-k)!k!} I implemented this in the...- d4n1el
- Thread
- Fortran generalized Laguerre Polynomials
- Replies: 2
- Forum: Programming and Computer Science
-
1
Fortran Fortran 77 help making an empty array (or blank list if they exist in fortran)
I need to create an empty array but the length of the array is determined by the start and end numbers entered by the user for example if the range of numbers the user was interested in was 4-10 inclusive then i want the array to be of length 7 How to I go about doing this? Other...- 1ytrewq
- Thread
- Array Empty Fortran List
- Replies: 5
- Forum: Programming and Computer Science
-
B
Fortran Hi,Below is a fortran program to calculate the roots of an
Hi, Below is a fortran program to calculate the roots of an equation by Newton's method. I compile the program with the free compiler g95: g95 -c Newton.f95 then g95 Newton.f95 -o Newton.exe When I run the program Newton.exe I get the error can't assign value INTENT(IN)::x to...- Belgium 12
- Thread
- Fortran Program Roots
- Replies: 2
- Forum: Programming and Computer Science
-
J
Fortran Converting equations to Fortran code
Hi everyone I've been doing maths for quite a while now, but have never done any programming until recently. What I'm finding difficult is how you go from an initial value/boundary value problem on a bit of paper to a piece of code that will approximate the equation. I've done a bit of book...- jf22901
- Thread
- Code Fortran
- Replies: 1
- Forum: Programming and Computer Science
-
D
Fortran Fortran 90 - How to write all on one line
Hi I am trying to write the following into a file using visual studio 2005: REAL :: X =5 open(1, file = 'File.txt') write(1,*) X, X, X, X, X, X, X END Is there a way I can have the output on just one line? I need it to be from the variable X instead of just changing it to '5' The...- dvo
- Thread
- Fortran Line
- Replies: 4
- Forum: Programming and Computer Science
-
A
Comp Sci Fortran debugging help: faulty pointers?
Hi, I tried compiling my program in Fortran using the following commands: nagfor -g90 -C=all -C=undefined -g -gline -nan -u -mtrace=all test09b.f90 cell_functions.o -o test09b I ended up getting this error message: [Allocated item 15285 (size 17) = Z'FFFFFFFFB744A790'] Runtime Error...- ASGtFT
- Thread
- Debugging Fortran Pointers
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
H
Fortran Real vs. double precision in Fortran 90?
Hey, I'm trying to write my very first Fortran program. I'm a physics student and I don't know a lot about computer science and since I'm new to Fortran I'm still having problems with finding answers to my questions on my own. So..please bear with me. I'm doing heavy numerical calculations...- Heimisson
- Thread
- Fortran Precision
- Replies: 10
- Forum: Programming and Computer Science
-
A
Comp Sci Am I using interfaces in Fortran correctly?
I'm having problems compiling files with interfaces in Fortran. My compiler is NAG Fortran Compiler Release 5.2. I get this error: ------------------------------------- Error: subroutines.f90, line 2: USE TEST_MOD in program-unit MY_SUB imports symbol MY_SUB detected at...- ASGtFT
- Thread
- Fortran
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
M
Fortran How Can I Create a Variable Name with a Variable in Fortran?
Hi, How could I make a variable name with a variable in it in fortran? For example I want to use a loop to assign values to a11, a12, a13, a14, a15 and a21, a22, a23 I DO NOT WANT TO USE ARRAY FOR THIS Real X1,x2,x3,x4,x5 Do I=1,5 Xi(i=1 to5)=i Enddo ( How should I get...- miran.iran
- Thread
- Fortran Variable
- Replies: 4
- Forum: Programming and Computer Science
-
A
Fortran Fortran: Execution and Input in one command line
Hello all, I wanted to know if there was a way to read in numerical data on the same command line on which you execute a file. I know you can do that for i/o files like: test.exe < file1.in > file2.out But I wanted to know if there's some similar notation that can be used for floating...- Aerandir90
- Thread
- Fortran Input Line
- Replies: 1
- Forum: Programming and Computer Science
-
S
Fortran Fortran 95 Reading in Multi-Dimensional Arrays
Hi. I have a file like this: 1990 01 01 0000 27 16 1990 01 01 0100 25 15 1990 01 01 0200 24 16 1990 01 01 0300 24 16 1990 01 01 0400 22...- Sam032789
- Thread
- Arrays Fortran Reading
- Replies: 4
- Forum: Programming and Computer Science
-
A
Comp Sci What could be causing a segmentation fault in this Fortran function?
1. I have a segmentation fault when I try to run a program I have written in Fortran. The compiler I used is gfortran. What typically causes a segmentation fault, and how do I find where the problem is? I know I should use a debugger, but I don't know which debugger I should use, how to get it...- ASGtFT
- Thread
- Fault Fortran
- Replies: 15
- Forum: Engineering and Comp Sci Homework Help
-
L
Fortran Fortran 95 question about dimension error
error 542, J appears in the dimension of a variable,yet is not a dummy argument,a variable available through USE or CONTAINS association,a COMMON variable,a PARAMETER,or a PURE FUNCTION the same error about I i am using i,j in order to point the temperature in length and time T(i,j) it is a...- loukoumas
- Thread
- Dimension Error Fortran
- Replies: 1
- Forum: Programming and Computer Science
-
N
Fortran Differential equation in fortran
I need to do numerical computation by fourth order Runge Kutta Algorithm in fortran. But I stuck in programming because the differential equation contains imaginary part. Take for e.g. the set of diff.equation are x'=(i)y *exp(iwt) ;where i is imaginary no. and w is constant...- nirajaryal
- Thread
- Differential Differential equation Fortran
- Replies: 1
- Forum: Programming and Computer Science
-
O
Help Needed: #Game in Fortran - Newbie Asks for Assistance
Hello, I'm from Brazil, and at my university the teacher told me to do a hashtag(#) game, built in Fortran, but I started to use this a few time ago, so I don't know how to do that! I need to do that, the faster that I can and I hope a hand from you guys. Thank you so much, Danilo.- olinad
- Thread
- Assistance Fortran
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
C
Fortran How to Fix Fortran Formatting Issues in .pvd Files?
Hi all I am trying to use fortran to write a .pvd file, an example of what one line of such a file should look like is <DataSet timestep="1.00000E-07" part="0" file="Psb000001.vtu"/> however with the following code: write(90,2000) ttim,fname 2000 format('<DataSet...- cjm2176
- Thread
- Format Fortran
- Replies: 5
- Forum: Programming and Computer Science
-
Fortran Goto statement, mostly regarding Fortran
Hey guys, I've read that Borek (a member here) was told that the goto statement was "bad" during the 80's. I myself did some research on the Internet about that and it seems that: 1)Fortran used to have the goto statement up till Fortran 90. 2)It has been eradicated since Fortran 95. 3)In...- fluidistic
- Thread
- Fortran
- Replies: 18
- Forum: Programming and Computer Science
-
B
Fortran Fortran program can't find input file
My gfortran compiler gives me the following message when I try to open a file in order to read it:Fortran runtime error: No such file or directory logout The line in the program where this file is is written in this way: OPEN(UNIT = 7, FILE = 'GPROP.DAT', STATUS = 'OLD')...- bruhan
- Thread
- File Fortran Input Program
- Replies: 10
- Forum: Programming and Computer Science
-
H
Choosing a Degree: Physics/Astrophysics & Fortran
Which one is better for a physics/astrophysics major? I will be taking Fortran as well.- HeLiXe
- Thread
- Degree Fortran
- Replies: 24
- Forum: STEM Academic Advising
-
Fortran How to Avoid Leading Whitespace When Writing to a Text File in FORTRAN?
I am writing to a text file and a do not want any leading whitespace on each line. I have been trying the Write(*,'(a)') statement. This works just fine: Program MyTest Open(2,File = 'testFile.inp') Write(2,'(a)')'DIAG' Write(2,'(a)')'REAC C2H4F2 2.00000000000' Close(2) End However, the...- Saladsamurai
- Thread
- Fortran
- Replies: 2
- Forum: Programming and Computer Science
-
Fortran Fortran 90. Euler and Runge-Kutta's method
I've successfully (well I think so) made 2 different programs that can numerically solve an ODE using Euler and Runge-Kutta's methods. Here they are: program test implicit none real(8)::a,b,h,y_0,t write(*,*)"Enter the interval a,b, the value of the step-size h and the value of y_0"...- fluidistic
- Thread
- Euler Fortran Method
- Replies: 15
- Forum: Programming and Computer Science