ok so i understand some of this but im in a grade 10 computer science class while im doing this so logarithms are quite complicated to me

Think of some common bases and their respective powers (b, b^{2}, b^{3}, ...):

- Base 2: 2, 4, 8, 16, 32, 64, ...

- Base 10: 10, 100, 1000, 10000, 100000, 1000000, ...

In these examples, the base-b logarithm's values are 1, 2, 3, 4, 5, 6, ...

In fact, this will be true for any valid base. So, at least in the case of a power, the logarithm means both "how many times was the base multiplied by itself?" (the exponent) but also "which step in the sequence is this?".

A code example:

function GetCeilingPowerOf2 (x) -- useful say to find the smallest POT texture where x will fit
local power = 1 -- 2^0 == 1
local steps = 0
while power < x do
power = 2 * power -- base 2
steps = steps + 1
end
return power, steps -- "steps" is the (base-2, AKA binary) logarithm
end

You can also walk backward through the sequence; to un-multiply a step, you divide by 2. Continuing in this way past step 1 will land you on the value of 1, with logarithm / step 0. You can keep dividing by 2 to get fractional values (1 / 2, 1 / 4, ...) with negative logarithms (-1, -2, ...).

If you plot these out, it's pretty evident that a curve would fit nicely between them. This is indeed the case, thus the fractional values. Obviously any intuition about "steps" needs to be stretched here.

There are a number of additional properties (converting powers to coefficients, products to sums, integrating 1 / x, inverting exponentials), but a lot of the aforementioned groundwork can be applied when you get there.

The logarithm is particularly interesting in computer science because it's such a flat curve (as listed above, with input 1 million the base-10 version has a value of 6; even with base-2 it's less than 20) and an algorithm or data structure that's logarithm-ish ("divide and conquer" techniques such as a binary search or quick sort being prime examples) will tend to scale well.