# Smoothing a discrete function with point wise variances

In Stark's Introduction to numerical methods [1970] it suggests fitting local polynomials to smooth discrete data before the Fourier transform using least squares minimisation. This gives the following rules for degree three five-point smoothing:

for the first two entries: $$g_1 = \frac{1}{70} (69 f_1 + 4 f_2 - 6 f_3 + 4 f_4 - f_5) \\ g_2 = \frac{1}{35} (2 f_1 + 27 f_2 + 12 f_3 - 8 f_4 + 2 f_5) \\$$

for the last two entries:

$$g_{N-1} = \frac{1}{35} (2 f_{N-4} - 8 f_{N-3} + 12 f_{N-2} + 27 f_{N-1} + 2 f_{N}) \\ g_{N} = \frac{1}{70} (- f_{N-4} + 4 f_{N-3} - 6 f_{N-2} + 4 f_{N-1} + 69 f_{N})$$

and for all other entries:

$$g_{n} = \frac{1}{35} (-3 f_{n-2} + 12 f_{n-1} + 17 f_{n} + 12 f_{n+1} - 3 f_{n+2})$$

Would a weighted least squares approach following this idea be valid (what would the formulae be?) or are there more widely recognised approaches for smoothing functions with known variances?