python中exp_[转载] python numpy np.exp()函数

参考链接: Python中的numpy.exp

def exp(x, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__

"""

exp(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])

Calculate the exponential of all elements in the input array.

计算输入数组中所有元素的指数。

Parameters

----------

x : array_like

Input values.

out : ndarray, None, or tuple of ndarray and None, optional

A location into which the result is stored. If provided, it must have

a shape that the inputs broadcast to. If not provided or `None`,

a freshly-allocated array is returned. A tuple (possible only as a

keyword argument) must have length equal to the number of outputs.

where : array_like, optional

Values of True indicate to calculate the ufunc at that position, values

of False indicate to leave the value in the output alone.

**kwargs

For other keyword-only arguments, see the

:ref:`ufunc docs `.

Returns

-------

out : ndarray or scalar

Output array, element-wise exponential of `x`.

This is a scalar if `x` is a scalar.

输出数组,`x`的按元素指数。

如果x是标量,则这是标量。

See Also

--------

expm1 : Calculate ``exp(x) - 1`` for all elements in the array.

exp2  : Calculate ``2**x`` for all elements in the array.

Notes

-----

The irrational number ``e`` is also known as Euler's number.  It is

approximately 2.718281, and is the base of the natural logarithm,

``ln`` (this means that, if :math:`x = \ln y = \log_e y`,

then :math:`e^x = y`. For real input, ``exp(x)`` is always positive.

无理数``e''也称为欧拉数。

它大约是2.718281,并且是自然对数``ln''的底数

(这意味着,如果:math:`x = \ ln y = \ log_e y`,那么:math:`e ^ x = y

对于实际输入,exp(x)始终为正。

For complex arguments, ``x = a + ib``, we can write

:math:`e^x = e^a e^{ib}`.  The first term, :math:`e^a`, is already

known (it is the real argument, described above).  The second term,

:math:`e^{ib}`, is :math:`\cos b + i \sin b`, a function with

magnitude 1 and a periodic phase.

对于复杂的参数x = a + ib,我们可以写成:math:`e ^ x = e ^ a e ^ {ib}`。

第一项:math:`e ^ a`是已知的(这是上述的实参)。 第二项e ^ {ib}`是\ cos b + i \ sin b`,这是一个具有幅度1和周期相位的函数。

References

----------

.. [1] Wikipedia, "Exponential function",

http://en.wikipedia.org/wiki/Exponential_function

.. [2] M. Abramovitz and I. A. Stegun, "Handbook of Mathematical Functions

with Formulas, Graphs, and Mathematical Tables," Dover, 1964, p. 69,

http://www.math.sfu.ca/~cbm/aands/page_69.htm

Examples

--------

Plot the magnitude and phase of ``exp(x)`` in the complex plane:

在复平面上绘制``exp(x)``的大小和相位:

>>> import matplotlib.pyplot as plt

>>> x = np.linspace(-2*np.pi, 2*np.pi, 100)

>>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane

>>> out = np.exp(xx)

>>> plt.subplot(121)

>>> plt.imshow(np.abs(out),

...            extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='gray')

>>> plt.title('Magnitude of exp(x)')

>>> plt.subplot(122)

>>> plt.imshow(np.angle(out),

...            extent=[-2*np.pi, 2*np.pi, -2*np.pi, 2*np.pi], cmap='hsv')

>>> plt.title('Phase (angle) of exp(x)')

>>> plt.show()

"""

pass

示例结果:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值