本文共 1553 字,大约阅读时间需要 5 分钟。
向量余弦值python
Prerequisite:
先决条件:
Numpy is the library of function that helps to construct or manipulate matrices and vectors. The function numpy.cos(x) is a function used for generating a matrix/vector/variable with the cosine value of b x (as cos(x)). This is an element wise operation where each element in numpy.cos(x) corresponds to the Cosine of that element in x.
Numpy是一个功能库,可帮助构造或操纵矩阵和向量。 函数numpy.cos(x)是用于生成余弦值为bx的矩阵/向量/变量(作为cos(x) )的函数 。 这是一个元素明智的操作,其中numpy.cos(x)中的每个元素对应于x中该元素的余弦。
Syntax:
句法:
numpy.cos(x)
Input parameter(s):
输入参数:
x – could be a matrix or vector or a variable.
x –可以是矩阵,向量或变量。
Return value:
返回值:
A Matrix or vector or a variable of the same dimensions as input x with cos(x) values (between -1 and 1) at each entry.
与输入x尺寸相同的矩阵或向量或变量,在每个条目处具有cos(x)值(介于-1和1之间)。
Applications:
应用范围:
Machine Learning
机器学习
Neural Network
神经网络
Geometry
几何
Physics Problems
物理问题
# Linear Algebra Learning Sequence# Element Wise Cosine operationimport numpy as np# Use of np.array() to define an VectorV = np.array([323,.623,823])print("The Vector A : ",V)VV = np.array([[3,63,.78],[.315,32,42]])print("\nThe Vector B : \n",VV)print("\ncos(A) : ", np.cos(V))print("\ncos(B) : \n", np.cos(VV))
Output:
输出:
The Vector A : [3.23e+02 6.23e-01 8.23e+02]The Vector B : [[ 3. 63. 0.78 ] [ 0.315 32. 42. ]]cos(A) : [-0.83423998 0.81213169 0.99527249]cos(B) : [[-0.9899925 0.98589658 0.71091354] [ 0.95079638 0.83422336 -0.39998531]]
翻译自:
向量余弦值python
转载地址:http://pyxzd.baihongyu.com/