At each node t_i, the Lagrange basis should satisfy B_j(t_i)=δ_ij.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(inout) | :: | id | |||
| integer, | intent(inout) | :: | nfail |
subroutine test_010(id, nfail) use forcolormap_parameters, only: wp use forcolormap_utils, only: lagrange_poly integer, intent(inout) :: id, nfail character(len=*), parameter :: name = "lagrange_poly: nodal Kronecker delta property (n=7)" logical :: ok real(wp), parameter :: tol = 1.0e-12_wp integer :: n, i, j real(wp) :: inv, t real(wp), allocatable :: B(:) n = 7 allocate(B(n)) inv = 1.0_wp / real(n-1, wp) ok = .true. do i = 1, n t = real(i-1, wp) * inv B = lagrange_poly(t, n) do j = 1, n if (j == i) then ok = ok .and. (abs(B(j) - 1.0_wp) <= tol) else ok = ok .and. (abs(B(j)) <= tol) end if end do end do call report_test(name, ok, id, nfail) end subroutine test_010