# Re: dynamic vs. static typing

```"Peter J. Wasilko" <futurist@cloud9.net> writes:

>> Things like the `wedge product' from exterior algebra (thanks
>> to Greg Pettyjohn for showing me this) don't require the object types
>> to be known.
>
> I'll bite, what is a 'wedge product'?

I'll screw this up royally if I try to be really rigorous, so let me
handwave a bit.

You know when you take the determinant of a 2x2 matrix you multiply
the upper-left with the lower-right and subtract out the product of
the upper-right with the lower-left?  Now when you take the
determinant of a 3x3 matrix, you iterate over the topmost row element
by element, and take the determinant of the remaning rows *except* for
the column you are using for the topmost row, and you multiply and
flip signs, etc.  So there is this pattern of recursive multiplying and
sign flipping.

When you multiply complex numbers, you perform a similar traversal of
the real and imaginary parts (multiply the real parts and subtract out
the product of the imaginay).  When you multiply quaternions, you do a
similar traversal of all the various parts of the quaternion.

When you take the cartesian product of a couple of vectors, you do a
similar traversal of the various elements.

So the `wedge product' is an abstraction of the traversal process.  It
tells you what needs to be combined with what else, and in what order,
but *without* actually doing the combining (think of it as being
parameterized over the multiply operation.  Instead of putting an
`asterisk' in where you need to multiply, put in a `wedge' (a big one
of these: ^).)

Now if you want to rigorous, see:
http://mathworld.wolfram.com/WedgeProduct.html

The `Hodge *' operator is `the opposite' of the wedge product.  It
`fills in' the multiplication operator so you can eventually get some
numbers.

Now why would you want to do this?  Well, Greg was thinking of hacking
binary space partitions in higher-order dimensions.  (If you fold time
into the equation and represent co-ordinates as quaternions you can
generalize the `standard' 2 or 3 dimensional BSP to handle
time-dependent elements.)  To construct a binary space partition, you
need to split your space into two components with a hyperplane.  In 2
or 3 dimensions, it is easy to visualize what this means, but in 4
dimensions, it is hard.

The real hard part is determining whether something is to the `left'
or `right' of your hyperplane.  In 3 dimensions, you can take the
cross product of some basis vectors to find a `normal' and then see if
the normal points towards or away from you.  In 4 dimensions, though,
the cross product doesn't give you a normal vector, so you are screwed.

However, the `wedge product', which is a generalization of the cross
product, *does* work in higher dimensions.  It will give you a
`normal' vector, but in `wedge space'.  You use the `Hodge *' operator
with appropriate values to project this back into `normal'
4-dimensional space and this gives you your normal vector.

Greg is *very* good at demystifying this sort of mathematical
mumbo-jumbo.  (At least, after talking to him it actually seems to
make sense to me.  The mathematicians on the list can judge whether I
actually `got it' to any extent.)

```