Matrix or vector norm
return one of eight different matrix norms, or one of an infinite number of vector norms (described below), depending on the value of the ord parameter.
np.linalg.norm(x, ord=None, axis=None, keepdims=False)
表示是否保持矩阵的二位特性
Clip (limit) the values in an array.
numpy.clip(a, a_min, a_max, out=None)
if a [ ] < a_min ----> a_min
if a [ ] > a_max----->a_max
between [a_min, a_max] ------> a [ ]
>>> a = np.arange(10) # 0 1 2 3 4 5 6 7 8 9
>>> np.clip(a, 1, 8)
array([1, 1, 2, 3, 4, 5, 6, 7, 8, 8]) # a被限制在1-8之间
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) # 没改变a的原值
>>> np.clip(a, 3, 6, out=a) # 修剪后的数组存入到a中
array([3, 3, 3, 3, 4, 5, 6, 6, 6, 6])
>>> a = np.arange(10)
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> np.clip(a, [3,4,1,1,1,4,4,4,4,4], 8)
# 当a_min为数组时, a中每个元素和都和a_min中对应元素比较
# 0 < 3 -->小于最小值 则等于3
# 3 > 2 -->大于最小值 则等于本身 再和最大值比 没超过最大值 所以为3
array([3, 4, 2, 3, 4, 5, 6, 7, 8, 8])
Return evenly spaced values within a given interval
numpy.arange([start, ]stop, [step, ]dtype=None, *, like=None)
numpy.arccos(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'arccos'>
import numpy as np
print('数组的反余弦值:{}'.format(np.arccos([1, -1])))
import matplotlib.pyplot as plt
x = np.linspace(-1, 1, num=100)
plt.plot(x, np.arccos(x), c='b')
plt.axis('tight')
plt.show()