## Percentage total amongst multiple numbers

May 11, 2012 at 2:04pm

# Percentage total amongst multiple numbers

Hello

I’m currently working on a patch in which the user should be able to set himself the probabilities of certain events, to do this, I arranged some number boxes in which a total 100% is divided equally, what I want to do is substract numbers from the rest of the boxes whenever you increase the number in one of them, so they always sum up 100. Any ideas on how to accomplish this?

Example in case I didnt make myself clear:

[25] [25] [25] [25] = total 100%

If I added 3 to the first number box it should ideally do this:

[28] [24] [24] [24] = total 100%

Of course theres a lot of interrogants, as in which order should he substract or if it is possible to do with floats (this would be even better)

#63549
May 11, 2012 at 2:47pm

You could maybe approach it this way :

– Pasted Max Patch, click to expand. –
#229083
May 12, 2012 at 9:03am

this reminds me on my various approaches to do the same for a variable
number of gain regulators, where i needed to have a variable sum in addition.

try to realize it with “set” messages only at first, then you will see at which points
you need to have a pvar or something like that, where the state of the parameters
is copied in order to accumulate.

-110

#229084

You must be logged in to reply to this topic.