Thursday, May 2, 2024
HomeMatlabColoration Dice Meets Rubik’s Dice » Cleve’s Nook: Cleve Moler on Arithmetic...

Coloration Dice Meets Rubik’s Dice » Cleve’s Nook: Cleve Moler on Arithmetic and Computing


I’ve made a half dozen weblog posts about Rubik’s Dice to this point this yr. And, in the course of the MATLAB Central Mini Hack in October, I resurrected an outdated code concerning the Coloration Dice. Now, a mixture of the 2, Rubik/Coloration Qube, creates a chic software for investigating Matrices in Motion.

Contents

Opening

Right here is the opening display screen shot of Rubik/Coloration Qube, one of the elaborate MATLAB packages that I’ve ever written.

Rubik and Coloration

There are two modes, rubik and shade. In rubik mode, the massive dice is shaped from 27 similar copies of a single small cubelet. The six cubelet faces have six totally different colours. Pink, white and blue are seen initially. Orange, yellow and inexperienced develop into seen because the faces are rotated.

In shade mode, the massive dice is shaped from 27 cubelets, every with a special strong shade. Three of the nook cubelets are the first colours within the RGB shade mannequin — purple, inexperienced and blue. Three extra corners are the complementary cyan, magenta and yellow. White and black full the listing of corners.

Coloration Qube

The entire acquainted Rubik’s strikes can be found in shade mode. Here’s a display screen shot after a couple of rotations.

Rotations

Rotation matrices outlined by this Rk perform are the fundamental mathematical software employed by Qube. The animation supplies an in depth have a look at the motion produced by the F key, counter-clockwise rotation of the Entrance face. That is the y-axis, case 2 in Rk. The element is supplied by taking d = 0:3:90, so there are 30 steps of three levels.

perform R = Rk(axis,d)
    
    c = cosd(d);
    s = sind(d);
    change axis
        case 1, R = [ 1  0  0
                      0  c  s
                      0 -s  c ];
        case 2, R = [ c  0  s
                      0  1  0
                     -s  0  c ];
        case 3, R = [ c  s  0
                     -s  c  0
                      0  0  1 ];
    finish
    fmat = findobj('tag','fmat');
    if ~isempty(fmat)
        fmat.String = mat3(R);
    finish
finish

n-by-n-by-n

Qube generalizes the basic 3-by-3-by-3 Rubik’s Dice to n-by-n-by-n cubes for any n.

2-by-2-by-2

The two-by-2-by-2 cubes are good beginning factors for investigation of mathematical properties.

Software program

Qube is accessible as a self-extracting MATLAB archive at this hyperlink, Qube_mzip.m.

Printed with MATLAB® R2022a

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments