Fortran Definition and 858 Threads
-
Comp Sci Help with Fortran: Calculate Cos(x) from Equation
Hello I was assigned the following problem:Make a Fortran program which will be able to read a degree[0-360] checking validity range(not type) and it will be able to calculate and print the cos(x) from the following equation: cos(x)=1-x^2/2! + x^4/4!-x^6/6!+x^8/8!-...,where x is in radiants.As a...- NicolasPan
- Thread
- Computer science Fortran Programming
- Replies: 7
- Forum: Engineering and Comp Sci Homework Help
-
S
Fortran Fortran 90: Display values in an array
I have a program that calculates the Fibonacci numbers from 1 to 100. The program runs fine. I am not sure how to take my output and display them in an ARRAY. Any ideas? I tired to pass the array variable through the equation, but my output was weird. I would have 1, 1, 3347...- Sue Parks
- Thread
- Array Fortran
- Replies: 13
- Forum: Programming and Computer Science
-
F
Fortran Can I Use the Lucy Subprogram in Starlink Project for Fortran Routines?
Hello! I'm trying to use a subprogram from the Starlink Project - Lucy in the library KAPPA - that is already installed and compiled. The idea is to be able to call it from my fortran routine. Something like this: PROGRAM ex INTEGER i REAL in(10),psf(10),out(10) DO i =1,10 in(i) = rand()...- faeriewhisper
- Thread
- Beginner Fortran
- Replies: 1
- Forum: Programming and Computer Science
-
C
Fortran Fortran Functions: How Are Variables Passed Around?
Hi all Just to start with I should highlight my general ineptitude with programming, so I apologize if my question is totally basic. I have a program written (by someone else) in fortran 77. Contained within it is a call to a function which acts on a number of variables. My curiosity is about...- cramie10
- Thread
- Fortran Fortran77 Function Functions
- Replies: 6
- Forum: Programming and Computer Science
-
D
Fortran What is the correct way to handle a potential divide by zero issue in FORTRAN?
Good day, I'm working with a FORTRAN program that has the line: EDEN=EDEN+(STVS**2)/(N(J)-1) I would like to check if N(J)-1 is equal to zero. If so make N(J)-1=1.0 The following doesn't work: IF ((N(J)-1).EQ.0.0) THEN N(J)-1=1.0 END IF I'm using gfortran and am getting...- debbieanne
- Thread
- Arithmetic Fortran
- Replies: 7
- Forum: Programming and Computer Science
-
Comp Sci How to break a number into separate digits in Fortran
Mod note: Fixed indents in code below !this program accepts a 5 digit integer !and calculates the harmonic and geometric means of it's digits !the program checks and denies numbers with length diffrent than 5 digits !The harmonic mean should be calculated only when !all of the number's digits...- NicolasPan
- Thread
- Break Computer programming Fortran Fortran95
- Replies: 6
- Forum: Engineering and Comp Sci Homework Help
-
Comp Sci Why Does My Fortran 95 Code for Calculating a Piecewise Function Fail?
Homework Statement . [/B]Hello all ! I am currently trying to make my fortran95 code run in vain.I would really appreciate it if someone could lend my a hand since I am a starter in programming.So the problem goes like that:Create a program capable of calculating the following function: f(x)=1/x...- NicolasPan
- Thread
- Code Fortran Programming
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help
-
D
Fortran What is causing the ARITHMETIC exception in my FORTRAN program?
Good day. My FORTRAN program is throwing an ARITHMETIC exception on this line of code: SAREA(2,ISN)=SAREA(2,ISN)/IND(13)/1000./6080.2*IND(12)/1000. When I check this using gdb and print the contents of the variable SAREA(2,ISN), the value is 1432. gdb error message: Program received signal...- debbieanne
- Thread
- Arithmetic Fortran
- Replies: 2
- Forum: Programming and Computer Science
-
H
Fortran Solving Fortran Runtime Error 112 - Mach Number Calculation
Hi, I try to write program to calculating mach number, with using bisection method. When I run program, fortran write to me an error in line 40. Can you help? I tried to calculating function by using wolfram sucesfully but I need to run it on fortran, An equation is 1.7795 - (0.334898 (1 + 0.2...- Hejmore
- Thread
- Complex Error Fortran Runtime
- Replies: 3
- Forum: Programming and Computer Science
-
Fortran Reading Real Numbers in Fortran 95: Tips and Tricks
Hi Guys I need some help with reading a row of real numbers on a text file using fortran. On my text file the row is: 74.05 112.91 154.03 193.90 236 276.71 61.12. I would like to point out that these numbers are chemical parameters that can vary but they usually have up to two digits in the...- Sirluke
- Thread
- fortran
- Replies: 2
- Forum: Programming and Computer Science
-
S
Fortran Fortran (90) runtime error: End of file
I am using fortran 90 to find the prime numbers (1-100). When I print to the console, everything works. If I try to write to an text file (.out). This is from my command line: Sues-MacBook-Air:FORTRAN sueparks$ gfortran PRIME.f90 Sues-MacBook-Air:FORTRAN sueparks$ ./MY_PRIME.out PROGRAM PRIME...- Sue Parks
- Thread
- Error File Fortran Runtime
- Replies: 19
- Forum: Programming and Computer Science
-
Fortran FORTRAN Code for Control Volume Finite Element Method Fluid Flow Problems
where i can found an example A FORTRAN control volume finite element method code FOR FLUID FLOW PROBLEMS thanks for help- mariem.makh
- Thread
- Code Control Control volume Element Finite finite element Finite element method Flow Fluid Fluid flow Fortran Method Volume
- Replies: 2
- Forum: Programming and Computer Science
-
Fortran Understanding IERR (FORTRAN): Error Detection & More
DO READ(11,'(a)',iostat=IERR)line IF ((line(1:2)/='--').and.(line/=' '))THEN READ(line,*,iostat=IERR) posinumber EXIT ENDIF ENDDO What is IERR? Is it related to error? I couldn't find any good answer researching online. Thanks in advance- ydonna1990
- Thread
- Fortran
- Replies: 9
- Forum: Programming and Computer Science
-
Fortran Fortran Beginner: What is iostat=stat & buf Argument?
Hello. I am a beginner in the Fortran language and I want to know what isotat=stat means. also what is exactly the "buf argument"?- ydonna1990
- Thread
- Fortran
- Replies: 6
- Forum: Programming and Computer Science
-
A
Fortran Add Library to Fortran - Learn How to Launch Free Libraries
Hi I'm completely new to fortran I've downloaded FGSL and I don't know how to run it and also I don't How should I launch the free libraries in fortran,can give me an outline?- astroastro
- Thread
- Fortran
- Replies: 7
- Forum: Programming and Computer Science
-
Fortran Help with Fortran 77 Programming for Two-Dimensional Axisymmetric Flow Study
[mentor edit added code tags to improve listing] Hey everyone! I am new in this forum. This thread I need help with my thesis. I'm doing a study of two-dimensional axisymmetric flow in a Kaplan turbine. So I am using a program called Force2.0 for programming in Fortran 77 but have several...- ogos
- Thread
- Fortran
- Replies: 6
- Forum: Programming and Computer Science
-
D
Fortran Why Does This Fortran Code Result in an Infinite Loop?
I've inherited the code below. It's giving an infinite loop but I can't find what's causing it. This is code originally on OpenVMS written now for AIX. Can you help? SUBROUTINE MREAD3(N_VESSEL,N_TRIP,N_ICNAF,N_SPECIES,N_DELSTR, + N_SETDEL,N_SELSTR,VESSELS_TO_BE_SELECTED, +...- debbieanne
- Thread
- Fortran Infinite Loop
- Replies: 10
- Forum: Programming and Computer Science
-
G
Fortran Solving Function Problem in Code Exchange
Hello I am trying to exchange following code into two functions which I will need to use in further programs. The code is as follows: do i=0,k do j=0,k if (i/=j) then lj(i)=lj(i)*((xx-x(i))/(x(j)-x(i))) end if enddo l(i)=l(i)+y(i)*lj(i) write(2,*) x(i),y(i),l(i) enddo I would...- Galizius
- Thread
- Fortran Fortran90 Function Gcc
- Replies: 8
- Forum: Programming and Computer Science
-
Fortran Is FORTRAN still relevant in modern programming?
This summer I was a research student and my advisor used fortran (case 1). Two of my professors at my college use fortran (case 2). My friend at BU who is just starting his phd says fortran is huge and I should probably get a grasp on it (case 3). On the opposite side of the spectrum, my...- Tone L
- Thread
- Fortran
- Replies: 75
- Forum: Programming and Computer Science
-
Fortran [FORTRAN] FFT of delta function, issue w/ MKL & Intel compiler
I am trying to program something using a backwards FFT, and am attempting to feed it a delta function as a test condition since this result is known. However, my results are nonsense compared to what is expected. It should be the case that if we have...- avikarto
- Thread
- Compiler Delta Delta function Fft Fortran Function
- Replies: 8
- Forum: Programming and Computer Science
-
Z
Fortran Fortran Linked List Program: Understand Logic & Assembly
CAn anyone explain how this program in Fortran on linked lists is supposed to work. Actually it does work but I can not for the life of me follow the logic behind it or what is going on. I did some Fortran programming in F77 but now with this new 'pointer' type it is about impossible to...- zmth
- Thread
- Fortran List
- Replies: 20
- Forum: Programming and Computer Science
-
K
Fortran [Fortran] Help Reading Complex 2D data
Dear All, Please, I am trying to read in a data shown in array form but no luck. The data is 10 by 10 with each 10 by 10 depicted by a local array, for e.g. 0 0 0 0 0 0. A sample of the code I tried using is as shown below and the data is as attached. Please, any help or suggestion will be...- komp
- Thread
- 2d Complex Data Fortran Reading
- Replies: 2
- Forum: Programming and Computer Science
-
Fortran How Do You Implement MKL's FFT Functions for Multidimensional Data in Fortran?
This is my first time attempting to use the MKL's FFT functions, and I'm having trouble understanding them. The available examples (https://software.intel.com/en-us/node/522290) provide little insight into the reasons for doing things, and looking into the commands themselves doesn't provide...- avikarto
- Thread
- Fft Fortran Fourier transform
- Replies: 2
- Forum: Programming and Computer Science
-
G
Fortran [Fortran] How to loss different random number
Hello I am wondering how can I make sure that every number which I am losing will be different? I am using the following code: program lottery implicit none real(kind=4) :: x real(kind=8) :: y integer :: i, seed= 64256 call srand(seed) do i=1,6 x=rand() ! to make the lossing interval...- Galizius
- Thread
- Fortran Fortran90 Gcc Loss Random Random number
- Replies: 2
- Forum: Programming and Computer Science
-
S
Fortran Optimizing Makefile for LHS Code in Fortran
I've always made my own makefiles and it hasn't been an issue because it's usually a small number of subroutines. However, I am working on modernizing and optimizing a Latin Hypercube sampling code in Fortran which has close to 80 functions/subroutines that I am splitting up into different files...- swartzism
- Thread
- Code Fortran
- Replies: 4
- Forum: Programming and Computer Science
-
K
Fortran Fortran : generating different output files in a loop
implicit none character*4 head1,head2,ext character*10 fn1,fn2 integer i,kev head1='jack' head2='jill' ext='.dat' do i=1, 50000 kev=int((i-1)/50)+1000 if(mod(i,50).eq.0) then write(fn1,'(a,i4,a)') head1,kev,ext write(3,*) fn1 write(fn2,'(a,i4,a)') head2,kev,ext...- Kyong
- Thread
- files Format Fortran Loop Output
- Replies: 3
- Forum: Programming and Computer Science
-
Fortran Mesh 2d of a complex geometry with FORTRAN
I neet to do a structured triangular mesh 2D of a complex geometry with FORTRAN Can someone help me!- mariem.makh
- Thread
- 2d Complex Fortran Geometry Mesh
- Replies: 7
- Forum: Programming and Computer Science
-
G
Fortran [Fortran] Filon's method Fourier Transform
I was told to do a Fourier transform of function by using a Filon's method. I have found the code but I don't know how to include any function to the subroutine. I would be grateful for any example of how to use this code. SUBROUTINE FILONC ( DT, DOM, NMAX, C, CHAT ) C...- Galizius
- Thread
- Fortran Fortran77 Fortran90 Fourier Fourier transform Gcc Gfortran Method Transform
- Replies: 6
- Forum: Programming and Computer Science
-
G
Fortran Why Isn't My Fortran Bisection Code Finding the Root?
Hello, I was told to find the root of an integrand with using the bisection method. I am kind of new to such a stuff so I am kind of confused why I am not getting the expected result. Here is my bisection code: tl=3.0 tup=4.0 tempred=0.0 s=-0.234726128709272990292 do while (abs(total_calka)...- Galizius
- Thread
- Formula Fortran Fortran90 Gcc
- Replies: 6
- Forum: Programming and Computer Science
-
Comp Sci How to Implement Laplace Expansion in Fortran for Matrix Determinants?
Hi, I'm dealing with an exam problem (which i have 8 days to solve, with no outside help limitations), which is to write a fortran95 program that solves linear systems. the first part asks to find the determinant of a NxN matrix with the laplace expansion, implementing it as a recursive...- kinbeat
- Thread
- Expansion Fortran Laplace
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
Fortran Linking fortran libraries with g95 in Windows Powershell
I am having some trouble getting all of my libraries included in my g95 call at the command line (using Windows Powershell). The confusion stems from the purpose and use of the "g95_library_path" variable native to the compiler, and how this enters with the "-L/..." option on the command line...- avikarto
- Thread
- Fortran Libraries Link Windows
- Replies: 12
- Forum: Programming and Computer Science
-
Fortran Solving Large/Infinite Results w/Yee 1D FDTD Code
Hello to all! I have written this 1D FDTD code but the results I take are very large and after some timestep they get to infinite/NaN... I really don't know what's wrong. The expressions I have used are the exact given solution for the Maxwell equations. Thank you for your help. program yee...- angelos_physik
- Thread
- Code Fdtd Fortran Program Programming
- Replies: 2
- Forum: Programming and Computer Science
-
Fortran [Fortran] Function implicit type error
I am having an issue with the declared type of the return value of a function not being recognized in its call. This function clearly has its return value declared as complex*16: !----------4-vector dot product under Minkowski metric---------- function dot4(v1,v2) result(res) implicit none...- avikarto
- Thread
- Error Fortran Fortran95 Function Implicit Type
- Replies: 9
- Forum: Programming and Computer Science
-
Fortran [Fortran] Integer overflow for a real number?
I am trying to define a real number as follows: real*8 r r=2.5*10**20 This results in the following warning: r=2.5*10**20 1 Warning(131): Integer overflow at 1 First off, I am not even declaring it as an integer, yet the warning is named as such. After searching around for...- avikarto
- Thread
- Fortran Fortran95 Integer
- Replies: 3
- Forum: Programming and Computer Science
-
Fortran [Fortran] Quick question about complex exponentials
Hey, so I just have a quick question. I am trying to set a complex variable (in an array) as ##e^{i\alpha_1}## and the line I used in my code looks like this: hmajphasemix(2,2)=(cos(alpha1),sin(alpha1)) But the compiler is telling me that it "expects a right parenthesis" at this line. I'm...- Matterwave
- Thread
- Complex Fortran
- Replies: 12
- Forum: Programming and Computer Science
-
Investigating a Parabolic PDE algorithm
Homework Statement Hi - I'm on the last chapter of this book and am a bit stuck. I am given a very basic fortran program (code attached in the zip file) and asked to 'investigate its accuracy and stability, for various values of Δt and lattice spacings'. The program is an implementation of the...- ognik
- Thread
- Algorithm Discretization Elliptic pde Fortran Pde Recursion
- Replies: 6
- Forum: Advanced Physics Homework Help
-
Fortran I to solve ODE with rk4 y" + 2y =0 in fortran
How can i solve y" + 2y =0 with RK4 and their program fortran please I néed your helpe- mlouky
- Thread
- Fortran Ode Rk4
- Replies: 7
- Forum: Programming and Computer Science
-
K
Fortran Please, Help with Data Reading in Fortran
I have been trying to read in a data using Fortran but for some reasons, it doesn't read the data correctly. Please, any help will be appreciated. To read the data, I used the following (Note, for the attached data, Nm=1, nw-nu=5, nw=10). The array data(i,j,m,n) is declared as...- komp
- Thread
- Data Fortran Reading
- Replies: 6
- Forum: Programming and Computer Science
-
Fortran Fortran 90 Program Factorial: Fixing Incorrect Output
program factorial implicit none integer::fact,i,n print*,'enter the value of n' read*,n fact=1 do i=1,n fact=fact*i end do print*,'factorial is ',fact end program when input n largest number then answer is incorrect. how to solve- Md. Abde Mannaf
- Thread
- Factorial Factorials Fortran Fortran90 Programming
- Replies: 5
- Forum: Programming and Computer Science
-
Fortran Combination is not working correctly -- fortran 90
!subprogram for combination !Author:: mannaf function fact(n) implicit none integer ::fact,n,i fact=1 do i=1,n fact=fact*i end do return end program comb implicit none integer ::fact,n,r,combination print*,'enter the value of nCr' read*,n,r...- Md. Abde Mannaf
- Thread
- Combination Fortran Fortran90
- Replies: 6
- Forum: Programming and Computer Science
-
F
Fortran Fortran runtime error: Sequential READ or WRITE not allowed
Dear Forum users, I am running a program called NMTO package for constructing Wannier functions for a material. It uses a code plotnmto.f90 to calculate wannier isosurfaces within the mesh defined by me. I compiled the code in gfortran. After defining the mesh when I ran the program for...- fort_phys
- Thread
- Error Fortran Runtime
- Replies: 2
- Forum: Programming and Computer Science
-
Fortran Inputting a Complex Number in Fortran 90 for DeMoivre's Theorem
i have a a little problem in fortan90 i just wanted to know how to input a complex number ( input real and img part alone ) all i want to do is to make a simple program about DeMoivres Theorem i have been around in google all i know how to declare a argument as complex complex a then how to...- waver.
- Thread
- Complex Complex number Fortran
- Replies: 3
- Forum: Programming and Computer Science
-
A
Fortran Fortran 77: Recording the output
Hi, I am having a bit of trouble trying to record the output from my code and any help is highly appreciated. Attached is the code that needs to be looked into (changed extension to .txt from .f as PF wouldn't allow it) and a screenshot of output that I am trying to record. What I am trying...- adishpatel
- Thread
- Fortran Output
- Replies: 29
- Forum: Programming and Computer Science
-
M
Fortran Generating programs in fortran to .dat files
I have a small problem to insert a code in fortran to generate me a graph in .dat only need to Fortran insert a command that I may run in the program of .dat- Monserrat
- Thread
- files Fortran Programs
- Replies: 3
- Forum: Programming and Computer Science
-
O
Fortran I can't find a small bug in this Fortran code
So I'm writing a short subroutine to compute a QR factorization of an (mxn) matrix using the Householder method. To test this, I'm computing the factorization of the matrix 12 -51 4...- O S
- Thread
- Bug Code Fortran
- Replies: 2
- Forum: Programming and Computer Science
-
L
Fortran Can complex numbers be used in Fortran array constructors?
Hi, so I need to write a fortran code with 2, 2x2 matrices. These matrices are in the form of B=(1 exp(i)(theta) 0 0) and D=(0 0 exp(i)(theta) 1) where i is sqrt of -1 and theta is an angle between 0 and 2pi. I've expanded the exponential so it reads cos(theta)+isin(theta) and let theta=pi/2...- Lukejambo
- Thread
- Complex Complex exponential Exponential Fortran Fortran90 Fortran95
- Replies: 5
- Forum: Programming and Computer Science
-
Fortran [FORTRAN] How did I screw up my code?
Hi guys, there's a bug in my code which I've been trying to get rid of for the last 2 weeks. I'm completely out of ideas now on what it is so I have to turn to you guys for help. The code is here: module helectron use params use parallel !* electron density parameters integer ...- Matterwave
- Thread
- Code Fortran Screw
- Replies: 54
- Forum: Programming and Computer Science
-
H
Fortran Fortran - passing unknown array to subroutine
Im trying to pass an unknown size of array to the subroutine. Then I will define the size of array in subroutine and pass it back to main program. I tried to use interface but the complier said invalid memory reference or Explicit interface required for ' ' at (1): allocatable argument . Any...- hobmarcus
- Thread
- Array Fortran Subroutine
- Replies: 5
- Forum: Programming and Computer Science
-
H
Fortran How to Merge and Sort Two Fortran Arrays?
I have 2 set of data (from different files) and I allocate each set of data to array in my main program. But now I want to merge those 2 array and sort them in ascending orders in my sub program. What should I do? I know how to sort array in ascending orders, but i don't know how to merge those...- hobmarcus
- Thread
- Arrays Fortran
- Replies: 5
- Forum: Programming and Computer Science
-
J
Fortran Troubleshooting Fortran 90 Errors: Rank Mismatch in Arguments | RFK.f90
Hey guys, I'm pretty new and desperate. I been trying to compile this program for a while and keep jumping from error to error. Currently I have the following error: Error: Rank mismatch in argument 't' at (1) (scalar and rank-1) I have checked that my arrays are correctly. I have checked that...- Jonathan1234
- Thread
- Arrays Coding Error Errors Fortran
- Replies: 11
- Forum: Programming and Computer Science