是否有與R的logspace_add函數相當的python?Python的等價於R的logspace_add函數?
2
A
回答
4
以及有一個功能
math.log1p(x)
返回1 + X(以e爲底)的自然對數。計算結果的方式對於接近零的x是準確的。
否則,如果您使用numpy的,你可以使用
numpy.logaddexp(logA, logB)
1
你可以讓你自己...?
import math
def log_add(x,y):
res = math.log(math.exp(x) + math.exp(y))
return res
+1
否 - 用戶詢問此功能的原因很可能是因爲他們希望避免浮溢。儘可能長時間地保持某種「統計空間」的統計程序(處理對數概率而不是概率)避免了這個問題。 概率之間的近似總和與對數概率是非常有用的。 – EML 2013-07-05 00:31:10
相關問題
- 1. 等價於R中的MatLab「bar」函數?
- 2. 在Python中,R的「phyper」函數等價於什麼?
- 3. Python等價於Ruby的包函數
- 4. Python的等價函數lsqcurvefit()函數
- 5. 等價於R中的normxcorr2?
- 6. fromCharCode()等價於R
- 7. 什麼是Python函數scipy.sparse.bmat的R等價物?
- 8. 在R中有沒有python等價的get_map函數?
- 9. Python的等價物的MATLAB psf2otf函數
- 10. Java等價於ntohll函數
- 11. file_get_contents等價於curl函數
- 12. Fortran等價於numpy.where()函數?
- 13. Dojo等價於jQuery.text函數?
- 14. Ruby的等價於PHP的「get_defined_vars」函數?
- 15. Ruby的等價於PHP的ucfirst()函數
- 16. python等價於MATLAB的mxCreateDoubleMatrix
- 17. 等價於python「dir」的Java?
- 18. Python等價於Mathematica的ArrayPlot?
- 19. Python等價於Mathematica的「LaguerreL」
- 20. Perl的等價於python exec?
- 21. C#等價於python的struct.pack
- 22. python等價於ruby的__method__?
- 23. C++等價於Python的doctests?
- 24. python等價於MySQL的IFNULL
- 25. python等價於ruby的StringScanner?
- 26. Ruby等價於Python的DictWriter?
- 27. PHP等價於Python的requests.get
- 28. python等價於ruby的`map.with_index`?
- 29. C#等價於Python的os.path.exists()?
- 30. Matlab imfilter在Python中的等價函數
查看http://docs.python.org/2/library/math.html – 2013-05-11 17:30:07