colpnt Subroutine

subroutine colpnt(k, rho)

************80

! COLPNT supplies collocation points.

Discussion:

The collocation points are for the standard interval (-1,1) as the
zeros of the Legendre polynomial of degree K, provided K <= 8.

Otherwise, uniformly spaced points are given.

Modified:

14 February 2007

Author:

Carl DeBoor

Reference:

Carl DeBoor,
A Practical Guide to Splines,
Springer, 2001,
ISBN: 0387953663,
LC: QA1.A647.v27.

Parameters:

Input, integer ( kind = 4 ) K, the number of collocation points desired.

Output, real ( kind = 8 ) RHO(K), the collocation points.

Arguments

Type IntentOptional Attributes Name
integer(kind=4) :: k
real(kind=8) :: rho(k)

Source Code

subroutine colpnt ( k, rho )

  !*****************************************************************************80
  !
  !! COLPNT supplies collocation points.
  !
  !  Discussion:
  !
  !    The collocation points are for the standard interval (-1,1) as the 
  !    zeros of the Legendre polynomial of degree K, provided K <= 8.  
  !
  !    Otherwise, uniformly spaced points are given.
  !
  !  Modified:
  !
  !    14 February 2007
  !
  !  Author:
  !
  !    Carl DeBoor
  !
  !  Reference:
  !
  !    Carl DeBoor,
  !    A Practical Guide to Splines,
  !    Springer, 2001,
  !    ISBN: 0387953663,
  !    LC: QA1.A647.v27.
  !
  !  Parameters:
  !
  !    Input, integer ( kind = 4 ) K, the number of collocation points desired.
  !
  !    Output, real ( kind = 8 ) RHO(K), the collocation points.
  !
  implicit none

  integer ( kind = 4 ) k

  integer ( kind = 4 ) j
  real ( kind = 8 ) rho(k)

  if ( k == 1 ) then

     rho(1) = 0.0D+00

  else if ( k == 2 ) then

     rho(1) = -0.577350269189626D+00
     rho(2) =  0.577350269189626D+00

  else if ( k == 3 ) then

     rho(1) = -0.774596669241483D+00
     rho(2) =  0.0D+00
     rho(3) =  0.774596669241483D+00

  else if ( k == 4 ) then

     rho(1) = -0.861136311594053D+00
     rho(2) = -0.339981043584856D+00
     rho(3) =  0.339981043584856D+00
     rho(4) =  0.861136311594053D+00

  else if ( k == 5 ) then

     rho(1) = -0.906179845938664D+00
     rho(2) = -0.538469310105683D+00
     rho(3) =  0.0D+00
     rho(4) =  0.538469310105683D+00
     rho(5) =  0.906179845938664D+00

  else if ( k == 6 ) then

     rho(1) = -0.932469514203152D+00
     rho(2) = -0.661209386466265D+00
     rho(3) = -0.238619186083197D+00
     rho(4) =  0.238619186083197D+00
     rho(5) =  0.661209386466265D+00
     rho(6) =  0.932469514203152D+00

  else if ( k == 7 ) then

     rho(1) = -0.949107912342759D+00
     rho(2) = -0.741531185599394D+00
     rho(3) = -0.405845151377397D+00
     rho(4) =  0.0D+00
     rho(5) =  0.405845151377397D+00
     rho(6) =  0.741531185599394D+00
     rho(7) =  0.949107912342759D+00

  else if ( k == 8 ) then

     rho(1) = -0.960289856497536D+00
     rho(2) = -0.796666477413627D+00
     rho(3) = -0.525532409916329D+00
     rho(4) = -0.183434642495650D+00
     rho(5) =  0.183434642495650D+00
     rho(6) =  0.525532409916329D+00
     rho(7) =  0.796666477413627D+00
     rho(8) =  0.960289856497536D+00

  else

     write ( *, '(a)' ) ' '
     write ( *, '(a)' )'COLPNT - Warning!'
     write ( *, '(a)' )'  Equispaced collocation points will be used,'
     write ( *, '(a,i8)' ) '  because K = ', k

     do j = 1, k
        rho(j) = ( real ( k - j,     kind = 8 ) * ( -1.0D+00 )   &
             + real (     j - 1, kind = 8 ) * ( +1.0D+00 ) ) &
             / real ( k     - 1, kind = 8 )
     end do

  end if

  return
end subroutine colpnt