Zbigniew Karno napisa (a):
different napisa (a):
> I have a program which reads a file containing integer values between 0
> and 10. I already use a linear mapping which takes this values and maps
> them in a different range.
> Now I want to map the values using a logarithmic scale.
> For example I want to map from [0;10] to [0.2;5] and values have to
> grow following the logarithmic scale.
> I can I do that?


Instead of the function log(x), rather you have
to use the following one:  log(x - 1), for x >= 0.

Then the interpolation formula for x in [x_1,x_2]
with ratio f = a/(a+b), looks as follows:

(log(x_2 -1) - log(x - 1)) / (log(x - 1) - log(x_1 - 1)) = (1/f) - 1

After a simple calculation one can get

  x = (x_1 - 1)^{f - 1}  *  (x_2 - 1)^{f}  +  1 ,

what you expect.

Best Regards,
Z. Karno

Incorrect.
The sign - should be replaced by +.

So, the following function has to be used:
 log(x + 1), for x >= 0.
In this case, the interpolation formula looks as
follows:
   (log(x_2 +1) - log(x + 1)) / (log(x + 1) - log(x_1 + 1)) = (1/f) -
1.
Thus
   x = (x_1 + 1)^{f -1} * (x_2 + 1)^{f}  -  1 .

Regards,
Z. Karno


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Algorithm 
Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups-beta.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to