0
我想獲得這種陣列的:由3創建新的多維數組
ves = np.zeros((6,5), dtype=object)
[array([ 0., 0., 0.]), array([ -9.19361118e-02, -5.62946325e-18, -9.95764908e-01]), array([ 0., 0., 0.]), array([ 9.19361118e-02, 5.62946325e-18, 9.95764908e-01])]
[array([ -4.02455846e-16, -2.46433132e-32, -1.00000000e+00]), array([ 4.02455846e-16, 2.46433132e-32, 1.00000000e+00]), array([ 0., 0., 0.]), array([ 0., 0., 0.])]
[array([ -1.32548132e-01, -8.11623230e-18, 5.20417043e-17]), array([ 6.07243954e-01, 3.71829682e-17, -4.38273008e-02]), array([ 0., 0., 0.]), array([ -4.74695821e-01, -2.90667359e-17, 4.38273008e-02])]
[array([ 9.89550969e-01, -1.21185043e-16, -1.44183494e-01]), array([ 0., 0., 0.]), array([ -9.89550969e-01, 1.21185043e-16, 1.44183494e-01]), array([ 0., 0., 0.])]
[array([ -6.17327484e-02, 7.56008127e-18, 4.86015631e-01]), array([ 1.32548132e-01, -1.62324646e-17, -0.00000000e+00]), array([ -7.08153840e-02, 8.67238333e-18, -4.86015631e-01]), array([ 0., 0., 0.])]
[array([ 5.84181997e-17, -9.58615055e-01, -0.00000000e+00]), array([ 2.36516717e-18, 6.64023184e+00, 0.00000000e+00]), array([ -6.07833668e-17, -4.96333856e-01, 0.00000000e+00]), array([ 0. , -5.18528293, 0. ])]
因此,我通過4 createa新陣列6我開始填充元素:
ves[0][0] = np.array([0,0,-1])
ves[0][1] = np.array([0,0,1])
ves[0][2] = np.array([0,0,0])
ves[0][3] = np.array([0,0,0])
ves[1][0] = np.array([0,0,0])
ves[1][1] = np.array([0,0,0])
ves[1][2] = np.array([0,0,0])
ves[1][3] = np.array([0,0,0])
並注意到我沒有得到預期的結果。
[ -1.00000000e+00 0.00000000e+00 -6.12323400e-17]
[ 1.00000000e+00 0.00000000e+00 6.12323400e-17]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
[ 0. 0. 0.]
....
我在做什麼錯?
它仍然是不一樣的。 – Monica
問題解決了。謝謝你幫助我! – Monica