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, 2nd 0.25, 3rd 0.15, 4th 7, 5th 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!

  • $\begingroup$ After 2 years and 7 months (!!) being a member of this site I'd say it is about time to write mathematics properly... $\endgroup$ – DonAntonio Mar 6 '17 at 11:51
  • $\begingroup$ Thanks for the comment, anyone can be a member...it doesn't imply that I need to master it. However I forgot many stuff... $\endgroup$ – box Mar 6 '17 at 11:54
  • 1
    $\begingroup$ True...and the fact is you already got your answer and that's what matters. $\endgroup$ – DonAntonio Mar 6 '17 at 12:10

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...$$

  • $\begingroup$ Thank you for your quick and correct response! :) I guess i was looking in wrong direction. This is then possible to resolve with any other series also in a similar manner as i understand? $\endgroup$ – box Mar 6 '17 at 12:04
  • $\begingroup$ If your start element is $a$ and your total number of elements is $N$, then you simply need to solve $$\frac{a(r^N-1)}{r-1} = 1.$$ If $a$ and $N$ are given, then we only need to find $r$ and this should work in general. $\endgroup$ – Eff Mar 6 '17 at 12:06
  • $\begingroup$ Yes I understood that...thank you for the in depth explanation. $\endgroup$ – box Mar 6 '17 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.