Exponential function with a sum of 1

1.2k Views Asked by At

I have a problem where I have $n$-elements and the size of these elements must be $1$ all together (sum), but they need to be exponentially sized.

Lets say I have $5$ elements, the first one needs to be $0.5$, $2$nd $0.25$, $3$rd $0.15$, $4$th $7$, $5$th $3$ (the sizes should be proportionally distributed, but the first one should be $0.5$).

I have tried to implement exponential decay, but how can I set it as a sum? Should I solve this problem in any other way...with exponential series?

I am a developer and I don't have an idea how to solve this math problem. The solution should look as a chart graph where the next bar is lower than the previous one, but they need to have a combined height of $1$.

Help appreciated!

1

There are 1 best solutions below

3
On BEST ANSWER

You can use a geometric series. Say you have a starting element $a$, then your terms are given by $ar^n$ for $n = 0,...,N-1$, where $N$ is the total number of elements. You then have that $$\sum\limits_{n=0}^{N-1}ar^n = \frac{a(r^N-1)}{r-1} = 1.$$ Given $N$, then solve for $r\in\mathbb{R}$.

Example. Let $a = 1/2$ be the starting element and $N = 5$. Then $$\frac12\frac{r^5-1}{r-1} = 1\quad\quad\implies\quad\quad r=0.518790... $$

Your terms are then $(1/2)\cdot (0.518790...)^n$ for $n = 0,...,4$, i.e. $$0.5,\quad 0.2593950318..., \quad 0.134571565..., \quad 0.06981439...,\quad 0.03621901...$$