Hey! I am currently working on a project where I have to use logarithms. I didn’t study them at school yet and would like to know how these work. Do you have any videos/documents that can explain how to use them and what they do? Thanks!

A logarithm is the inverse of a power. You’ll always find logarithms with this pattern: `log(x)`

.

Logarithms are essentially finding the amount of times X has been powered to by its base (aka **exponent**).

A logarithm has a **base**, this is, the base number (**2**^3), and X (the result from the power, in this case, 8.) The base number is written below `log`

, and if not declared, it’s usually the e number, or 10.

Now, we won’t go in how to calculate logarithms, but essentially:

- If 2^3 = 8, then the logarithm will be represented as
`log2(8) = 3`

.

In Lua, `math.log`

takes its base as `e`

, the irrational number 2.78. `math.log10`

is essentially a logarithm with base 10.

For example:

```
function a()
return math.log10(100)
end
local b = a() -- 2, as 10^2 = 100
```

In short, it’s the inverse of a power.

Well sorry if other programmers see this horrid explanation, I didn’t study this in English.

For sources, literally, everywhere. YouTube, Google, they all exist. You can even ask ChatGPT, that is.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.