title: Algorithm to keep a list of percentages to add up to 100%
body: <p>(code examples are python)<br />
  Lets assume we have a list of percentages that add up to 100:</p>
  <pre><code>mylist = [2.0, 7.0, 12.0, 35.0, 21.0, 23.0]  
  </code></pre>
  <p>Some values of mylist may be changed, others must stay fixed.<br />
  Lets assume the first 3 (2.0, 7.0, 12.0) must stay fixed and the last three (35.0, 21.0, 23.0) may be changed.</p>
  <pre><code>fix = mylist[:3]
  vari = mylist[3:]
  </code></pre>
  <p>The goal is to add a new item to mylist, while sum(mylist) stays 100.0 and vari<br />
  items keep their relations to each other. For that we need to substract a CERTAIN<br />
  PERCENTAGE from each vari item. Example: lets assume we want to add 4.0 to mylist.<br />
  Using an ugly aproximation loop I found out that i need to substract ca. 5.0634%<br />
  of each vari item (CERTAIN PERCENTAGE = 5.0634):</p>
  <pre><code>adjusted =[]
  for number in vari:
      adjusted.append(number-(number*(5.0634/100.0)))
  adjusted.extend(fix)
  adjusted.append(4.0)
  </code></pre>
  <p>adjusted now contains my desired result.</p>
  <h1>My question is how to calculate CERTAIN PERCENTAGE ;.)</h1>