博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
向量余弦值python_向量/矩阵的余弦值打印(元素明智的操作) 使用Python的线性代数
阅读量:2530 次
发布时间:2019-05-11

本文共 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:

应用范围:

  1. Machine Learning

    机器学习

  2. Neural Network

    神经网络

  3. Geometry

    几何

  4. Physics Problems

    物理问题

Python代码打印向量/矩阵元素的余弦值 (Python code to print cosine value of vector/matrix elements)

# 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/

你可能感兴趣的文章
个人工作总结05(第二阶段)
查看>>
Java clone() 浅拷贝 深拷贝
查看>>
深入理解Java虚拟机&运行时数据区
查看>>
STUCTS LABLE ‘S BENEFIT
查看>>
Vue 计算属性
查看>>
第十八次ScrumMeeting博客
查看>>
洛谷P2580 于是他错误的点名开始了 题解
查看>>
02-环境搭建
查看>>
spring第二冲刺阶段第七天
查看>>
搜索框键盘抬起事件2
查看>>
阿里百川SDK初始化失败 错误码是203
查看>>
透析Java本质-谁创建了对象,this是什么
查看>>
BFS和DFS的java实现
查看>>
QQ是怎样实现好友桌面快捷方式的?
查看>>
hadoop之安装
查看>>
Xamarin.Android开发实践(六)
查看>>
物联网项目的思考
查看>>
IntelliJ IDEA设置不自动打开最后关闭的项目
查看>>
抽象类
查看>>
ARC 101E.Ribbons on Tree(容斥 DP 树形背包)
查看>>