I am wondering why the result of log base 10 (1.5)
in python = 0.405465108108 while the real answer = 0.176091259.
This is the code that I wrote:
import math print math.log(1.5)
Can someone tell how to solve this issue?
1. log(a,(Base)) : This function is used to compute the natural logarithm (Base e) of a. If 2 arguments are passed, it computes the logarithm of the desired base of argument a, numerically value of log(a)/log(Base). Syntax : math.
Python log2(x) is a built-in function used to get the logarithm of any given number with base 2. The log2(x) function is under the math library, so we need to import the math library to use the log2() function.
The log() function in Python calculates the logarithm of a number to the base or calculates the natural logarithm of a number if the base is not specified by the user. The following illustration shows the mathematical representation of the log() function. The math module is required in order to use this function.
From the documentation:
With one argument, return the natural logarithm of x (to base e).
With two arguments, return the logarithm of x to the given base, calculated as
log(x)/log(base)
.
But the log10 is made available as math.log10()
, which does not resort to log division if possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With