How to Efficiently Compute a Sum of Exponentials?

314 Views Asked by At

In embedded code I want to efficiently compute:

$\sum_{k=1}^{N}y_k \cdot e^{a\cdot k}$,

$\sum_{k=1}^{N}y_k\cdot k \cdot e^{a\cdot k}$ and

$\sum_{k=1}^{N}y_k\cdot k^2 \cdot e^{a\cdot k}$.

Here $a$ is a scalar and $y_k$ is the k-th value in an array with $N$ elements.

These sums needs to be computed for many values of $a$.

Given that the array $y$ remains constant, is there an efficient way to do this without having to recompute the full sum of exponentials for every new value $a$?

1

There are 1 best solutions below

2
On

One may see the sum $$ \sum_{k=1}^{N}y_k \cdot e^{a\cdot k} $$ as a polynomial function $$ P_N(x)=\sum_{k=1}^{N}y_k \cdot x^{k} $$ valued at $x=e^a$.

If one knows the value of a polynomial at some real number and all its derivatives at the same real number how one may obtain its value at another real number?

One may exploit the Taylor formula $$ P_N(x) = \sum \limits_{k=0}^N \dfrac{P_N^{(k)}(\alpha)(x-\alpha)^k}{k!}, \tag {*} $$ by storing all $P_N^{(k)}(\alpha)$ in a memory only once and use the above identity to get a value of $P_N$ at any $x$.