完成作业“
;
This commit is contained in:
17
1.py
Normal file
17
1.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import numpy as np
|
||||
|
||||
# 定义向量
|
||||
A = np.array([3, 4])
|
||||
B = np.array([1, 2])
|
||||
|
||||
# 1. 计算A + B
|
||||
add_result = A + B
|
||||
print("A + B =", add_result)
|
||||
|
||||
# 2. 计算2 × A
|
||||
mul_result = 2 * A
|
||||
print("2 × A =", mul_result)
|
||||
|
||||
# 3. 计算A的长度(模)
|
||||
norm_A = np.linalg.norm(A)
|
||||
print("A的长度(模) =", norm_A)
|
||||
Reference in New Issue
Block a user