************80
! NCC_ABSCISSAS_AB computes the Newton Cotes Closed abscissas for [A,B].
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
29 December 2007
Author:
John Burkardt
Parameters:
Input, real ( kind = 8 ) A, B, the endpoints of the interval.
Input, integer ( kind = 4 ) N, the order of the rule.
Output, real ( kind = 8 ) X(N), the abscissas.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=8) | :: | a | ||||
real(kind=8) | :: | b | ||||
integer(kind=4) | :: | n | ||||
real(kind=8) | :: | x(n) |
subroutine ncc_abscissas_ab ( a, b, n, x ) !*****************************************************************************80 ! !! NCC_ABSCISSAS_AB computes the Newton Cotes Closed abscissas for [A,B]. ! ! Licensing: ! ! This code is distributed under the GNU LGPL license. ! ! Modified: ! ! 29 December 2007 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, real ( kind = 8 ) A, B, the endpoints of the interval. ! ! Input, integer ( kind = 4 ) N, the order of the rule. ! ! Output, real ( kind = 8 ) X(N), the abscissas. ! implicit none integer ( kind = 4 ) n real ( kind = 8 ) a real ( kind = 8 ) b integer ( kind = 4 ) i real ( kind = 8 ) x(n) if ( n < 1 ) then write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'NCC_ABSCISSAS_AB - Fatal error!' write ( *, '(a)' ) ' N < 1.' stop end if if ( n == 1 ) then x(1) = 0.5D+00 * ( b + a ) return end if do i = 1, n x(i) = ( real ( n - i, kind = 8 ) * a & + real ( i - 1, kind = 8 ) * b ) & / real ( n - 1, kind = 8 ) end do return end subroutine ncc_abscissas_ab