- #1
ngendler
- 20
- 0
Hi! I'm trying to write a function that will integrate a user given function. I am having trouble with reading the function. Here is a section of my code:
function f(x)
implicit none
real :: x,f,p
print *,'Type a probability density function'
read *, p
!It doesn't like line 34...
f = p
end function f
It compiles fine, but then when I run the program and enter a function (say, x**2), it gives me the error:
Fortran runtime error: Bad real number in item 1 of list input
Help, please!
function f(x)
implicit none
real :: x,f,p
print *,'Type a probability density function'
read *, p
!It doesn't like line 34...
f = p
end function f
It compiles fine, but then when I run the program and enter a function (say, x**2), it gives me the error:
Fortran runtime error: Bad real number in item 1 of list input
Help, please!