fderiv subroutine

Anton F.
  • Anton F.

    Anton F. - 2010-10-26

    I wanted to use fderiv.f90 for obtaining first and second order derivatives but unfortunatelly can't succeed yet. I've written this extra-simple code to exclude any unexpected factors:

    program der
    real(8) x(100), y(100), f(100), cf(3,100)
    integer i
    do i=1,100
    end do
    call fderiv(1,100,x,y,f,cf)
    do i=1,100
    print *, x(i),f(i)
    end do
    end program der

    As one can see it calculates two arrays - of an argument and of a function which is simply argument squared so it's clear that the derivative should be twice argument. But instead of this I get some artificial numbers. Is it a bug or I do something wrong? I perform compiling of course with fderiv.f90 and spline.f90 attached.
    Thanks in advance, Anton

  • John Kay Dewhurst

    Hi Anton!

    You have to declare the array as cf(4,100). Then all is well.


  • Anton F.

    Anton F. - 2010-10-26

    Hi Kay!
    It turned out that the real reason was that I used some old one of spline.f90. I tried to declare cf(4,100) as you suggested but it didn't help. Then I changed spline.f90 to the one from elk 1.1.4 package and it became OK! But your reply motivated me to check this, so thank you!
    Cheers, Anton


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks