• Support PF! Buy your school textbooks, materials and every day products Here!

FORTRAN Help: Concept of User Defined Functions

  • Comp Sci
  • Thread starter mattmac.nuke
  • Start date
  • #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.
 

Answers and Replies

  • #2
SteamKing
Staff Emeritus
Science Advisor
Homework Helper
12,796
1,666
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.
 
  • #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.
 

Related Threads on FORTRAN Help: Concept of User Defined Functions

  • Last Post
Replies
5
Views
2K
Replies
11
Views
1K
  • Last Post
Replies
8
Views
6K
Replies
25
Views
4K
  • Last Post
Replies
3
Views
2K
Replies
3
Views
3K
  • Last Post
Replies
20
Views
2K
Replies
1
Views
2K
Replies
1
Views
2K
Top