Hi,
I'm writing a program in FORTRAN (my first) to find E and B fields due to a spinning sphere of charge. Anyways when printing out E and B field magnitudes I am getting numbers like this: 0.1773372103+245
What the heck does this mean!? Is it like 0.1773372103 x 10^245?
Thanks for any...
Hello,
Examining the following DO statements and determining how many times each loop will be executed. Assume that all loop index variables are integers.
(a) DO irange = -32768, 32767
(b) DO j = 100, 1, -10
(c) DO count = 2, 3, 4
(d) DO index = -4, -7
(e) DO i = -10, 10, 10
The loop will...
I am not able to get what's wrong in below.
IF ( temp < 97.5 ) THEN
WRITE (*, *) NTemperature below normalN
ELSE IF ( temp > 97.5) THEN
WRITE (*, *) NTemperature normalN
ELSE IF ( temp > 99.5) THEN
WRITE (*, *) NTemperature slightly highN
ELSE IF ( temp > 103.0) THEN
WRITE (*, *)...
I am learning Fortran and I am able to write code for 3 number means. Now For computing it for set of numbers is not getting in my mind. I am not able to do it.
Writing a single Fortran program that calculates the arithmetic mean, rms (root-mean-square) average, geometric mean, and harmonic...
Trying to write a single Fortran program that calculates the arithmetic mean, rms (root-mean-square) average, geometric mean, and harmonic mean for a set of numbers (for example - 4 4 4 4 4).
I don't know if I am doing the write way. Please guide me.
PROGRAM ComputingMeans
IMPLICIT...
Hello everyone. Today I learned how to write a program which calculates and prints integer squares roots from 1 to 1000. Here is what I wrote:
program example
real::i
do i=1,1000
if(sqrt(i)**2==i) then
print*,i
end if
end do
end program example
After compling this, 25, 49 etcs can't...
Hi
I have a problem with reading data in fortran 90. my programs try to read a txt file that only contains one number in it but if the txt file is empty it stops. i want to make it continue what should i do?
How would I modify the program so it doesn't generate an output for integers that are multiples of 5? (e.g. if range was 1-20, then no lines would be printed for 5, 10, 15, 20.)
program squares
implicit none
integer*2 start, finish, i
...
Hello, I received some very old cold, and I don't even know for which FORTRAN standard it was originally written, only that it has existed since at least 1993. I'm trying to compile it in gfortran, and I get the following error:
'Error: Expected a right parenthesis in expression at (1)'...
Hi all,
I encounted a write file problem for Fortran 90. I appreciate it a lot if you can help me.
I open a file at the beginning of the program. Then everytime I rewind the unit number and write one new line to the first line of the file (the previous data on the first line is replaced)...
Hi,
I'm trying to create a normal distribution with mean 0.5 and variance 0.05. I tried it initially with MATLAB, for which I used
newdist=0.5+(randn(1,1000)*sqrt(0.05));
Could you please help me in doing this in FORTRAN 90? Would generating a sequence using RANDOM_NUMBER and using the...
Fortran, File Read Error[Resolved itself, fixed]
Basically I'm writing a simple fortran program to read in a data file formatted as shown below and then calculate the line of best fit for the given data points.
N
x1 y2
x2 y2
. .
. .
. .
xn yn
Where N is the...
Hi there,
I am trying to read a universal file (*.unv) in fortran. The file is type 58b (mixed ascii and binary format). I can read the ascii part fine but am having trouble reading the binary part. Does anyone know of anywhere I can access some source code to read this correctly. I suspect...
Can someone give him a head start re: the following Q:
We can make the program test itself by having it plug in the found root and evaluate the LHS (it should be zero). Complete the program by having it evaluate the LHS at x = root1.
! This program finds the roots of equations of the 2nd...
I have prepared the coordinate of a pipe layout in excel.
Now I have to input them into a FORTRAN code.
Although I know it is possible to generate these coordinates inside FORTRAN, but working with Excel is much easier for me. Making these coordinate data inside FORTRAN is a very hard work and...
I Just finished installing gcc and SciTE .
when i try to run a basic code ..the following error is returned(refer attached file)
many thanks
PS:I have saved fortarn.properties file in the installation folder of scyntilla
Hi,
I am a new Fortran User.
I have a problem when I run my code (not errors during building), in fact the code is stopped in the last line and this message appears "Error 112, Reference to undefined variable, array elements or function result"
...
write(number,100)k1
open...
I am trying to program Simpson's Rule in Fortran
I=(1/3)*h*(y0 + 4*y1 + 2*y2 + 4*y3 + 2*y4 + ... 2*yn-2 + 4*yn-1 + yn)
n=100 (number of strips)
I have generated the y values but I don't know how to get Fortran to follow the pattern in the brackets after h to add up the y values.
Any...
Homework Statement
I get the follwing error message in the FORTRAN program I am trying to code.
P(i)=(1/(sigma*sqrt(2*Pi)))*e^(-(x-xbar)^2/(2*sigma^2))
----------------------------1
Error: Invalid character in name at (1)
I assume this means there is something it doesn't like about...
Anyone can help me getting a source deck of Lanczos in f77 for large sparse Hermitian matrices? I need one that is user friendly. There is one written by Jane Cullum and Ralph Willowghbi that I find too difficult to use. Or is there some library that has it and can be linked?
Thanks in advance
I have noticed an issue I must resolve before writing a GUI for my FORTRAN program in Linux.
If I move into the directory (cmd line) and type ./myprogram it works fine. It reads the input file from that directory and creates an output file.
If I run it from the file manager it gives me 2...
I am going to be simulating damped driven oscillators for my project and I was wondering if someone could give me a definitive answer on the matter. I know MATLAB is more of a 'tool' than a language so I'm thinking the maths behind damped driven oscillators might be easier to implement into...
I wrote a simple FORTRAN program to show my read problem. This works fine in windows. On the Linux machine I always get this eof error when I open a file and read. This means that every program I have written doesn't work :) The error is line 12 EOF. What is the problem? (I am using GFORTRAN in...
For few days I am thinking to write a code in FORTRAN to solve the sudoku puzzle.
At first it seams simple but I have no luck writing this code.
I am wondering if there is any written code to solve this puzzle.
I hope Sudoku puzzle is known for members here.
en.wikipedia.org/wiki/Sudoku
In an old (1974) FORTRAN program, I have following two lines
IF(FX.GT.COE(KOP,1)) GOTO 1
F=X*COK(KOP,1)
I can't understand the meaning of COE and COK commands.
Are they standard FORTRAN commands?
PS) If you could kindly guide me to a site whee I can find list of fortran commands, I...
Hey
I have a text file with 2 blocks of Data
Example
Numbers 1:
1,2,3,4,5,6
7,8,9,10,11
...
Numbers 2:
92,93,94,95,96
97,98,99,100,101
...
How would i use FORTRAN to read the text file and output in a column and row format..
Example
1 92
2...
Hi there,
As the title suggests, I am looking to start learning my first programming language. I am a mature student (24) who has recently returned to school to pursue physics. A friend of mine who does physics suggested that I learn Fortran (90/95) as my first language. I am looking online...
Guys. I really need help. I have been working in this little problem for hours. I had a problem in array reading when I opened more than 1 files, it seems like an array with different names mixed each other. Here is my code
integer, parameter::size=11
real, dimension(101) :: cldata...
I've recently stated using Fortran (I downloaded 'Silverfrost') and am hitting a block. I've learned the basics, but I can't find any more tutorials.
My professor (who I plan on doing research for) suggests that I get familiar with Fortran, especially integration of functions. I do not have...
Hello,
I'm having a bit of trouble converting an 8 bit stream into a 10 bit one.
First i create intvalbin8, a Nx8 zero/one array where N is the byte length of the input data:
(6198 is the header offset factor)
j=1
do while (intvalout(i).gt.0)...
Homework Statement
I have a project about pi. We are wanted to calculate pi in Fortran 90/95,without use intrinsic functions. For example, we must think like a computer.
Homework Equations
We must use formula of sin(x) and cos(x) for find 'pi'. When Sin(x)=cos(x) (and error is 10**-4)...
Fortran has been around since the 1950s and obviously there is a large amount of Fortran code lying around. However, I'm curious if C or another programming language will someday supplant Fortran. Perhaps scientists will gravitate towards high-level math packages like Matlab and Maple, and...
I have the code.
program star
implicit none
real (kind=8) :: x
integer :: i
dt=0.001
pi=4*(atan1.0)
do i=1, Nsteps
t = n*dt
!calculate acceleration
ax=
ay=...
!calculate values at next step
vy=vy+ay*dt
vx=vx+ax*dt
x=x+vx*dt
y=y+vy*dt
end do...
I can not read character "0A" in a bmp file with "Compaq Visual Fortran 6.6C"
Hi,
How to read character "0A" in a bmp file with "Compaq Visual Fortran 6.6C"
Here's an excerpt from bmp file:
42 4D 16 02 00 00 00 00 00 00 36 00 00 00 28 00
00 00 10 00 00 00 0A 00 00 00 01 00 18 00 00 00...
Bisection method for the equation x3−2x−2 = 0 which has a single root
between x=−4 and x = 2.
here's the code I have
program bisection2
implicit none
real :: fxa, xnew, xu, xl, fxb, fnew
xu=4
xl=2
1 xnew=(xu+xl)/2
fxa=(xnew**3-(2*xnew)-2)
fxb=(xl**3-(2*xl)-2)...
Homework Statement
Dear all, please help. I have tried this question and came up with strange numbers, my fortran is definitely not correct. Please help!
When the effect of the air resistance is taken into account, the equation of motion for a particle of mass
m falling vertically in a...
ok,
Been programing for awhile, come from a visual basic background.
We have a new server with newer compilers. Compiling with -f77 switch.
Seems the old software allowed passing of integers, and strings in a call statement. New compilers seems to be inconsistent in passing the...
Homework Statement
Create a program that computes for the value of sine function. Then compute for its
integral from 0 to pi with N intervals, where N=4,8,16,256 and 1024 and compare the
result for the trapezoid and simpson method.
Homework Equations
Trapezoid rule of Integration...
Dear All,
I would like to know what type of solver packages can be used for solving the Large scale eigen problems, implemented in the Fortran language. Especially the simultaneous, subspace, ritz vectors, Lanczos etc.. methods is a must in the package. Does any of you aware of such...
Have data that is coming from Matlab and want to read it into Fortran. Simple example of what I have:
PROGRAM file_read
IMPLICIT NONE
REAL, ALLOCATABLE :: read_matrix(:,:)
INTEGER :: i,j
OPEN(1,FILE = 'data_wanted.prn', ACTION = 'READ', STATUS = 'OLD')
do i = 1,50
do j = 1,25
READ(1,*)...
Hi;
I am trying to run a program which includes;
call AB
write(6,*) 'finished AB'
c---------
call ABp(Vup,gup)
call ABp(Vdn,gdn)
write(6,*) 'finished ABp'...
Hi.
I'm new here and wasn't sure which forum to post this request on, but this one seemed a good start.
I am developing a talk/seminar on dealing with legacy code. In the late 1990s I was working for a large corporation in a software capacity and one day idly wondered what the source code...
Hello forum,
I was wondering if there is a way to declare/define arrays depending on some previously defined variable.
example:
if a=2, then declare/define 2 arrays
if a=3, then declare/define 3 arrays
If doable, how does one assign names to these arrays?
I recently asked my professor if he had any research opportunities in the following semesters and he told me that I should download and play around with 'Fortran G77 Compiler' and get back to him.
So, I've looked into it but didn't make much progress.First off, I'm confused with which program...
So I have been trying to write a code which calls from REFPROP subroutines to get thermodynamic properties and then uses these to do some other calculations. I am facing two issues:
1) The REFPROP subroutines require IMPLICIT definitions so I can't say IMPLICIT none at the top, and this may...
Ok so basically I am trying to write code that can call from a fluid properties subroutine similar to refprop but it is called FLUID. I need to call the subroutine with temperature and pressure, and have it come back with density, compressibility, and etc. It should be able to do this, however...
Fortran has this type of "If"?
Hi,
I was reading a code from a thesis, obviously the quality of the scan was not good and I reached to this point in the image below, that the programmer uses "If" statements:
http://i48.tinypic.com/x5z7n.jpg
I am not sure if he uses a "=" sign or a"-"...
Hi, I have an issue where I am squaring a very small complex number 1e-20 (FALFA2) which seems to make the value zero (both the real and imag part) and then dividing by it, the problem line is (all the numbers are complex):
GALFA = ( FBETA * FAA / FALFA2 ) - ( FAB / FALFA )...
Hi friends . is there anybody here who can give me a fortran code for describing fcc lattice and give us the neighbours of each site and also which pay attention to periodic condition ?
thank you for your help my friends.