15 lines
237 B
Python
15 lines
237 B
Python
import numpy as np
|
|
|
|
A = np.array([3, 4])
|
|
B = np.array([1, 2])
|
|
|
|
A_plus_B = A + B
|
|
print("1. A + B =", A_plus_B)
|
|
|
|
two_A = 2 * A
|
|
print("2. 2 * A =", two_A)
|
|
|
|
norm_A = np.linalg.norm(A)
|
|
print("3. 向量 A 的长度 =", norm_A)
|
|
|
|
print("-" * 40) |