36 integer,
intent(in) :: npts
37 real(dp),
intent(in) :: alpha, beta
38 real(dp),
intent(out) :: x(npts), wts(npts)
39 real(dp),
dimension(ceiling(npts/2._dp)) :: x1, ders1
40 real(dp),
dimension(npts/2) :: x2, ders2
41 real(dp) :: ders(npts), C
43 call recurrence(npts, ceiling(npts / 2._dp), alpha, beta, x1, ders1)
44 call recurrence(npts, npts / 2, beta, alpha, x2, ders2)
46 x(idx) = -x2(npts / 2 - idx + 1)
47 ders(idx) = ders2(npts / 2 - idx + 1)
49 do idx = 1, ceiling(npts / 2._dp)
50 x(npts / 2 + idx) = x1(idx)
51 ders(npts / 2 + idx) = ders1(idx)
53 wts = 1.0_dp / ((1.0_dp - x**2) * ders**2)
54 c = 2**(alpha + beta + 1) * exp(log_gamma(npts + alpha + 1) - &
55 log_gamma(npts + alpha + beta + 1) + &
56 log_gamma(npts + beta + 1) - log_gamma(npts + 1._dp))
61 integer,
intent(in) :: npts, n2
62 real(dp),
intent(in) :: alpha, beta
63 real(dp),
intent(out) :: x(n2), PP(n2)
64 real(dp) :: dx(n2), P(n2)
65 integer :: r(n2), l, i
73 c = (2 * r(i) + alpha - 0.5_dp) *
pi / (2 * npts + alpha + beta + 1)
74 t = c + 1 / (2 * npts + alpha + beta + 1)**2 * ((0.25_dp - alpha**2) / tan(0.5_dp * c) - (0.25_dp - beta**2) * tan(0.5_dp * c))
81 do while (maxval(abs(dx)) > sqrt(epsilon(1.0_dp)) / 1000 .and. l < 10)
92 integer,
intent(in) :: npts
93 real(dp),
intent(in) :: alpha, beta
94 real(dp),
intent(in) :: x(:)
95 real(dp),
dimension(size(x)),
intent(out) :: P, Pp
96 real(dp),
dimension(size(x)) :: Pm1, Ppm1, Pa1, Ppa1
98 real(dp) :: A_val, B_val, C_val, D_val
100 p = 0.5_dp * (alpha - beta + (alpha + beta + 2) * x)
102 pp = 0.5_dp * (alpha + beta + 2)
111 a_val = 2 * (k + 1) * (k + alpha + beta + 1) * (2 * k + alpha + beta)
112 b_val = (2 * k + alpha + beta + 1) * (alpha**2 - beta**2)
113 c_val = product([(2 * k + alpha + beta + i, i=0, 2)])
114 d_val = 2 * (k + alpha) * (k + beta) * (2 * k + alpha + beta + 2)
116 pa1 = ((b_val + c_val * x) * p - d_val * pm1) / a_val
117 ppa1 = ((b_val + c_val * x) * pp + c_val * p - d_val * ppm1) / a_val
Constants contain more digits than double precision, so that they are rounded correctly.
real(dp), parameter, public pi
This is derived from the recurrence relations in chebfun.
subroutine recurrence(npts, n2, alpha, beta, x, PP)
subroutine gauss_jacobi_rec(npts, alpha, beta, x, wts)
subroutine eval_jacobi_poly(x, npts, alpha, beta, P, Pp)
Module for defining types and precision levels for Gauss-Jacobi Polynomial (GJP) calculations.
integer, parameter, public dp
Define various kinds for real numbers.