Fortran 77 Nonlinear Equations Minipack

  • Context: Fortran 
  • Thread starter Thread starter Sunset
  • Start date Start date
  • Tags Tags
    Fortran Nonlinear
Click For Summary

Discussion Overview

The discussion revolves around solving systems of nonlinear equations using Fortran, specifically focusing on the Minipack library and its associated subroutines. Participants explore issues related to compiling and linking Fortran code, as well as troubleshooting errors encountered during execution.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant expresses a desire to write their own Fortran code for solving nonlinear equations, referencing the Minipack library and noting missing subroutines.
  • Another participant suggests downloading specific routines and dependencies from the netlib site, including HYBRD1 and potentially BLAS routines.
  • A participant encounters an undefined reference error related to `spmpar_` after attempting to compile the code, indicating a possible mix-up with the required files.
  • Another participant recommends using FILE15 instead of FILE08, suggesting it is the double precision version that does not require the missing SPMPAR routine.
  • A participant reports successful compilation but faces an input conversion error when trying to run the executable file a.out.
  • One participant clarifies the expected input parameters for the executable and suggests renaming the output file for clarity.
  • A participant expresses confusion about the execution process, indicating prior experience with different programs that produced data files directly.

Areas of Agreement / Disagreement

Participants generally agree on the need to compile and link specific files, but there is some uncertainty regarding the necessity of the BLAS routines and the correct files to use. The discussion remains unresolved regarding the input conversion error and the expected behavior of the executable.

Contextual Notes

Limitations include potential misunderstandings about the required files and their dependencies, as well as the specific input format needed for the executable. There are unresolved issues related to the execution of the compiled program.

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 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K