0

Python numpy library log method returning wrong value so please help me.

import numpy as np
print('Log :',np.log(0.25))

numpy log method returns -1.38629436112

Excel log function =LOG(0.25) returns -0.602059991327962 Then I Calculated manually using calculator it returns -0.602059991327962.

2
  • It is returning the base e log rather than the base 10 one. Commented Sep 25, 2017 at 13:12
  • You are confused with log_2, log_e and log_10 Commented Sep 25, 2017 at 13:12

1 Answer 1

5

Because the log function is in base e while your calculator and excel are base 10 by default. Use np.log10(0.25) and you'll get the value you want.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.