75% developed

Guide to Game Development/Theory/Mathematics/Logarithms

From Wikibooks, open books for an open world
Jump to navigation Jump to search
This is an example of a logarithmic graph, it's a reflection of an exponential graph in the line y=x.

About[edit | edit source]

A logarithm is the answer to the question: "What number do I need to raise this known number to to get this other known number?"

Example of the problem:

Rewritten as a logarithm:

You'd pronounce this as, "log base 2 of 32."

As you can see from the graph, you can't have a negative logarithm. If you think about it, this makes sense because it's a reflection of an exponential graph. When you have a positive number and you raise it to any number, the result will always be positive, and never 0; because of this the domain of a logarithm is as follows: .

Combining logarithms[edit | edit source]

There are 3 rules that you should know when combining logarithms:

Expanding logarithms[edit | edit source]

When expanding logarithms, you can just do the inverse of what you did to combine them.

Example 1:

Example 2 (knowledge of exponentials needed):

Cancelling logarithms with exponentials and vice versa[edit | edit source]

There are a few more rules you need to know:

where can be any number.

Note: If you're doing a complex algorithm with a computer, try to give your answer in terms of a base 2 logarithm, because whatever base you input, the computer will convert it to base 2. Doing this for the computer so that it doesn't need to convert it each time will make the algorithm run faster.

Balancing questions with these rules[edit | edit source]

So when you have a normal equation, you can do rules like "multiply both sides by 2" or "add 3 to both sides". With logarithms and exponentials, you can do something similar.

You can now:

  • "Raise both sides as an exponential of a number"
    • Example use:
  • "Log both sides (with a common base)"
    • Example use:

Notation[edit | edit source]

The mathematical constant is often used with logarithms as it's known as the natural base for a logarithm.

Certain short-hand notation has been developed for logarithms as follows:

lb

Scale of magnitude[edit | edit source]

For this scale of magnitude, we'll be using 10 as we work in base as humans.

Note: remember it's a logarithmic scale, this means that half way between 10 and 100 (55) doesn't produce a half way value ().

References[edit | edit source]