I am working on a project where I would like to take a weighted average of values in a set, with the weights decreasing exponentially. To do this, I am trying to find a function $f$ such that $\int_0^1 f = 1$. $f$ will be used in the following formula:
$$\sum_{n=0}^{|S|}S_n * \frac{f\left(\frac{n}{|S|}\right) + f\left(\frac{n + 1}{|S|}\right)}{2} * \frac{1}{|S|} $$
I would appreciate help with two aspects of this.
- It has been a while since I took calculus, so I am at a bit of a loss as to how to move forward with finding a function $f$ suitable for these purposes, generally. I have been able to find a few functions which have integrals close to 1, but have only been able to use guess-and-check to find these approximations.
- I wonder if I am on the right track here with doing this weighted average, and am curious if I am over-complicating it.
Thanks!