Is there any command in Fortran that is similar to eval in MATLAB?

  • Comp Sci
  • Thread starter phanlada
  • Start date
  • #1
2
0
Hello,

I am trying to write a Fortran subroutine to solve non-linear equations (given by external function fnxname) using Newton's method, where the derivative is given by finite difference calculation. How may I use the function in the program.

Suppose the desired function name is given by a string "fnxname", I cannot write fnxname(x), can I? In MATLAB, I may write eval(cat('fnxname','(x)')) or something like that. Is there a similar command in Fortran?

Replies would be much appreciated. Thank you very much.
 

Answers and Replies

  • #2
minger
Science Advisor
1,495
2
You can either just put the function inside of the main program's file, or put the function inside of a MODULE and INCLUDE that module in the main program. Then you can simply call the function as normal.
 

Related Threads on Is there any command in Fortran that is similar to eval in MATLAB?

Replies
0
Views
4K
  • Last Post
Replies
4
Views
3K
Replies
5
Views
4K
  • Last Post
Replies
2
Views
2K
Replies
1
Views
17K
  • Last Post
Replies
0
Views
3K
Replies
3
Views
4K
Replies
5
Views
1K
Replies
1
Views
225
Replies
7
Views
5K
Top