1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

FORTRAN Help: Concept of User Defined Functions

  1. Oct 12, 2011 #1
    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.
     
  2. jcsd
  3. Oct 12, 2011 #2

    SteamKing

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    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.
     
  4. Oct 12, 2011 #3
    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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: FORTRAN Help: Concept of User Defined Functions
Loading...