how do you use visual basic to find cross product of two vectors

S

shg

Code
-------------------
Function vCP(v1 As Variant, v2 As Variant) As Variant
vCP = Array(v1(2) * v2(3) - v1(3) * v2(2), _
v1(3) * v2(1) - v1(1) * v2(3), _
v1(1) * v2(2) - v1(2) * v2(1))
End Function

-------------------

Returns a 1x3 variant containing the cross product of the two 3-elemen
row or column vectors.

Example usage:

=Cross(A1:C1,A2:C2)

Must be array-entered.

Kind regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top