# Math Help - weighting factor by distance (negative linear decrease)

1. ## weighting factor by distance (negative linear decrease)

Hi,

I am actually working on grid cells. An each cell (each discrete space element) has a distance x to point A.
Now I'd like to distribute a certain amount of lets say money over the grid cells. So each cell should get
some money (total amount of money M = 10000 $) based on how far it is away from point A (based on x). The more distant that the cell is the less it money it should get. A second condition is that the maximum distance to get money is x(max) = 200 m. A cell exceeding x(max) should not get any money any more. I am looking for a general function of x (f(x)) to describe this based on M, x(max) and 5 cells with different distances (e.g 2, 10, 30, 50, 150 m). Is there any way to describe this mathematically as f(x)? /J 2. ## Re: weighting factor by distance (negative linear decrease) The word "grid" usually refers to a two-dimensional structure while in your situation, if I understand correctly, the money given depends only on the distance to A. I am wondering if it would be more convenient to model this using a one-dimensional line. Obviously, there are many solutions. You could give$1 to 150m, $2 to 50m,$3 to 30m, $4 to 10m and the rest to 2m. Or you could give$1 to 150m, $3 to 50m,$4 to 30m, $5 to 10m and the rest to 2m. Or$2 to 150m, $3 to 50m,$4 to 30m, \$5 to 10m and the rest to 2m, etc.

You need to select the law that says how money decreases with distance. This could be a linear law, quadratic law, exponential law and so on.

Consider the linear law: the money y(x) given at distance x is -a/x(max) * x + a for some constant a. Then y(0) = a and y(x(max)) = 0. We want y(2) + y(10) + y(30) + y(50) + y(150) = M. Let S = 2 + 10 + 30 + 50 + 150 and let n = 5 be the number of grids we consider. Then y(2) + ... + y(150) = -a/x(max) * S + n * a = M, from where a = M / (n - S / x(max)). Knowing a, we can find y at each point.

3. ## Re: weighting factor by distance (negative linear decrease)

Thank you that is the linear approach I was looking for... working perfectly!!