import numpy as np# 创建一个简单的 1D 数组a = np.array([1, 2, 3])# 创建一个多维数组b = np.array([[1, 2, 3], [4, 5, 6]])# 获取数组的形状print("Shape of array b:", b.shape)# 计算两个数组的点积c = np.dot(a, b[0]) # a 和 b 的第一行相乘print("Dot product of a and first row of b:", c)# 使用广播机制将标量加到每个元素上d = a + 5print("Adding scalar to each element in a:", d)