Search code examples
mathfortranmathematical-optimizationfortran90fortran95

Calculate differential in Fortran


I want to calculate w for j=0 to n in the below function. Is there any already written library for this in FORTRAN?

enter image description here

Actually I want to write a program that get n from the user, and print w in output. What shall I do for differential and for creating the equation Ln(x)?


Solution

  • That recurrence relation will generate the n-th order Legendre polynomial, and from the xj and wj, I assume you are writing a program to perform Gauss-Legendre integration (no idea why the q(x) is there).

    This Florida State page provides an LGPL Fortran90 program that calculates the nodes and weights using a tridiagonal-eigenvalue method and writing them to an external file. You could try and collect all of the contained functions and place them into a module for run-time calculation of the nodes and weights.