About 14,300 results
Open links in new tab
  1. logarithm - Log to the base 2 in python - Stack Overflow

    Sep 15, 2010 · Precise math.log(x, 2) in Python. 1. how to compute logarithms in Python not using math.log. 0. Write a ...

  2. math - Calculate logarithm in python - Stack Overflow

    Nov 17, 2015 · I am wondering why the result of log base 10 (1.5) in python is 0.405465108108 while the real answer is 0.176091259. This is the code that I wrote: import math print math.log(1.5) Can someone tel...

  3. math.log in Python - Stack Overflow

    Feb 8, 2013 · math.log uses floats and these almost always involve some rounding errors. >>> math.log(1000, 10) 2.9999999999999996 If you need it to be exact you should change your algorithm to generate the powers of 10 (simply multiply the last power by 10) and continue as long as the new power is smaller than your input number.

  4. ln (Natural Log) in Python - Stack Overflow

    math.log is the natural logarithm: From the documentation: math.log(x[, base]) With one argument, return the natural logarithm of x (to base e). Your equation is therefore: n = math.log((1 + (FV * r) / p) / math.log(1 + r))) Note that in your code you convert n …

  5. math - Inaccurate Logarithm in Python - Stack Overflow

    May 31, 2009 · I work daily with Python 2.4 at my company. I used the versatile logarithm function 'log' from the standard math library, and when I entered log(2**31, 2) it returned 31.000000000000004, which stru...

  6. Get logarithm without math log python - Stack Overflow

    Nov 3, 2012 · This shows our value compared to the math.log value (separated by a space) and, as you can see, we're pretty accurate. You'll probably start to lose some accuracy as you get very large (e.g. ln(10000) will be about 0.4 greater than it should), but you can always increase n …

  7. using math.log(var) in python - Stack Overflow

    But how do I convert this back into 0.0000000000001? and how i'd handle it when using math.log(0.0000000000001)? Both ways, the fundamental, arithmetic one and the one using a built-in python function would interest me.

  8. c# - What happens in numpy's log function? Are there ways to …

    May 10, 2017 · Which is why math.log is faster for scalars compared to numpy.log. But if you operate on arrays and want to take the logarithm of all elements in the array NumPy can be much faster. On my computer if I time the execution of np.log on an array compared to math.log of each item in a list then the timing looks different:

  9. Calculating Logarithms with Python - Stack Overflow

    Mar 27, 2012 · I am trying to calculate logarithms using the math module of python (math.log(x,[base]), however when I use float(raw_input) for the x and base values, it gives me the error, ZeroDivisionError: float division by zero. x = 9.0 base = 3.0

  10. Python math module logarithm functions - Stack Overflow

    Jan 29, 2013 · Possible Duplicate: Inaccurate Logarithm in Python Why are the math.log10(x) and math.log(x,10) results different?

Refresh