Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the Programming mode of gcalctool, you have a log button, which calculates the logarithm, but how do I know what base it's using and how do I change it?

For example, how would I calculate the base 2 logarithm for 16?

share|improve this question
up vote 11 down vote accepted

By default the log button calculates base-10 logarithms (while the "ln" button does, of course, base-e logarithms).

To specify a different base, you use a "subscript":

  • Type "log" in the input field.
  • Input your desired base with a subscript. This can be done either by clicking on the "downarrow-n" button (top left) and then entering the number, or by pressing Alt while typing the number.
  • Finally type the number whose logarithm you want to calculate.

By the way, I found this pretty easily by accessing gcalctool's help (press F1) and looking for logarithms in the index.

share|improve this answer
    
To use a decimal base (e.g. 1.01), use the answer from user247983. E.g. to determine the monthly interest from an APR of 12%, I used ln 1.12 / ln 1.01. If I use the method from this answer (log₁.₀₁ 1.12), it says "Malformed expression". – Tyler Collier Apr 14 '15 at 1:07

You can also use the base change formula:

ln(1024)/ln(2) = log (base 2) (1024)
share|improve this answer

You may use this frequently and like a button instead of writing out the base change formula again and again. Add within gcalculator (kde) by selecting:

edit preferences functions Name: log2 Variable: x Expression: log(x)/log(2) add update close view buttons functions

now to get log2(1024): type 1024 into the calculator and PRESS ENTER hit the 'fun' button select log2 the answer is 10

share|improve this answer

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.