Calling a user-defined function at multiple points in FORTRAN

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
mattmac.nuke
Messages
22
Reaction score
0
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 different values... more specifically, I have a function, f1 (x), where it takes a value x and makes some computations with it, but I need that same function to be called on to evaluate 'a' (the lower bound) and 'b' (the upper bound) and the 'm' (the midpoint), but I'm not sure how to do that... my textbook doesn't cover it, and my professor didn't provide any useful direction. I haven't conceptualized some of this material well enough to draw logical solutions.
 
Physics news on Phys.org
In the calling program or subroutine, if you wanted to evaluate f1(x) at a particular value, you would write something like

Y1 = F1 (A)

where the function F1 (x) is evaluated at x = A and the result assigned to the variable Y1.
 
Thank you! I figured out where the error was, in passing the variables, but after reading that I was reaffirmed on what I thought the program should be doing.