PolyR Function

public function PolyR(x0, x, f, N)

Arguments

Type IntentOptional Attributes Name
real, intent(in) :: x0
real, intent(in) :: x(N)
real, intent(in) :: f(N)
integer, intent(in) :: N

Return Value real


Called by

proc~~polyr~~CalledByGraph proc~polyr PolyR interface~poly Poly interface~poly->proc~polyr proc~interpolateirc InterpolateIRC proc~interpolateirc->interface~poly

Source Code

  FUNCTION PolyR( X0, X, F, N )

    INTEGER, INTENT( IN ) :: N   ! order of the polynomial
    REAL,    INTENT( IN ) :: x0, x( N ), f( N )  ! x, y values of the polynomial
    REAL                  :: ft( N ), h( N ), PolyR

    ! Initialize arrays

    h  = x - x0
    ft = f

    ! Recursion for solution
    IF ( N >= 2) THEN
       DO i = 1, N - 1
          DO j = 1, N - i
             ft( j ) = ( h( j + i ) * ft( i ) - h( i ) * ft( i + 1 ) ) / &
                  &            ( h( j + i ) - h( j ) )
          END DO
       END DO
    ENDIF

    PolyR = ft( 1 )

  END FUNCTION PolyR