log function

Can someone please explain to me in simple wording what log function does as this is not clear to me at all:

Returns the natural logarithm of x.


source: http://www.cplusplus.com/reference/clibrary/cmath/log/

By seeing example code on that page i can't observe any logical relation from output number given the input. I want to be able to understand what this function actually do.

Thank you for your time.
If you have the equation x = by then y is the logarithm of x to base b. The natural logarithm just means that the base is e http://en.wikipedia.org/wiki/E_%28mathematical_constant%29
There is also a function named log10 that use base 10.
I am sorry but i am just stupid and still not get it.


The natural logarithm just means that the base is e

wiki:
e = 2.71828

How can something have decimal as a base.

I can understand base 10 base 2 and 16
but how base can be 2.7.....???

1. log10 expects some number for parameter (that its base is 10)?
2. log expect number (where base is 2.718....) ?
3. log2 ... (base 2)?
When you have an exponentiation on the form by, b is called the base and y is called the exponent. What the log functions returns is the exponent. Don't confuse the word base with how it's used when talking about numeral systems (hex, dec, etc.). They mean different things.

It's just a matter of solving the equation.

x = 10y
y = log10(x)

x = 2y
y = log2(x)

x = ey
y = log(x)

These equations are usually not easy to solve by hand so that's why we can use the functions. As you probably have noticed we don't have a log function for arbitrary bases, so it's a hard problem to solve efficiently even for a computer.
Last edited on
Thanks
Topic archived. No new replies allowed.