I haven't done much maths for 30 years. I have extensively Googled for a couple of hours but can't seem to find what I need.
I have a set of numbers (here's five of them but there's around 50 in total):
- 20 Red Widgets
- 30 Blue Widgets
- 45 Yellow Doodahs
- 50 Green Wotsits
- 20 Cyan Thingies
The total of these numbers is 165.
I need to increase/decrease these numbers to total 300 instead of 165 for an export to a portal, but do it in proportion to each other. So, I want the same proportion of Red Widgets to Yellow Doodahs in the export.
I feel it has to do with ratios but every ratio tutorial starts with the known ratios whereas I think I need to figure out what the ratios are first.
I am trying to script this in a database programme.
Say your list is $\{a_i\}_{i=1}^n=\{a_1,a_2, \cdots, a_n\}$.
Let $S$ be the sum of your terms, so $S=a_1+a_2+\cdots + a_n$ and let $R=\frac {1000}{S}$.
Now make a new list as $A_i=R\times a_n$.
This does the job since the sum of the $A_i$ is $R$ times the sum of the $a_i$ and that comes to $1000$ by the definition of $R$: $$A_1+A_2+\cdots +A_n=R\times a_1+R\times a_2+\cdots + R\times A_n=$$$$=R\times (a_1+a_2+\cdots +a_n)=R\times S=1000$$ Clearly the ratios work the way you want since $$\frac {A_i}{A_j}=\frac {R\times a_i}{R\times a_j}=\frac {a_i}{a_j}$$
Example: if your list was $\{20, 30, 45, 50, 20\}$ then $S= 165, R= 6.\overline {06}$ and your new list is $$\{121.\overline {21}, 181.\overline {81}, 272.\overline {72}, 303.\overline {03}, 121.\overline {21}\}$$ where, as usual, the bar means that the digits are repeated. Thus $\frac 1{11}=.09090909...=.\overline {09}$ for instance.