For n=2, Lagrange interpolation reduces to linear weights [1-t, t] on [0,1].
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(inout) | :: | id | |||
| integer, | intent(inout) | :: | nfail |
subroutine test_013(id, nfail) use forcolormap_parameters, only: wp use forcolormap_utils, only: lagrange_poly integer, intent(inout) :: id, nfail character(len=*), parameter :: name = "lagrange_poly: n=2 is linear weights in [0,1]" logical :: ok real(wp), parameter :: tol = 1.0e-12_wp real(wp) :: t, B(2) t = 0.23_wp B = lagrange_poly(t, 2) ok = abs(B(1) - (1.0_wp - t)) <= tol .and. abs(B(2) - t) <= tol .and. & (B(1) >= -tol) .and. (B(2) >= -tol) call report_test(name, ok, id, nfail) end subroutine test_013