# weighted normalized distribution (math challenge)

## Recommended Posts

Hey smart people,

Im not sure if the topic title describes my problem very well but,...

I have a math problem that's been holding me up.

Maybe someone out there can help.

Say I have a bunch of points with normalized values

sorted by highest to lowest like...

@ptnum      @value

0                 .9

1                 .4

2                 .3

3                 .01

ect..

How do I now remap "value" for each point so that the total adds up to one?

BUT this new distributed remapped value is weighted by the original value.

The obvious thing to do would be: (@value/sum of @value) but the result is:

@ptnum      @value             @simple normalized

0                  .9                      .55

1                  .4                      .24

2                  .3                      .186

3                  .01                    .00621

ect..

This kind of remapping is not ideal because  point 0 is has a very high value which gets lost.

In the case above I could keep point 0 at .9 the distribute the remaining .1 across the rest of the points.

Which I know how to do but what happens when you have a case like:

@ptnum      @value

0                  .6

1                  .58

2                  .52

3                  .1

4                  .1

ect..

In this case I would need to average the first three points then distribute the remainder across the rest of the points.

Is there a really smart solution out there that doesnt involve setting up test conditions then adapting the code?

I've attached a hip file that demonstrated the problem..

Thx!

mathProb.hiplc

##### Share on other sites

if you are not happy with linear weight normalization, you can always power the original values to high exponent to pronounce differences and normalize afterwards

mathProb_fix.hiplc

Edited by anim

##### Share on other sites

thx Anim!

Hadn't thought to do that and it helps.

## Create an account

Register a new account