How can you calculate the dot product of two vectors?
In ANSYS, Release 10.0, you can use *VOPER to calculate the dot product of two vectors. The i,j,k values for each vector are stored in rows of an array. The scalar result is then stored in another array. See the example below. ! Dot product (a.b) of 2 vectors ! a.b = (ai*bi) + (aj*bj) + (ak*bk) ! This test case has 4 vectors ! Vector 1 = 1i + 1j + 1k ! Vector 2 = 2i + 2j + 2k ! Vector 3 = 1i + 2j + 3k ! Vector 4 = 4i + 5j + 6k ! Vector 1 is stored in row 1 of a1 ! Vector 2 is stored in row 2 of a1 ! Vector 3 is stored in row 1 of a2 ! Vector 4 is stored in row 2 of a2 *dim,a1,,2,3 *dim,a2,,2,3 *dim,a3,,2,1 *dim,a4,,2,1 a1(1,1) = 1,2 a1(1,2) = 1,2 a1(1,3) = 1,2 a2(1,1) = 1,4 a2(1,2) = 2,5 a2(1,3) = 3,6 ! Take the dot product of vectors 1 and 3 ! and store the scalar result in a3(1,1). ! Also, take the dot product of vectors 2 ! and 4, and store the result in a3(2,1). /com, /com, V1.V3 = a3(1) = 1*1 + 1*2 + 1*3 = 6 /com, /com, V2.V4 = a3(2) = 2*4 + 2*5 + 2*6 = 30 /com, *voper,a3(1),a1(1),dot,a2(1) *status,a3,1,2,1,1 ! Take the dot product of vectors 2 and 4 ! and store the result in a4(2,1). /com, /com, V2.V4 = a4(2) = 2*4 + 2*5 + 2*6 = 30 /com, *voper,a4(2),a1(2),dot,a2(2) *status,a4,2,2,1,1 

