{"id":1239,"date":"2015-08-10T12:00:56","date_gmt":"2015-08-10T17:00:56","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=1239"},"modified":"2015-08-11T16:10:34","modified_gmt":"2015-08-11T21:10:34","slug":"tumbling-box-ode","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2015\/08\/10\/tumbling-box-ode\/","title":{"rendered":"Tumbling Box ODE"},"content":{"rendered":"<div class=\"content\"><!--introduction--><p>A rectangular box, such as a book or a cell phone, thrown in the air can tumble stably about its longest axis, or about its shortest axis, but not about its middle axis.<\/p><!--\/introduction--><h3>Contents<\/h3><div><ul><li><a href=\"#14ee06e4-7b65-4d81-9141-50e6ea40e392\">Angular Momenta<\/a><\/li><li><a href=\"#c3f79be6-dafe-4b88-b145-e96d08258388\">Critical points<\/a><\/li><li><a href=\"#7f8431db-77fb-4cce-819a-f9930dfe2c44\">Stable critical points<\/a><\/li><li><a href=\"#12cf4704-ac44-47f0-a0fe-8c80141c0d66\">Unstable critical points<\/a><\/li><li><a href=\"#a100ed96-4edf-46a8-b631-ba0090346024\">Four quadrants<\/a><\/li><li><a href=\"#d77af7a7-608e-4332-8aae-47f51c7bfe94\">Tumbling_box.m<\/a><\/li><li><a href=\"#11d3e3c1-01b5-4c68-9a9f-1c820ae40d0f\">Reference<\/a><\/li><\/ul><\/div><h4>Angular Momenta<a name=\"14ee06e4-7b65-4d81-9141-50e6ea40e392\"><\/a><\/h4><p>In his latest book, <i>Differential Equations and Linear Algebra<\/i>, my colleague Gilbert Strang describes an interesting model problem made famous among MIT students by another MIT professor, Alar Toomre. If you throw a rectangular box in the air with a twist, you can make it tumble stably about its longest axis, or about its shortest axis. But, if the lengths of the three sides of the box are different, you cannot make it tumble about its middle-sized axis.<\/p><p>To describe the dynamics of the box, discount the effects of gravity by using a coordinate system centered in the box and that moves with it. Let $x(t)$, $y(t)$, and $z(t)$ be the angular momenta about the three principal axes, and let $I_1$, $I_2$, and $I_3$ be the moments of inertia about these axes.  Then Euler's equations are<\/p><p>$$ { d \\over dt} \\left( \\begin{array}{c} x \\\\ y \\\\ z \\end{array} \\right) =\r\n \\left( \\begin{array}{r} ayz \\\\ bxz\\\\ cxy \\end{array} \\right) $$<\/p><p>where<\/p><p>$$ a = 1\/I_3 - 1\/I_2, \\ \\ b = 1\/I_1 - 1\/I_3, \\ \\ c = 1\/I_2 - 1\/I_1 $$<\/p><p>If we have<\/p><p>$$ I_1 = 1, \\ \\ I_2 = 1\/2, \\ \\ I_3 = 1\/3 $$<\/p><p>the equations become simply<\/p><p>$$ { d \\over dt} \\left( \\begin{array}{c} x \\\\ y \\\\ z \\end{array} \\right) =\r\n \\left( \\begin{array}{r} yz \\\\ -2xz\\\\ xy \\end{array} \\right) $$<\/p><h4>Critical points<a name=\"c3f79be6-dafe-4b88-b145-e96d08258388\"><\/a><\/h4><p>There are six critical points.  Any solution to the Euler equations that starts exactly at one of these points remains there.<\/p><p>$$ X = \\pm \\left( \\begin{array}{c} 1 \\\\ 0 \\\\ 0 \\end{array} \\right), \\ \\ Y = \\pm \\left( \\begin{array}{c} 0 \\\\ 1 \\\\ 0 \\end{array} \\right), \\ \\ Z = \\pm \\left( \\begin{array}{c} 0 \\\\ 0 \\\\ 1 \\end{array} \\right) $$.<\/p><p>It turns out that any solution that starts out with $x^2+y^2+z^2=1$ retains that property, so solutions travel on the surface of the unit sphere. If you think of the sphere as the earth with $+Z$ at the North Pole, then $+X$ is the point where the Greenwich meridian crosses the equator. This is in the eastern Atlantic, off the coast of West Africa. $+Y$ is the point where the $90^\\circ$ meridian east crosses the equator.  This is in Indian Ocean, west of Sumatra.<\/p><h4>Stable critical points<a name=\"7f8431db-77fb-4cce-819a-f9930dfe2c44\"><\/a><\/h4><p>To see what happens near a critical point, we need the Jacobian.<\/p><p>$$ J = \\left[ \\begin{array}{rrr} 0 &amp; z &amp; y \\\\ -2z &amp; 0 &amp; -2x \\\\ y &amp; x &amp; 0 \\end{array} \\right] $$<\/p><p>At $+X$<\/p><p>$$ J = \\left[ \\begin{array}{rrr} 0 &amp; 0 &amp; 0 \\\\ 0 &amp; 0 &amp; -2 \\\\ 0 &amp; 1 &amp; 0 \\end{array} \\right] $$<\/p><p>The eigenvalues of $J$ are pure imaginary, namely $\\lambda = \\pm \\sqrt{2}i$, along with $\\lambda = 0$.  So near $+X$ the solutions behave locally like $\\cos{(\\sqrt{2}t)}$ and $\\sin{(\\sqrt{2}t)}$.  This critical point, which corresponds to rotation about the long axis, is a stable center. The critical point $-X$, which corresponds to rotation about the long axis in the opposite direction, is also a stable center.<\/p><p>At $+Z$<\/p><p>$$ J = \\left[ \\begin{array}{rrr} 0 &amp; 1 &amp; 0 \\\\ -2 &amp; 0 &amp; 0 \\\\ 0 &amp; 0 &amp; 0 \\end{array} \\right] $$<\/p><p>We have the same eigenvalues and so rotation about the short axis is also a stable center.<\/p><h4>Unstable critical points<a name=\"12cf4704-ac44-47f0-a0fe-8c80141c0d66\"><\/a><\/h4><p>The middle axis, $+Y$, is a different story.  Here<\/p><p>$$ J = \\left[ \\begin{array}{rrr} 0 &amp; 0 &amp; 1 \\\\ 0 &amp; 0 &amp; 0 \\\\ 1 &amp; 0 &amp; 0 \\end{array} \\right] $$<\/p><p>The eigenvalues of $J$ are real, namely $\\lambda = 1, 0,$ and $-1$. Near $+Y$ and $-Y$ the solutions have components that behave locally like $e^t$.  These are unstable saddle points.<\/p><h4>Four quadrants<a name=\"a100ed96-4edf-46a8-b631-ba0090346024\"><\/a><\/h4><p>The surface of the sphere can be divided into four quadrants, with one of the stable critical points, $\\pm X$ or $\\pm Z$, at the center of each quadrant. Any solution to the differential equation is periodic and describes an orbit that remains within one of the quadrants, circulating around its center.<\/p><p>If the initial point is near the center of a quadrant, the orbit is nearly elliptical and the orbit has period close to $\\sqrt{2}\\pi$. If the initial point is near the boundary of a quadrant, the orbit sticks near that boundary, making sharp turns at the two saddle points $\\pm Y$. The period increases as the initial point gets further from the center.<\/p><p>I think of these as giant atmospheric currents that circulate around one-fourth of a planet.<\/p><h4>Tumbling_box.m<a name=\"d77af7a7-608e-4332-8aae-47f51c7bfe94\"><\/a><\/h4><p><a href=\"https:\/\/blogs.mathworks.com\/images\/cleve\/tumbling_box.m\">Here is a link<\/a> to a program, <tt>tumbling_box.m<\/tt>, that uses <tt>ode45<\/tt> to solve these equations and produce the following graphic.  I invite you to download the program and experiment yourself.  You are presented with a sphere that is empty except for dots at three critical points.  You can click repeatedly to provide the initial conditions for the orbits.<\/p><p>You can also click on icons in the figure window toolbar to zoom in and out, and rotate and pan over the sphere.  If you zoom in to the stable centers points, you can see the elliptical orbits associated with stability. If you zoom in to the saddle points, you can see the hyperbolic orbits associated with instability.  If you rotate the sphere, you can follow one of the unstable orbits around the sphere, back to its starting point.<\/p><p><tt>Tumbling_box<\/tt> includes <tt>ode45<\/tt> event handling code to determine the length of a period of the solution.  It also has mouse button down code to interpret the coordinates of a mouse click as a point on the surface of the unit sphere.<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/tumbling_box.jpg\" alt=\"\"> <\/p><h4>Reference<a name=\"11d3e3c1-01b5-4c68-9a9f-1c820ae40d0f\"><\/a><\/h4><p>Gilbert Strang, <i>Differential Equations and Linear Algebra<\/i>, Wellesley-Cambridge Press, 2014, 502pp. <a href=\"http:\/\/www.wellesleycambridge.com\">&lt;http:\/\/www.wellesleycambridge.com<\/a>&gt;<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_7d2c20b50c9a4884badbe41459d6c07e() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='7d2c20b50c9a4884badbe41459d6c07e ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 7d2c20b50c9a4884badbe41459d6c07e';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2015 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_7d2c20b50c9a4884badbe41459d6c07e()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2015a<br><\/p><\/div><!--\r\n7d2c20b50c9a4884badbe41459d6c07e ##### SOURCE BEGIN #####\r\n%% Tumbling Box ODE\r\n% A rectangular box, such as a book or a cell phone, thrown in the air\r\n% can tumble stably about its longest axis, or about its shortest axis,\r\n% but not about its middle axis.\r\n\r\n%% Angular Momenta\r\n% In his latest book, _Differential Equations and Linear Algebra_,\r\n% my colleague Gilbert Strang describes an interesting model problem made\r\n% famous among MIT students by another MIT professor, Alar Toomre.\r\n% If you throw a rectangular box in the air with a twist, you can make it\r\n% tumble stably about its longest axis, or about its shortest axis.   \r\n% But, if the lengths of the three sides of the box are different,\r\n% you cannot make it tumble about its middle-sized axis.\r\n\r\n%%\r\n% To describe the dynamics of the box, discount the effects of gravity by\r\n% using a coordinate system centered in the box and that moves with it.\r\n% Let $x(t)$, $y(t)$, and $z(t)$ be the angular momenta about the three \r\n% principal axes, and let $I_1$, $I_2$, and $I_3$ be the moments of inertia\r\n% about these axes.  Then Euler's equations are\r\n%\r\n% $$ { d \\over dt} \\left( \\begin{array}{c} x \\\\ y \\\\ z \\end{array} \\right) = \r\n%  \\left( \\begin{array}{r} ayz \\\\ bxz\\\\ cxy \\end{array} \\right) $$\r\n%\r\n% where\r\n%\r\n% $$ a = 1\/I_3 - 1\/I_2, \\ \\ b = 1\/I_1 - 1\/I_3, \\ \\ c = 1\/I_2 - 1\/I_1 $$\r\n%\r\n\r\n%%\r\n% If we have\r\n%\r\n% $$ I_1 = 1, \\ \\ I_2 = 1\/2, \\ \\ I_3 = 1\/3 $$\r\n%\r\n% the equations become simply\r\n%\r\n% $$ { d \\over dt} \\left( \\begin{array}{c} x \\\\ y \\\\ z \\end{array} \\right) = \r\n%  \\left( \\begin{array}{r} yz \\\\ -2xz\\\\ xy \\end{array} \\right) $$\r\n%\r\n\r\n%% Critical points\r\n% There are six critical points.  Any solution to the Euler equations that\r\n% starts exactly at one of these points remains there.\r\n%\r\n% $$ X = \\pm \\left( \\begin{array}{c} 1 \\\\ 0 \\\\ 0 \\end{array} \\right),\r\n% \\ \\ Y = \\pm \\left( \\begin{array}{c} 0 \\\\ 1 \\\\ 0 \\end{array} \\right), \r\n% \\ \\ Z = \\pm \\left( \\begin{array}{c} 0 \\\\ 0 \\\\ 1 \\end{array} \\right) $$. \r\n\r\n%%\r\n% It turns out that any solution that starts out with $x^2+y^2+z^2=1$ retains\r\n% that property, so solutions travel on the surface of the unit sphere.\r\n% If you think of the sphere as the earth with $+Z$ at the North Pole,\r\n% then $+X$ is the point where the Greenwich meridian crosses the equator.\r\n% This is in the eastern Atlantic, off the coast of West Africa. $+Y$ is the\r\n% point where the $90^\\circ$ meridian east crosses the equator.  This is in\r\n% Indian Ocean, west of Sumatra. \r\n\r\n%% Stable critical points\r\n% To see what happens near a critical point, we need the Jacobian.\r\n%\r\n% $$ J = \\left[ \\begin{array}{rrr} 0 & z & y \\\\ -2z & 0 & -2x \\\\ y & x & 0 \\end{array} \\right] $$  \r\n%\r\n\r\n%%\r\n% At $+X$\r\n%\r\n% $$ J = \\left[ \\begin{array}{rrr} 0 & 0 & 0 \\\\ 0 & 0 & -2 \\\\ 0 & 1 & 0 \\end{array} \\right] $$  \r\n%\r\n% The eigenvalues of $J$ are pure imaginary, namely $\\lambda = \\pm \\sqrt{2}i$,\r\n% along with $\\lambda = 0$.  So near $+X$ the solutions behave locally like\r\n% $\\cos{(\\sqrt{2}t)}$ and $\\sin{(\\sqrt{2}t)}$.  This critical point, which\r\n% corresponds to rotation about the long axis, is a stable center.\r\n% The critical point $-X$, which corresponds to rotation about the long axis\r\n% in the opposite direction, is also a stable center.\r\n\r\n%%\r\n% At $+Z$\r\n%\r\n% $$ J = \\left[ \\begin{array}{rrr} 0 & 1 & 0 \\\\ -2 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array} \\right] $$  \r\n%\r\n% We have the same eigenvalues and so rotation about the short axis is\r\n% also a stable center.\r\n\r\n%% Unstable critical points\r\n% The middle axis, $+Y$, is a different story.  Here\r\n%\r\n% $$ J = \\left[ \\begin{array}{rrr} 0 & 0 & 1 \\\\ 0 & 0 & 0 \\\\ 1 & 0 & 0 \\end{array} \\right] $$  \r\n%\r\n% The eigenvalues of $J$ are real, namely $\\lambda = 1, 0,$ and $-1$.\r\n% Near $+Y$ and $-Y$ the solutions have components that behave locally\r\n% like $e^t$.  These are unstable saddle points.\r\n\r\n%% Four quadrants\r\n% The surface of the sphere can be divided into four quadrants, with one of the\r\n% stable critical points, $\\pm X$ or $\\pm Z$, at the center of each quadrant.\r\n% Any solution to the differential equation is periodic and describes an\r\n% orbit that remains within one of the quadrants, circulating around its center.\r\n\r\n%%\r\n% If the initial point is near the center of a quadrant, the orbit is nearly\r\n% elliptical and the orbit has period close to $\\sqrt{2}\\pi$.\r\n% If the initial point is near the boundary of a quadrant, the orbit sticks\r\n% near that boundary, making sharp turns at the two saddle points $\\pm Y$.\r\n% The period increases as the initial point gets further from the center.\r\n\r\n%%\r\n% I think of these as giant atmospheric currents that circulate around\r\n% one-fourth of a planet.\r\n\r\n%% Tumbling_box.m\r\n% <https:\/\/blogs.mathworks.com\/images\/cleve\/tumbling_box.m Here is a link>\r\n% to a program, |tumbling_box.m|, that uses |ode45| to solve these equations\r\n% and produce the following graphic.  I invite you to download the program\r\n% and experiment yourself.  You are presented with a sphere that is empty\r\n% except for dots at three critical points.  You can click repeatedly to\r\n% provide the initial conditions for the orbits.\r\n\r\n%%\r\n% You can also click on icons in the figure window toolbar to zoom in and out,\r\n% and rotate and pan over the sphere.  If you zoom in to the stable centers\r\n% points, you can see the elliptical orbits associated with stability.\r\n% If you zoom in to the saddle points, you can see the hyperbolic\r\n% orbits associated with instability.  If you rotate the sphere, you can\r\n% follow one of the unstable orbits around the sphere, back to its \r\n% starting point.\r\n\r\n%%\r\n% |Tumbling_box| includes |ode45| event handling code to determine the\r\n% length of a period of the solution.  It also has mouse button down code\r\n% to interpret the coordinates of a mouse click as a point on the surface\r\n% of the unit sphere.\r\n%\r\n% <<tumbling_box.jpg>>\r\n\r\n%% Reference\r\n% Gilbert Strang, _Differential Equations and Linear Algebra_,\r\n% Wellesley-Cambridge Press, 2014, 502pp.\r\n% <http:\/\/www.wellesleycambridge.com http:\/\/www.wellesleycambridge.com>\r\n\r\n##### SOURCE END ##### 7d2c20b50c9a4884badbe41459d6c07e\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/cleve\/tumbling_box.jpg\" onError=\"this.style.display ='none';\" \/><\/div><!--introduction--><p>A rectangular box, such as a book or a cell phone, thrown in the air can tumble stably about its longest axis, or about its shortest axis, but not about its middle axis.... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2015\/08\/10\/tumbling-box-ode\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,24,13,5,23,6],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/1239"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/comments?post=1239"}],"version-history":[{"count":4,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/1239\/revisions"}],"predecessor-version":[{"id":1244,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/1239\/revisions\/1244"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=1239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=1239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=1239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}