[英]What is the difference between these two types of exponential in Python
請向我解釋它們之間的區別?
import math
print math.exp(2)
print
print 2 ** 3
===========================
7.38905609893
8
您正在使用math.exp(2)
平方e,e為2.71828183,請參見此處
隨着2 ** 3
,您將2提高到三次方。
您將math.exp()
與math.pow()
混淆了: math.pow(2, 3) == float(2**3)
。
math.exp(2)
是e
升高到第二電源, 2 ** 3
是2上升到第三功率。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.