1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Linear to logarithmic scale conversion

  1. Feb 27, 2010 #1
    Hi!

    I'm making a computer program that represents some quantities in a graph in this way:

    x'i=(xi-xmin)/(xmax-xmin)

    so that the possible values of x range from 0 to 1. This is a linear scale. I want to do the same with the logarithmic values of xi. That is, I want to implement a log scale in my graphs, also in the range from 0 to 1.

    Can anyone tell me how to do it?

    Thanks!
     
  2. jcsd
  3. Feb 27, 2010 #2

    berkeman

    User Avatar

    Staff: Mentor

    Welcome to the PF.

    What language are you programming in? Does it have any math libraries that cover logarithms?
     
  4. Feb 28, 2010 #3
    I'm using C++ and it has both log and log10 functions, that is, log in base e and log in base 10.

    I'm not sure if I made myself clear in my first post. I want to be able to make log-log plots, transforming the resulting plot into the [0,1] interval.
     
  5. Feb 28, 2010 #4

    Redbelly98

    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    I think this will work:

    x'i = (log(xi)-log(xmin)) / (log(xmax)-log(xmin))​
    As a test, we can see that if xmin,max are 1 and 100, then xi=10 gives x'i=0.5. As it should, since 10 is halfway between 1 and 100 on a log scale.
     
  6. Feb 28, 2010 #5
    Thanks! It makes sense to me. Now the problem is to implement it in the program, but I won't bother you with such a thing. Thanks again from Spain!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Linear to logarithmic scale conversion
  1. Logarithmic Scale (Replies: 7)

  2. Logarithmic Scale (Replies: 4)

  3. Logarithms problem (Replies: 2)

Loading...