首页 > 编程知识 正文

python向量与矩阵,python获取向量的行列数

时间:2023-05-04 18:03:03 阅读:228586 作者:4225

python 向量二范数

Prerequisite:

先决条件:

Defining Vector using Numpy

使用Numpy定义向量

Here, we are going to learn how to find the norm of a vector using an inbuilt function in numpy library?

在这里,我们将学习如何使用numpy库中的内置函数找到向量的范数?

向量范数的Python代码 (Python code for norm of the vector) # Linear Algebra Learning Sequence# Outer Product Property Iimport numpy as npa = np.array([2, 4, 8, 7, 7, 9, -6])b = np.array([2, 3, 1, 7, 8])#outer product in both orderma = np.linalg.norm(a)mb = np.linalg.norm(b)print('A : ', a)print('B : ', b)print('nnNorm of A : ', ma)print('nnNorm of B : ', mb)

Output:

输出:

A : [ 2 4 8 7 7 9 -6]B : [2 3 1 7 8]Norm of A : 17.291616465790582Norm of B : 11.269427669584644

翻译自: https://www.includehelp.com/python/norm-of-the-vector.aspx

python 向量二范数

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。