inter3.f
37 lines · 1 definitions · on GitHub (7be4133)
Python version: inter3.py, 39 lines, on the right (switch to Python above the code).
Purpose
INTER3 returns the weights of 3-point Lagrange interpolation, and of its first derivative, at a point $x$.
How it fits
Called by SETSCV (interpolation in the SCV equation-of-state tables), SURFP and KCSURFP (interpolation in gravity in the surface-pressure tables). No modules, no calls. The 4-point version is INTERP.
The header's "Livermore opacity tables" is from an older use. The comment says INTER3 is "the interpolation routine for density in the Livermore opacity tables" (lines 18–19↗), but its only callers are the SCV EOS set-up (setscv.f, line 114↗; setscv.f, line 193↗; setscv.f, line 208↗; setscv.f, line 242↗) and the surface-pressure routines (surfp.f, line 81↗; kcsurfp.f, line 90↗), none an opacity routine.
The method
For nodes $a_1, a_2, a_3$ (A), the weights B and derivative weights C are
$$B_i(x) = \prod_{j\ne i}\frac{x-a_j}{a_i-a_j},\qquad C_i(x) = \frac{dB_i}{dx} = \frac{\sum_{j\ne i}\prod_{k\ne i,j}(x-a_k)}{\prod_{j\ne i}(a_i-a_j)},$$
so that $f(x) \approx \sum_i B_i f(a_i)$ and $f'(x) \approx \sum_i C_i f(a_i)$.
Definitions
subroutineINTER3
3-point Lagrange weights and derivative weights (above).
Change log
The changes since rp_1
Changed since rp_1. Declarations only: IMPLICIT NONE.