h a l f b a k e r y
Sugar and spice and unfettered insensibility.

meta:

account: browse anonymously, or get an account and write.

 user: pass:
register,

# Rotaty cube

Rubicky
 (+8) [vote for, against]

OK. So, this invention is really just an excuse to continue a topic that came up on another thread. It's more of a mathematical question, but I'll embody it in a puzzle.

I'd love to make the puzzle in hardware, but I don't think it is physically possible. So, we'll assume that the puzzle is on a computer screen.

The puzzle consists of a cube. It's not very exciting. It's a solid cube with no movable parts, and all the faces are the same colour.

Through the faces of the cube are drawn three axes (front to back, left to right, top to bottom) in different colours (red, green, blue).

If you left-click on the blue axis (for instance), the cube rotates clockwise around the blue axis by 45 degrees. If you right click on the blue axis, the cube rotates anticlockwise around the blue axis by 45 degrees. Likewise, clicking on any of the other axes causes the cube to rotate by 45 degrees clockwise or anticlockwise about that axis.

(The axes turn with the cube, of course, as if they were real metal rods running through the cube.)

The computer will allow any sequence of moves, with the exception that you cannot rotate around the same axis twice in succession. (This means that you can't turn the cube by 90 degrees in any direction; and you can't undo one rotation with a subsequent reverse rotation.)

The aim of the puzzle is to return the cube to its original orientation.

You might think that this was easy. For instance, turn "up" then "left" then "down" then "right", and you're back to where you started.

But no. After you've turned "up" by 45°, your subsequent "left" rotation now turns you not just left, but also up (because the axis around which you're now turning was shifted by 45° in the first move). Then the "down" rotation doesn't undo the original "up" rotation, and you quickly find that you're screwed.

My contention (based on nothing at all) is that there is no sequence of 45° rotations which will restore the original orientation of the cube exactly.

 — MaxwellBuchanan, Jul 20 2011

16384 rotations http://i923.photobu...ulHDear/16kcube.jpg
Cube, rotated by 45° 16384 times, about X/Y/Z axes in random order. No signs of a limit to complexity yet... [MaxwellBuchanan, Jul 21 2011]

Rotated cubes http://i923.photobu...1-07-21at201321.jpg
Unrotated on the left. After rotating by 45° around each of two axes (middle). And, on the right, after a further 45° rotation around the third axis. Note how screwey the angles of the last cube are (bottom right of image) already. [MaxwellBuchanan, Jul 21 2011]

For Daseva (View1) http://i923.photobu...1-07-22at190047.png
[MaxwellBuchanan, Jul 22 2011]

Basic rotational matrices http://en.wikipedia...rix#Basic_rotations
[Ling, Jul 26 2011]

I suspect your contention is innacurate, based on nothing but a guess.
 — RayfordSteele, Jul 21 2011

My contention (based on the fact that with 90° angles there's 24 different positions) is that there's 336 possible orientations.
 — FlyingToaster, Jul 21 2011

This shouldn't be too hard to program. I might look into it at the weekend.

 The two contentions posted would suggest that one of them is wrong.

 Contention N#1 My contention (based on nothing at all) is that there is no sequence of 45° rotations which will restore the original orientation of the cube exactly.

 Contention N#2 My contention (based on the fact that with 90° angles there's 24 different positions) is that there's 336 possible orientations.

 Or, to knock-off the rough edges - contention 1 is stating that there is an infinite number of orientations that the cube can have, while contention N#2 says that there are a finite number of orientations.

If there are indeed a limited number of orientations, then the original contention must be false.
 — zen_tom, Jul 21 2011

 I'd be a little surprised if, say, (+blue,+green)^(8*i), for some integer i, didn't get you back where you started. I'd also be interested to know where it *did* get you.

 What would be the most economical way of defining the state of the cube after each move? To avoid confusion with the colours of the axes, we could postulate a luminous octarine dot on the upper left vertex of the face that starts off facing the player. There's no translation, only rotation around an origin. So, we could imagine trying to track that dot back to its starting point in an invariant co-ordinate system, x/y/z, relative to which we're changing the red/green/blue axes.

 So as not to lose track of our chirality, we'll have to imagine a blue clock face painted on the initial top of the cube, a red clock face on the initial front and a green clock face on the initial left. Don't worry, imaginary paint washes out easily.

 If we imagine the cube as measuring two units on a side, then the initial position of the luminous octarine dot is (-1, -1, 1).

 After the first +blue, the position of the dot becomes (-(1/sin45), 0, 1). The blue axis is still the line (x=0,y=0), the green axis is now the line (y=-x,z=0).

 ...

More advanced students may suppose that the dot is beige.
 — pertinax, Jul 21 2011

 Hmm, I'm not very good at this - I'm going to have to backtrack from my earlier infinite vs finite proof. It could be like a chessboard where only a diagonal move is possible and you're limited to the same colour squares as the one you started on.

 Back to you pertinax - and finding a way to express each position in as simple a way as possible - and from there, we can try to determine whether that layout can be divided up into distinct and parallel domains from one another.

 And following on from that, does it help if we imagine the cube as having 3 dimension-specific on/off bits. So it can either be x-square, x-skewed, y-square, y-skewed, z-square or z-sqewed. Each 45 rotation will toggle one of those binary statuses on or off. (Hmm, come to think of it, no, each rotation will cause at least one, and at most...two to toggle? )

So, if the cube starts off square in all dimensions, and has to return to being square in all dimensions, then one condition of solving the puzzle is that the number of rotations must be an even number...at least I think so.
 — zen_tom, Jul 21 2011

 There are at least two sequences that return to the original position, but one is the trivial solution and one is it's complement.

The trivial is reversing the original sequence obviously, but practically repeating the original sequence in reverse (not the same thing) will do it as well (for a 45 degree angle basis). That is if your sequence is +45x, +45y +45z, both -45z, -45y, -45x and +45z, +45y, +45x will bring the cube back to square. It will be out rotationally, so if you want to enforce that as well a series of two moves around each axis may be required.
 — MechE, Jul 21 2011

 MechE - ah, but doesn't that break the rule:

 //you cannot rotate around the same axis twice in succession//?

After establishing a 3-twist wayout ending on a z-twist, your return starts with another z-twist on the way back in, which wouldn't be allowed.
 — zen_tom, Jul 21 2011

 I'm not gonna stake money on the 336, but no matter how many hours are spent twisting the thing around, it can always be returned to the original position, or moved to any other position, with a maximum of one twist of 45/90/135/180degrees (either way) per axle, ie: 3 twists at most.

  //you cannot rotate around the same axis twice in succession// Doh! >_<

But that doesn't change things. I'll guess again that there's a maximum of 12 individual twists to move from any point A to any point B.
 — FlyingToaster, Jul 21 2011

 //you cannot rotate around the same axis twice in succession//

 Missed that bit, so yes, the trivial solutions are both eliminated.

However even if it's ignored //it can always be returned to the original position, or moved to any other position, with a maximum of one twist of 45/90/135/180degrees// isn't true. The problem is that the first twist is 45 degrees in one of the original axes. The second twist, however, is something like half that in one of the original axes and half in another. The third might be 2/3 1/3, and so on. Each twist rapidly has the chance to put a smaller and smaller portion of it's rotation around a given original axis. It's definitely true that 3 twists could undo it, but I don't believe 3 twists of a defined angle can.
 — MechE, Jul 21 2011

 Why not ? there really is only a limited number of positions.It's commutative: +x -y +x +z = +x +x +z -yIt's additive: +x +z -y +z -x +z +x -z = +x -y ++z It's circulative: ++++++x = --xIt's sphericalative: ++++x = ++++y ++++z

 A long string of twists can be reduced to lx my nz where each of l m n has 8 possible values.

 So a single multi-twist along each of the three axes should move it from any position abc to any position def.

With the rule in place there's a maximum of 9(?) [edit: probably 11 or 12] moves from any position A to any position B. Not that a person's spatial awareness would necessarily be up to it of course. My math awareness isn't.
 — FlyingToaster, Jul 21 2011

It is not commutative.
 — MechE, Jul 21 2011

 If I walk two paces forward and two paces to the left it's the same as walking two paces to the left and two paces forward.

wait.... hmm...
 — FlyingToaster, Jul 21 2011

 //My contention (based on the fact that with 90° angles there's 24 different positions) is that there's 336 possible orientations.//

 Nope, because the rotations compound. Once you've turned 45°, you've also turned the axes (which, as I mentioned in the idea, turn with the cube - like solid axles passing through it), so your next turn is not a simple 45° turn w.r.t the world, but only w.r.t the cube itself.

 //any number of rotations can be expressed as two rotations.// Yes, but not if the rotations can only be 45°, and can only be about the three axes of the cube. I suspect (and this is only a gut feeling) that the net rotation achieved by two 45° rotations about orthogonal axes will be incommensurably with 45° (ie, no number of pairs of rotations will together add up to exactly 45°).

 If nothing else, pi or sqrt(2) ought to come into this, and they are irrational numbers, meaning that you can't solve the puzzle. Ever.

 // 336 possible orientations.// No - there at least many more than that. The attached image was created in C4D by rotating a cube by 45° around one of its three axes over and over again. (I actually used a branching algorithm, but all rotations are 45°). I cannot swear that there aren't two superimposed cubes there (in fact, my algorithm didn't exclude direct reversals of previous rotations, so there will be), but there are certainly more than 336 orientations.

 If anyone has C4D or a similar program, you can try this yourself. Just make sure that (a) your axes are locked to the cube itself, not the world and (b) you rotate by only 45° at each step (in C4D you can enter rotations numerically, or hold down shift to rotate by multiples of 5°) and (c) you don't use the same axis twice in a row. I defy anyone to return the cube to its unrotated state (or even to a state orthogonal to that).

 [pertinax] I think I follow you. You mean, in effect, put the cube inside a sphere, and just track the position on the sphere where a specific cube-corner makes contact? Yes, interesting. But I don't think an argument from that shows that the puzzle is soluble.

 //It could be like a chessboard where only a diagonal move is possible...// I don't think so - that's a sort of integer puzzle. I think the insolubility of this puzzle (if such is the case) will come down to incommensurability.

 //if your sequence is +45x, +45y +45z, both -45z, - 45y, -45x and +45z, +45y, +45x will bring the cube back to square.// Yes but, as you noted, simple reversals are excluded, as are consecutive rotations on the same axis (ie, you can't do +45z, - 45z and you can't do +45z+45z.

 //I'll guess again that there's a maximum of 12 individual twists to move from any point A to any point B// No, because _the axes move_ with the cube. Suppose you tilt the cube toward you (by 45°). You then turn it about what was the vertical axis. Think about where the other two axes wind up after that second turn - they've each turned through 45°, but on a plane which is tilted toward you at 45°, which I *think* means that they've turned something like 45°/[sqrt2] horizontally and vertically. The numbers just become irrational almost immediately, which means they're incommensurable with whole-number angles, which means there's no solution.

//It's commutative// It really isn't. That's why quaternions were invented. I thought it was commutative too, until (long time ago) I had to write software to do compound rotations, and it isn't at all commutative (if you move an axis, then rotate around it, it's not the same as rotating around it then moving it). It's really easy to appreciate this if you have modelling software and can do the turns on screen. You can *just about* see the non-commutativity if you hold and turn a real cube.
 — MaxwellBuchanan, Jul 21 2011

 //If I walk two paces forward and two paces to the left it's the same as walking two paces to the left and two paces forward. //

 Yes, of course. But not when you're rotating through non-right-angles.

Hang on - I'll do a picture.
 — MaxwellBuchanan, Jul 21 2011

 OK. In the second link is a screenshot from C4D. It shows three cubes which were initially identical, all viewed face-on (ie, there's no perspective distortion).

 The first one is un-rotated (so you can only see the front, green face). The second one has been rotated by 45°twice (once around one axis, the second time around a different axis). So far so good.

 The third one is identical to the second one, except that I've now made an additional THIRD rotation, also of 45°, around the third axis (the axis sticking out of the brownish coloured face). I've selected this third cube, and the arrows indicate its axes after these three rotations.

 You can see that it's at a screwy angle. Also, if you look at the lower right of the screen, you'll see the three angles which represent the orientation of that third cube. They bear no simple relationship to 45°, even after only three rotations.

It's a beautiful problem. What I mean is that simple rotation around orthogonal axes is not at all simple and makes you (me) laugh. I'm sure it's old hat to mathematicians, but it tickles me.
 — MaxwellBuchanan, Jul 21 2011

 No, my entire point is that the axes are, indeed, relative to the cube. If you look at the C4D screenshot, you'll see that (you'll also see it if you re-read the idea as posted).

If anyone can tell me how to make a "screenshot movie" on a Mac, I'll show you "live" and you can see exactly how the axes rotate, locked to the cube.
 — MaxwellBuchanan, Jul 21 2011

If he were rotating around the system axes, there woudl be only 8 possible positions. (assuming all faces are identical). The fact that he shows more is accurate because the rotations compound. I don't have a conveinient way to automate it, but I am certain that +45x, +45y, -45x,-45y does not sum to zero (having modeled that far in CAD).
 — MechE, Jul 21 2011

 Thanks, [MechE].

 [Bigs] I appreciate what you're getting at, and my first thought was that of course, obviously, it's all commutative. But it isn't, and there's a huge literature on it (much of it related to 3D movement in computer games, which are usually handled by quaternion maths). It's so counterintuitive that it's beautiful.

The point of my puzzle is to go one step further, and argue that the products of compound rotations are irrational (ie, you can't use a series of rotations, following the rules I gave, to produce an overall rotation which is a rational number of degrees; and, therefore, you can't restore the original orientation).
 — MaxwellBuchanan, Jul 21 2011

 3 things:

 a) "That makes me so angly!!!"

 b) Okay, who punched all these holes in my tennis ball..

c) You'e been hanging around [Vernon] again, haven't you.
 — FlyingToaster, Jul 21 2011

 Label the axes i,j,k. I don't know why, just do it.

 i + j + k = 3 (initial states all have value of 1)

 We first develop a notation to express a rotation around any given axis. This is shown below, notice pi notation is used (All angles can be expressed in terms of a full circle being 2pi).

 Rot(i) = jpi/4 +kpi/4 Rot(j) = ipi/4 + kpi/4 Rot(k) = jpi/4 + ipi/4

 Find sequences of additions and subtractions of the Rot functions such that we return to the equation. No Rot function can be used twice in a row.

 Well, I can just trial and error a few rotations using this notation:

 i + j + k = Initial Conditions Rot(i) = i + j(pi/4+1) + k(pi/4+1) Rot(j) = i(pi/4+1) + j(pi/4+1) + k(pi/2+1) Rot(k) = i(pi/2+1) + j(pi/2+1) + k(pi/2+1)

 This shows us that a single rotation in each axial direction definitely does not lead us to inital values, or some 2pi multiple of them. But it does lead us to a pi/2 multiple of each one equally. Therefore, if we perform this trick 8 times over we will have pi/2*8 or 2pi rotations in each axis, which equals a full turn in each axis bringing us to our initial conditions and thus one definite solution.

One answer then is 3*8 = 24 rotations. It may not be the lowest possible number.
 — daseva, Jul 21 2011

Aha! A proper mathematician! I can tell you are, because I can't follow it.
 — MaxwellBuchanan, Jul 21 2011

 //topic that came up on another thread/

I suspect it was Whitworth...
 — not_morrison_rm, Jul 21 2011

//24 rotations. It may not be the lowest possible number.// 12 (at most most): you can go forward or backward.
 — FlyingToaster, Jul 21 2011

FT, backwards of course! I may have to write it out later just to be sure. Will you have equally offset rotations when you get to 6 and turn back around?
 — daseva, Jul 21 2011

My brain still thinks the sequences are commutative even though I just demonstrated to myself that it isn't. But I still don't think it goes into root2, pi stuff, or if it does it comes right back out again.
 — FlyingToaster, Jul 22 2011

Okay, sometimes you guys blow me away. Ima go stick two pieces of metal together.
 — Alterother, Jul 22 2011

How about simplifying things, by only allowing x and y rotations? Then trace the line one corner draws on the surface of a sphere. Make it even simpler by only allowing positive rotations, now there is a single permitted track. “We” should be able to come up with the mathematical description of this track pretty quick, and then we’ll see if it is a solvable equation or not.
 — pocmloc, Jul 22 2011

[daseva] you're saying that rotating x, y and z in that order, 8 times, all in the same direction, will restore the orientation? I'll give it a go.
 — MaxwellBuchanan, Jul 22 2011

[MB], that is my contention. I lost some sleep last night trying to figure out where I'm going wrong. Please let me know what you find if you model this solution.
 — daseva, Jul 22 2011

 [Daseva] No, I still leave the cube skewed after 8 cycles. But before I try again (I may have messed up somewhere) let me check my definition and yours are the same.

 In the third link is a picture of where I start. There's a cube and, to keep track of the orientation, there's a ball "welded" to one corner. I'm rotating the ball and the cube as one item - the ball is just a marker.

 The centre of rotation is in the centre of the cube. On the screenshot, you can see a sort of circular "cage" of red, blue and green - I can grab any one of these circles to rotate the cube (with the ball) around one of the three axes.

 Now to clarify that we agree on what we mean by "direction" of rotation. In the screenshot, you'll see that the R/G/B circles intersect to form a sort of bulgey triangle surrounding the ball. I'm saying that positive rotation corresponds to rotation anticlockwise around that triangle. In other words, with the cube in its present orientation, positive rotation would be downward for the red segment, rightward for the green, or upward for the blue (as viewed).

 The operation I did, to test your argument, was as follows:

 1) Drag the red axis through 45° (positively). (NB, holding down 'shift' constrains rotations to multiples of 5°, and the angle is displayed as I rotate, so I know I'm hitting 45° exactly).

 2) Adjust my viewpoint so I'm again looking "down" onto the corner with the ball on it.

 3) Drag the green axis through 45° positively

 4) Likewise for the blue axis.

 5) Repeat the above steps, for a total of 8 times, each time consisting of a 45° rotation in R, G and B in that order.

Is this what you meant? If "yes", then I'll try it again to confirm that it doesn't restore the cube to its original position.
 — MaxwellBuchanan, Jul 22 2011

My brains just leaked out of my face, sorry. I won't be able to provide any more input on this endeavor. I bid you farewell in your cuboidal musings!
 — daseva, Jul 22 2011

 Max I think you should make one of these using a potato, and some cocktail sticks (much simpler to engineer than metal)

Then you could call it Rotatopotato.
 — xenzag, Jul 22 2011

 To get the "tracks", first draw 3 circles on the sphere (yes I'm using a sphere, it's easier so far) and octosect it. Straightforward: these are all the tracks required for a 90deg rotation series and the off-cardinal points are the 45deg marks. (If this were an Earth globe, there'd be an Equator, and 0/180 and 90/270 longitudinal circles)

 So so far we've a sphere with NS EW FB poles all connected by longitudinal lines.

 Now (and this is the first slightly tricky part), draw 45deg latitude lines for all the poles. Just like latitude lines on a globe, but for all 6 poles. These will join up to form a 6-sided thing that looks sortof like the Green Lantern's lantern with each circle joining (but not crossing) four other circles.

 2 lat.circles join and intersect a long.line. These points are the 45deg marks on the long.lines and the lines from these points go to the next move.

<and then his head fell off>
 — FlyingToaster, Jul 22 2011

[FT] the head-falling-off bit is a real problem, and seems to represent a fundamental limit in the computability of the solution. However, as regards the Great Circle representation - yes. If you look at my third link, you'll see that that is how C4D indicates the orthogonal axes (or rather equatorial planes) of rotability.
 — MaxwellBuchanan, Jul 22 2011

 Hmm... well the great circles are there... now if you draw a "tropic of cancer & capricorn" lines for each axis you'll be where I am. Drawn from each axis, an equator (which are there) and two circles parallel to the equator, one north and one south (at 45deg). So, including the 3 already there, 9 circles in all...Faust may have been on to something.

Do watch the noggin though.
 — FlyingToaster, Jul 22 2011

I'm on so many noggin-straightening meds that I don't think I ought to take the risk.
 — MaxwellBuchanan, Jul 22 2011

Yay. I think it looks better in green than mine in red. But, as you can see, the rotated versions don't seem to superimpose on eachother. I take it all of your rotations were 45 degrees, and that the axes were locked to the cube?
 — MaxwellBuchanan, Jul 22 2011

 //to prove the incremental maths isn't causing the way it looks.//

You mean, to exclude the possibility that rounding errors are responsible?
 — MaxwellBuchanan, Jul 22 2011

 Ow.

 Wow you guys make things confuobfuscated.Grab a square in your mind, swing it around by the points in quarter turns a few times. Let that go on for a few seconds and you can already see the pointy circular shape start to form. Swing a cube in three dimensions and watch a pointy spherical shape emerge. There's no way to tell how many times it has to flip first because it's like watching an indeterminate amount of cards being flicked under your nose and being asked how many there were.

 lots

Damn I've got to learn some math.
<wanders off muttering about the Greekedness of it all>
 — 2 fries shy of a happy meal, Jul 22 2011

Betcha it's infinite...
 — MaxwellBuchanan, Jul 22 2011

 I think this problem could be characterised as an 'iterated function' (which is closely related to chaos).

 It would be interesting to see a graph of the angles of the first few thousand iterations to see if there is any discernable pattern.

I might be able to do this on Matlab (or more specifically Octave (the open source equivalent)), but I think there are probably more suitably qualified people in the audience to do this job.
 — xaviergisz, Jul 22 2011

So that settles it then it'll be called Rotatopotato.
 — rcarty, Jul 23 2011

[Bigsleep] See my above on trivial solutions, and the further comments on the problem as stated.
 — MechE, Jul 25 2011

[Max-B] //If anyone can tell me how to make a "screenshot movie" on a Mac, I'll show you "live" and you can see exactly how the axes rotate, locked to the cube.// - "Snapz Pro" will let you do this.
 — hippo, Jul 25 2011

 [MB] Why did you originally start looking at this problem, was there a real world application?

He had a funny turn... <Boom - Tish>
 — Ling, Jul 25 2011

 Not sure that I got this right, but here goes... I substitute 45 degrees into the rotational matrices in the link, and there are various 1/root 2 terms. I need to multiply various combinations of those matrices together to get a result 1 0 0 0 1 0 0 0 1 which would mean everything returns to the start.

It's an interesting problem, and I am most likely showing granny how to cook eggs, but hey, I tried.
 — Ling, Jul 26 2011

 [Ling] It was prompted by the "3D tesselation" idea, which led me to some geometry on Wikipedia. And then I half-remembered a long time ago I'd had to program for rotations, and remembered it was weird.

 Your solution sadly won't do it. The problem is that the axes turn with the cube. So, if you rotate once on one axis, then the next rotation is actually a 45° rotation about a line which has already been turned by 45°. So something then gets turned by something like sin(45).45°, which then puts the other axes at even weirder angles...

 I think the only way to appreciate how counterintuitive it is, is to use something like C4D or another graphicky program that lets you do it virtually for real, so to speak.

I know that quaternions (a sort of extension of complex numbers into a third dimension) are commonly used to solve this sort of problem, and they probably make it very easy.
 — MaxwellBuchanan, Jul 27 2011

There must be some synchronicity thing going on regards quaternions, I had never even heard of them maybe 6 months ago, but for some reason they've been popping up all over the place recently, along with the notion that they say something deep about symmetry.
 — zen_tom, Jul 27 2011

//I know that quaternions....// I prefer to quarter onions.
 — xenzag, Jul 27 2011

 MB, yes I later realised my simplistic view when I saw further down the Wiki link where a rotation around an arbitary angle is much more complex and iterative.

If you substitute a vector in place of the cube ( maybe just looking at a corner) I wonder if there are there some combinations of turns that make patterns. Maybe a spiral? A forever decreasing spiral could show an infinite nature, perhaps?
 — Ling, Jul 28 2011

 My contention is that the system is just as infinite if you always rotate around the system axes.

 Reasoning: in both cases the relative rotation of the two things (system coordinates and cube) is always around the same one (always cube in your version) and it's only the relative rotation that changes the properties of the puzzle. As a quick test you could try rotating around system axes and see whether it is any easier to get back to the start than using the cube axes. Still using 45 degree moves and not repeating an axis twice in a row of course.

 To get the simple finite system, make the axes analogous to a three gimbal set. One axis (say x) of rotation stays with the system axis x, one (say z) rotates with the object's z axis, and the other is kind of in between, not fixed to either. Look up gimbal on Wikipedia to see what I mean.

 This suggests [Ling]'s matrix should work with the puzzle. If it doesn't represent the cube's orientation in system coordinates it probably represents the system's orientation relative to the cube.

Back to your invention - I think having the cube rotate around it's own axes would look better than the system axes, despite the equivalence I assert above. An electromechanical systems based on gimbals and motors should be able to rotate a cube inside to any required orientation once you convert it to required motor rotation.
 — caspian, Jul 30 2011

 [annotate]

back: main index