Fortran Fortran 77 Nonlinear Equations Minipack

  • Thread starter Thread starter Sunset
  • Start date Start date
  • Tags Tags
    Fortran Nonlinear
AI Thread Summary
The discussion centers on solving nonlinear equations using Fortran, specifically through the use of the Minipack library. The original poster seeks to write their own code and encounters issues with missing subroutines, particularly spmpar.f, while trying to compile a test program (file08.f). Another participant clarifies that the correct file to use is FILE15, which is the double precision version of FILE08, and suggests that the BLAS routines may not be necessary. After following these suggestions, the original poster successfully compiles the program but faces difficulties running the executable (a.out), which leads to confusion about how to provide input parameters. The conversation concludes with guidance on how to execute the program correctly by entering the required parameters directly in the console.
Sunset
Messages
61
Reaction score
0
Hi!

I frequently have to solve systems of nonlinear equations with Fortran. So far I used a code which I didn't write by myself which is based on a Newtonian root finder from Numerical recipes.
I would like to write a Fortran code on my own, based on another Numerical subroutine available on the internet.

I found "Minipack" http://www.netlib.org/minpack/
But there are subroutines missing? I wanted to compile the testprogram file08.f (under link ex). In the description is said what is needed to include: MINPACK-SUPPLIED ... SPMPAR,ENORM,HYBRD1,INITPT,VECFCN . But there's no file spmpar.f on the above page to download!? If you run file08.f it consequently tells you that there are undefined references.

It needn't to be Minipack! I just want to get to a program over which I have "full control / overwiev". Is there a good documentation on the internet or a book on how to solve nonlinear equations with fortran?

Martin
 
Technology news on Phys.org
Reviewing the netlib site, I see the following:

Routines INITPT & VECFCN are in FILE08

Download hybrd1.f and its dependencies located 9 links below the link for "ex". Hybrd1 contains all other externals (ENORM, DPMPAR, etc).

You'll be asked whether on not you want the BLAS routines downloaded as well. I don't know if these routines require BLAS but if you don't already have them, then you might as well download them as well.

You need to compile and link FILE08 and HYBRD1 together (and possibly with the BLAS routines).
 
Hello Theo!

Thanks for your reply.

I copied the text from file08 + hybrd1 & its dependencies + BLAS into one file "1.f" and compiled it.
Compiler still misses something: undefined reference to `spmpar_'

I also tried to add the line INCLUDE HYBRD1.F to file08.f and put the text from hybrd1 & its dependencies + BLAS into a separate file HYBRD1.F in the same directory of my computer, that doesn't work either

Best regards
 
Yeah - what you want is FILE15 instead of FILE08. This is the double precision version of FILE08. That's why its complaining about the missing single precision program SPMPAR. Sorry for the mix-up.

So download FILE15 and try again.

(Also, just browsing, I don't think these programs need the BLAS routines - you may want to try to exclude them after you try above).
 
Hello Theo!

The compilation works

Only the executable file a.out I cannot open

severe (64): input conversion error, unit 5, file /dev/pts/3
Image PC Routine Line Source
a.out 0808F92C Unknown Unknown Unknown
a.out 0808E624 Unknown Unknown Unknown
a.out 0808D2C5 Unknown Unknown Unknown
a.out 0805D1D0 Unknown Unknown Unknown
a.out 0805D6A7 Unknown Unknown Unknown
a.out 08054196 Unknown Unknown Unknown
a.out 080531AD Unknown Unknown Unknown
a.out 0804A43E Unknown Unknown Unknown
a.out 0804A3B9 Unknown Unknown Unknown
Unknown B7BCA974 Unknown Unknown Unknown
a.out 0804A2D1 Unknown Unknown Unknownbest regards
 
Sunset - what do you mean by "Only the executable file a.out I cannot open"

What compiler are you using?

The result of the compliation will be an executable. For example, using the complier "gfortran", the executable will be named "a.out" unless you specifically name it to something else by the "-o" compilier switch.

Try renaming the "a.out" file to an exe file (ie, "a.exe") and run that file.

The executable will expect three input parameters from the console. The three parameters are (1) Problem number, (2) Dimension, and (3) Number of Trials. Type these in separating with commas, and hit Enter. The results should post on the console screen.

See "file21" for other input data.
 
Hello Theo!

Ah ok didn't know that, I always worked with programs where the command ./a.out gave an data-file with the results and was confused why nothing happened.

Ok great, thanks again for your help

Martin
 

Similar threads

Replies
3
Views
2K
Replies
8
Views
4K
Replies
6
Views
7K
Replies
6
Views
2K
Replies
2
Views
3K
Replies
6
Views
2K
Replies
2
Views
1K
Replies
2
Views
3K
Replies
25
Views
10K
Back
Top