# Thread: simple function to decrease small numbers and increase large numbers

1. ## simple function to decrease small numbers and increase large numbers

Hello,

Say I have a set of real numbers in a range such as 0 to 1. I am looking for a function that will decrease the value of numbers toward the lower end, increase the value of numbers near the upper end, and leave values in the middle more or less unchanged. The method would need to work on any range of numbers, but I use 0 to 1 as an example.

I have looked at something in the form of,
$f(x)=a+b*x$

Modifying a and b will alter the upper and lower ends of a range of numbers, but after playing around a bit I can't seem to get both ends in line at the same time. I don't know if I need one more term of if I am thinking about this in the wrong way so I though I would post. I was originally thinking of a sigmoid, but that doesn't give anything like the results I am looking for.

I can post data if that would help, just let me know.

Anything ring a bell?

Thanks,

LMHmedchem

2. ## Re: simple function to decrease small numbers and increase large numbers

Hey LHMmedchem.

You won't get a linear function that will do this - you need something non-linear.

I would look at using combinations of exponential functions for something like this. Do you know much about them?

3. ## Re: simple function to decrease small numbers and increase large numbers

$y= x^2$ makes numbers less than 1 smaller ( $(1/2)^2= 1/4$) and makes numbers larger than 1 larger ( $2^2= 4$). Is that what you mean?

4. ## Re: simple function to decrease small numbers and increase large numbers

Originally Posted by chiro
You won't get a linear function that will do this - you need something non-linear.

I would look at using combinations of exponential functions for something like this. Do you know much about them?
I know some calculus with squashing functions like the log sigmoid and tangent sigmoid but that is more or less the limit of my experience with exponential.

I tried a bit with a log sigmoid,

$f(x)=1/1+e^{-ax}$

where I modified the value of $a$ to change the steepness, but trial and error didn't give me anything that was looking promising. Another issue was that I needed to rescale x to fall between 0 and 1. It's almost like I need a sigmoid with non-horizontal asymptotes if that makes any sense. This is just to say that the function would need to be linear over some range in the middle and then bend down at the bottom and up at the top where you can modify the linear range and the degree of bend at each end.

I have tried a bit with something of the form,

$f(x) = a + bx + cx^2$

where a=-90, b=1.1, c=0.005. In this case the x values range from 200 to 1350. This stated to look better, but since the function is more or less exponential growth I'm not sure the form makes any sense for what I am trying to do. In this case I didn't need to rescale x, which is a benefit.

Thanks for the assistance,

LMHmedchem

5. ## Re: simple function to decrease small numbers and increase large numbers

Originally Posted by HallsofIvy
$y= x^2$ makes numbers less than 1 smaller ( $(1/2)^2= 1/4$) and makes numbers larger than 1 larger ( $2^2= 4$). Is that what you mean?
All of the x values would be positive and likely fall either between 0 and 1 or > 1 unless I rescale. One set of data I am looking at has value that range from 200 to 1350 and it looks like I would need to decrease values below 400 and increase values above 1100. The scale is not very relevant but there are some things you can do when you data ranges above and below 1, above and below 0, etc, that I wouldn't be able to do without rescaling.

LMHmedchem

6. ## Re: simple function to decrease small numbers and increase large numbers

Originally Posted by HallsofIvy
$y= x^2$ makes numbers less than 1 smaller ( $(1/2)^2= 1/4$) and makes numbers larger than 1 larger ( $2^2= 4$). Is that what you mean?
All of the x values would be positive and likely fall either between 0 and 1 or > 1 unless I rescale. One set of data I am looking at has value that range from 200 to 1350 and it looks like I would need to decrease values below 400 and increase values above 1100. The scale is not very relevant but there are some things you can do when you data ranges above and below 1, above and below 0, etc, that I wouldn't be able to do without rescaling.

LMHmedchem

7. ## Re: simple function to decrease small numbers and increase large numbers

I have attached an excel spreadsheet with something like what I am looking for.

In the spreadsheet I have added some test data consisting of a set of values from 200 to 1350. The X and Y columns are the same. In the column Y-test, I have manually altered the value of Y to produce something similar to what I am looking for. I did a 3rd order polynomial curve fit to the Y-test values and the resulting equation is given on the first line. Column Y-func shows the Y values as modified by the polynomial equation.

The first plot X,Y-test show the plot of the manually modified Y values and the second plot, X,Y-func shows the values modified by the polynomial. The curve of the second plot is something like what I am looking for.

Is there a more generic name for the kind of function that is displayed in these plots? I would like to be able to manipulate the shape of the curve in several ways. In particular, the point of departure from the XY line (currently ~400, ~1100), and the degree of bend away from the XY line. Is there a straightforward explanation for how adjustments to the coefficients will affect these characteristics? I assume that the sign of the coefficients needs to stay the same.

This is the 3rd order equation for those who don't want to bother with the spreadsheet.

$y = 7.1095E-07x^3 - 1.6530E-03x^2 + 2.2197x - 283.3688$

This is the plot of X,Y-func as well

Thanks for the help so far. This question may be more related to functions than algebra, so perhaps it should be in the per-calculus section instead.

LMHmedchem