Print Story I have nothing to say.
Diary
By i (Sat May 01, 2004 at 02:25:17 AM EST) (all tags)
So I pst px (kthx).


Place x0, time t0.

Place x0+δx, time t1.

It all depends on perspective (and available light).

< Bleargh | BBC White season: 'Rivers of Blood' >
I have nothing to say. | 13 comments (13 topical, 0 hidden) | Trackback
Maths Question by codemonkey uk (3.00 / 0) #1 Sat May 01, 2004 at 03:03:05 AM EST
I know how to calculate the cross product of a 3d vector, but do you know if this can be generalised to an N-dimentional vector. I don't really understand the theory behind the code, and google isn't helping...

--- Thad ---
Growing a mustache for charity.


AFAICT no. by i (5.00 / 1) #2 Sat May 01, 2004 at 03:14:37 AM EST
It can't be generalised to arbitrary N. There's a 7-dimensional construction, but that's about it.

Why do you need a generalisation?


[ Parent ]

I don't *need* one by codemonkey uk (3.00 / 0) #4 Sat May 01, 2004 at 03:19:22 AM EST
I've been sitting here tidying up and refactoring the geometry code for my toy project so that Vector2d<T> and Vector3d<T> are based on a common VectorN<T,N> base, as I'd noticed a lot of common code. CrossProduct only existed for the 3d version, and I was just wondering if there was a way to generalise it and put it in the common base.

--- Thad ---
Growing a mustache for charity.
[ Parent ]

There's 2D cross product. by i (3.00 / 0) #7 Sat May 01, 2004 at 05:29:04 AM EST
But it's not a vector, it's a scalar: x1y2 - y1x2. I.e. it's the the same as the z coordinate of a 3D cross product. Dunno if you can put it to the common base; I wouldn't bother.


[ Parent ]

As i says: no by spcmanspiff (3.00 / 0) #8 Sat May 01, 2004 at 06:16:44 AM EST
What I started to do in my (unfinished) vector math library was to implement cross product in terms of 'orthogonality' -- e.g., AxB returns C where:

  • C is orthogonal to A and B
  • A,B, and C taken together can be used as bases (basises?) for a space of however many dimensions we're working in.

Examples:

In 2d, the "cross product" of any vector is another, perpendicular vector. Of any two: undefined (unless they happen to be parallel).

In 3d: one vector -> plane (two vectors); two vectors -> one vector (our familiar cross product); three vectors -> undefined

In 4d: one vector -> 3-space; two -> plane; three -> vector; four -> undefined

Etc.

It seems like a nice intuitive way of dealing with this, but it doesn't translate into fast templated C++ very well at all. Also, my maths suck and there are lots of annoying details like choice of handedness and facts like there are infinite ways of defining the same plane; and the fact that where I say "plane" or "3-space" above I don't mean an actual plane or 3-space, just as a vector is not the same as a line --- just don't know the right word for the equivalent higher-dimensional things.

There was an article or two on K5 way back, about geometric algebra, (by adiffer, I think?) that seem to approach the same topic but using complicated words and concepts that go way beyond my nonexistent math education.

The first is here:
http://www.kuro5hin.org/story/2002/9/7/11112/27943

[ Parent ]

Maths Education by codemonkey uk (3.00 / 0) #10 Sat May 01, 2004 at 07:08:20 AM EST
Yeah, my math theory is basically non existent as well. I did A level math and scraped by with a D. Ho wI wish I'd studied more! The development of my geometry library is determined by two simple demands. The functionality need of my toy app, and my own need for elegance. Thus, it is far from complete, but what there is, is, in my opinion, well engineered. It compiles now. I just have to find the bug... Watch my diary for updates. ;)

--- Thad ---
Growing a mustache for charity.
[ Parent ]

Generalized cross product by tmoertel (3.00 / 0) #13 Sun May 02, 2004 at 04:25:38 PM EST
There is a generalized cross product, but it is defined only for certain cases (e.g., when you are crossing n - 1 vectors of length n). Mathematica implements it as Cross. Performing a Google search on "generalized cross product" yields a few useful hits, including a short text document on the subject.

Have fun with the template metaprogramming.

--
Write Perl code? Check out LectroTest. Write markup-dense XML? Check out PXSL.

[ Parent ]

Waking up hungover on anti-anxiety meds by Random Liegh (3.00 / 0) #3 Sat May 01, 2004 at 03:16:32 AM EST
is truly t3h sux0r.

um, just FYI, I guess.



You're really not supposed to drink by webwench (6.00 / 1) #5 Sat May 01, 2004 at 03:56:27 AM EST
on some of those anxiety meds. However, since they heighten the effects of the alcohol, well, it can be kinda fun to do it anyway.


[ Parent ]

um...I don't drink. by Random Liegh (6.00 / 1) #6 Sat May 01, 2004 at 04:16:59 AM EST
The hangover is 100% vistiral (the med in question). Which is why I only take it once every 5 months or so.

[ Parent ]

Red Sea, or the Med? by ti dave (3.00 / 0) #9 Sat May 01, 2004 at 06:28:04 AM EST
I'm a bit alarmed that I don't see any sandbags.

I don't care if people hate my guts; I assume most of them do.
The important question is whether they are in a position to do anything about it. --W.S. Burroughs



Med. by i (6.00 / 1) #11 Sat May 01, 2004 at 07:50:15 AM EST
Sandbags:

Not the best arrangement around, he-he :)


[ Parent ]

Good idea! by ti dave (3.00 / 0) #12 Sat May 01, 2004 at 08:13:17 AM EST
Can't have a drafty tent!

I don't care if people hate my guts; I assume most of them do.
The important question is whether they are in a position to do anything about it. --W.S. Burroughs

[ Parent ]

I have nothing to say. | 13 comments (13 topical, 0 hidden) | Trackback