Series where every element contains a mean of near elements

57 Views Asked by At

I wonder if already exists a solution to this problem: I must calculate the value of every element of a time series (a finite series of numbers) where every element equals the mean of an easily evaluable value, and of the two elements nearby (the one before and the one after). For the first and the last element of the series just the following or the previous element contribution appears.

Actually the precise weights are the following:

$$K_i= \frac{3}{4}K_i^{(0)} + \frac{1}{8}K_{i-1} + \frac{1}{8}K_{i+1}$$

Do you know what's the best algorithm or method to solve this problem?

edit: I don't need an exact solution, which I understand would not be reasonable, because I do need an efficient solution.

1

There are 1 best solutions below

5
On BEST ANSWER

Your system is in the form

$$aK_{i-1}+bK_i+cK_{i+1}=d_i,$$ which is called a tridiagonal system.

There is a classical method to efficiently solve such systems: https://en.wikipedia.org/wiki/Tridiagonal_matrix_algorithm

In your case, the coefficients are known constants, and it might be possible to compute the matrix inverse once for all.