Function Macro to Calculate the Cross Product in ExcelID: Q72141
|
This article explains how to create a function macro that calculates the cross product of two arrays, or vectors. The function macro in this article takes two arrays (three rows by one column) of numbers, each representing a vector, and returns an array of the same dimensions representing the cross product of the two vectors.
The cross product, c = a x b, of the vectors a and b is a vector that is
perpendicular to the plane of a and b. It can be illustrated by the
following table:
i j k
=========
c = a x b = m n o = [(n*z)-(o*y)]i - [(o*x)-(m*z)]j + [(m*y)-(n*x)]k
x y z
A1: Cross_Product
A2: =RESULT(64)
A3: =ARGUMENT("Vec1",64)
A4: =ARGUMENT("Vec2",64)
A5: =INDEX(Vec1,2,0)*INDEX(Vec2,3,0)-INDEX(Vec1,3,0)*INDEX(Vec2,2,0)
A6: =INDEX(Vec1,3,0)*INDEX(Vec2,1,0)-INDEX(Vec1,1,0)*INDEX(Vec2,3,0)
A7: =INDEX(Vec1,1,0)*INDEX(Vec2,2,0)-INDEX(Vec1,2,0)*INDEX(Vec2,1,0)
A8: =RETURN(A5:A7)
A1: Name of macro
A2: Specifies that the macro will return an array.
A3: The array specifying the first vector.
A4: The array specifying the second vector.
A5: Calculate the first array value.
A6: Calculate the second array value.
A7: Calculate the third array value.
A8: Return the values in A5:A7.
=Cross_Product(A1:A3,B1:B3)
A1: 1 B1: 4 C1: -3
A2: 2 B2: 5 C2: 6
A3: 3 B3: 6 C3: -3
Microsoft Excel Help, version 5.0
"Function Reference," version 4.0, pages 24-25, 238
"Function Reference," version 3.0, pages 15, 128-129
Additional query words: 3.0 4.0 5.0 Vector Plane
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: March 21, 1999