dask.array.tan
dask.array.tan¶
- dask.array.tan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'tan'>¶
此文档字符串是从 numpy.tan 复制的。
Dask 版本可能存在一些不一致性。
逐元素计算切线。
等价于
np.sin(x)/np.cos(x)逐元素操作。- 参数
- xarray_like
输入数组。
- 出ndarray, None, 或 ndarray 和 None 的元组, 可选
存储结果的位置。如果提供,它必须具有输入广播到的形状。如果没有提供或为None,则返回一个新分配的数组。一个元组(只能作为关键字参数)的长度必须等于输出的数量。
- 哪里类似数组, 可选
此条件通过输入进行广播。在条件为 True 的位置,out 数组将被设置为 ufunc 结果。在其他地方,out 数组将保留其原始值。请注意,如果通过默认的
out=None创建了一个未初始化的 out 数组,条件为 False 的位置将保持未初始化状态。- **kwargs
对于其他仅关键字参数,请参阅 ufunc 文档。
- 返回
- yndarray
对应的切线值。如果 x 是标量,则这是一个标量。
注释
如果提供了 out,函数将结果写入其中,并返回对 out 的引用。(参见示例)
参考文献
M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions. New York, NY: Dover, 1972.
示例
>>> import numpy as np >>> from math import pi >>> np.tan(np.array([-pi,pi/2,pi])) array([ 1.22460635e-16, 1.63317787e+16, -1.22460635e-16]) >>> >>> # Example of providing the optional output parameter illustrating >>> # that what is returned is a reference to said parameter >>> out1 = np.array([0], dtype='d') >>> out2 = np.cos([0.1], out1) >>> out2 is out1 True >>> >>> # Example of ValueError due to provision of shape mis-matched `out` >>> np.cos(np.zeros((3,3)),np.zeros((2,2))) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: operands could not be broadcast together with shapes (3,3) (2,2)