Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am trying to convert data to a particular range of 0-10.

Actual Data may vary from - 50000 - 26214400. I have broken this down in to 4 parts as follows -

50000 - 1048576 -----> 0 - 2.5
1048576 - 5242880 -----> 2.5 - 5.0
5242880 - 15728640 ----->5.0 - 7.5
15728640 - 26214400 ----->7.5 - 10

How can i convert this data ? Is there any formula to do this? I found a way to normalize data to a range of [ 0 - 1 ] but am not able to apply the same to this.

share|improve this question
4  
I vote against closing. Perhaps this is not the deepest of questions, and the tags were wrong, but I argue it is an on-topic, answerable mathematical question. –  Lord_Farin Jun 12 '13 at 15:10

2 Answers 2

up vote 2 down vote accepted

You can use the two-point form for each of the four lines. For the first, it is $y-0=(2.5-0)\frac {x-50000}{1048576-50000}$ The others are similar. I showed the $0$ explicitly as the lower range of $y$ in that interval.

share|improve this answer
1  
Do you really not want any output between $2.5$ and $2.6$ and so on? It would be more normal to make the breakpoints match, so the start of the second interval would be $1048576 \to 2.5$, repeating the end of the first interval. –  Ross Millikan Jun 12 '13 at 16:46
    
ya that's correct. Thanks for the correction :) –  Dan Jun 13 '13 at 9:31
    
just to make sure for the second interval - y−2.5=(5.0−2.5)*(x−1048576)/(5242880−1048576) . am i correct here? –  Dan Jun 13 '13 at 9:52
    
@Dan: that is right –  Ross Millikan Jun 13 '13 at 10:26

Your four ranges are equally wide on the 0-10 scale but not equally wide on the 50000-2621440 scale. The smallest one is about a million, the second smallest is about four million, while the largest two are each about ten million.

You could use a piecewise linear interpolation, as @Ross suggests, if you want consistency within each interval, but potential edge effects between intervals. For example, going from 948000 to 1048000 (an increase of 100K) increases the result by 0.1. Another increase of 100K, going form 1048000 to 1148000, increases the result by only 0.025. If this is unimportant to you, then go for the simplicity of the piecewise linear approach. If you want a smooth transition, you will need to interpolate between your transition points.

Update: Using the data points below, there are many possible functions to interpolate at zunzun.com

$(50000,0), (1048576, 2.5), (5242881,5), (15728640,7.5), (26214400,10)$

For example, using $y=a+b\,\ln(dx)+c\,\ln(dx)^2$, with $a=3.016, b=-1.728, c=0.2525, d=0.0005327$, you get a pretty good fit. zunzun finds $a,b,c,d$ for you; you need only enter the data points and choose the format of the result.

Update: a better fit is found using $y=a\sqrt{x}+bx+c\sqrt{x^3}+d$, where the constants are $a=0.0041, b=-0.000000901, c=0.0000000001, d=-0.87$

share|improve this answer
    
how can i interpolate between transition points? –  Dan Jun 12 '13 at 14:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.