Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran 77 Nonlinear Equations Minipack

  1. Mar 21, 2008 #1

    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?

    Best regards, Martin
  2. jcsd
  3. Mar 21, 2008 #2
    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).
  4. Mar 21, 2008 #3
    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 seperate file HYBRD1.F in the same directory of my computer, that doesn't work either

    Best regards
  5. Mar 21, 2008 #4
    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).
  6. Mar 23, 2008 #5
    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 Unknown

    best regards
  7. Mar 24, 2008 #6
    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.
  8. Mar 24, 2008 #7
    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

    Best regards, Martin
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook