This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

using GSL from fortran


Hello,

I am trying to use GSL from fortran. I have found how to deal  with 
underscores and lowercases and passing a
parameter to the C functions from Fortran, but I don't Know how to get 
the give the correct value at my fortran variable as
the result of the C function

Here is my program: err is an error of the computed value of the Lambert 
function (should be < 1.e-15

        program testlamb
        real*8 z,w,err
        integer i
        do i=0, 100
           z=i/100.d0-0.3678794411714423215955d0
           w= gsl_sf_lambert_W0(%val(z));
           err=exp(w)-z/w;
           print*,z,w,err
        end do
        do i=0,100
           z=i/1.0d-1-0.3
           w= gsl_sf_lambert_W0(%val(z));
           err=exp(w)-z/w;
           print*,z,w,err
        end do             
        stop
        end

and the compiler command:
g77 testlamb.f -g -lm -lgsl -lgslcblas -fsource-case-preserve 
-fno-underscoring -o testlamb

The results ::
 -0.367879441 -1.  0.
 -0.357879441 -0.783229172 -3.38305041E-09
 -0.347879441 -0.701817691 -3.13803185E-09
 -0.337879441 -0.64218092  9.02375748E-10
 -0.327879441 -0.593658864  2.36602368E-09
 -0.317879441 -0.552152991 -1.17218141E-08
 -0.307879441 -0.515575528 -1.58478302E-09
 -0.297879441 -0.48269394  2.35384426E-09

...
...

 939.7  5.197402  3.80563623E-05
  949.7  5.20628023 -5.10902822E-05
  959.7  5.21506834 -3.72426268E-05
  969.7  5.22376776 -9.97708738E-06
  979.7  5.23237991 -4.94468375E-05
  989.7  5.24090719 -1.19015723E-05
  999.7  5.24935102  4.67103341E-05


Where is my error ??

Thank's a lot


-- 

Christian La Borderie
LaSAGeC / ISA - BTP /UPPA
christian.laborderie@univ-pau.fr
Tel + 33 5 59 57 70 51
Fax + 33 5 59 57 70 02
http://isabtp.univ-pau.fr



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]