----> Emergency: Need Help with fortran prog
Author Message ----> Emergency: Need Help with fortran prog

Hello everyone,
Could some fortran programming genius please help me out with a simple
program. I am completely new to fortran and I need to have an equation
programmed before the end of this week. Heres the problem. I have an
equation Y which depends on X. I need a prog that will loop thru values of
x from say -1000 to 1000 and write out the corresponding values of Y (and
x) to a file so I can plot the data. In the loop where the prog evalates Y
however it needs to call a subroutine called "erf(x)" which is fed the x
value and this subroutine (alre ady made) spits out the value which is also
used in the y=f(x) equation. The prog needs to keep going thru the loop
until it reaches x=1000 upon which it should stop. Could someone please
please help me with the code as I am completely lost. TIA. Salman Saeed.

Tue, 30 Mar 1999 03:00:00 GMT  ----> Emergency: Need Help with fortran prog

Quote:

> Hello everyone,
>    Could some fortran programming genius please help me out with a simple
> program. I am completely new to fortran and I need to have an equation
> programmed before the end of this week. Heres the problem. I have an
> equation Y which depends on X. I need a prog that will loop thru values of
> x from say -1000 to 1000 and write out the corresponding values of Y (and
> x) to a file so I can plot the data. In the loop where the prog evalates Y
> however it needs to call a subroutine called "erf(x)" which is fed the x
> value and this subroutine (alre ady made) spits out the value which is also
> used in the y=f(x) equation. The prog needs to keep going thru the loop
> until it reaches x=1000 upon which it should stop. Could someone please
> please help me with the code as I am completely lost. TIA. Salman Saeed.

Looks easy.
I assume the following;
"erf "is a real function
you already have the function "F", which is real
you are kidding about needing this by the end of the week
Any assumption except the last can be changed easily

integer x
real y, f
real e, erf

open (1, file='output.dat', status='new')
do x = -1000, +1000
e = erf (y)
y = f (x,e)
write (1,900) y, x
end do
900     format (f10.2, i5)
end

--
Dominic Olivastro                    CHI Research, Inc

Tue, 30 Mar 1999 03:00:00 GMT  ----> Emergency: Need Help with fortran prog

integer x
real y, f
real e, erf

open (1, file='output.dat', status='new')
do x = -1000, +1000
e = erf (y)
y = f (x,e)
write (1,900) y, x
end do
900     format (f10.2, i5)
end

OK but I think it should be erf(x) - otherwise
you are in trouble because y has not been defined
for the current x value???

- Loren Meissner

Tue, 30 Mar 1999 03:00:00 GMT

 Page 1 of 1 [ 3 post ]

Relevant Pages