Wednesday, May 22, 2013

The Golden Triangle in Scratch Project

   In a recent post I described the Golden Rectangle in Scratch project.
   To review, a Golden Rectangle is a rectangle with a length to width ratio of 1.61803… on out to an infinite number of decimal places (like Pi, Phi is an irrational number).
   The number 1.61803… is called the Phi, Golden Ratio, symbol (F).
   If, in an isosceles triangle, the ratio between the long side and the short side is 1.61803…, that is Phi, then the triangle is called a golden triangle.

A bit of geometry and algebraic manipulation shows that the isosceles triangle with base angles of 72º and an apex angle of 36º is a golden triangle.

   Bisect one of the 72º angles and the result is again, a golden triangle. Half of 72º is 36º, which leaves a value of 72º for the third angle in the smaller isosceles triangle. Therefore, the smaller triangle is also a golden triangle. And so on, and so on. I love mathematics for the simple fact that even as those golden triangles get infinitesimally small, the angle values remain the same!

   Here’s the next iteration.

   You can view this project by clicking on this link,

and watch the program draw six iterations of the smaller golden triangles and then draw the spiral connecting all six of the triangles.

Sunday, May 12, 2013

Scratch 2.0 is Here!

   Scratch 2.0 is now out! It’s browser-based at this point in time but I checked and found out that the developers are hoping to have a down-loadable version sometime this summer. I often work away from the Internet so I will not be shifting to Scratch 2.0 until I have a downloaded copy.
   That doesn’t mean I am not exploring the new features in Scratch 2.0. My  favorite ‘new feature’ is the ability to Make a Block.
   As a Logo-Lover, the 'Make a Block' ability in Scratch 2.0 let's me shorten code so that the logic of a program is easier to follow (and debug). 'Make a Block' is called a 'procedure' in Logo. Simply put, you can define a long script and give it a single name and them use only the ‘name’ in the main script.
   I programmed an example using a piece of useful code in The Golden Rectangle project described in the previous post. The equiangular spiral drawn in that project uses a script that draws the arc of a circle given the radius and arc (in degrees). I defined that script using Make a Block and then use just that name in the main script.
   Here's a picture of the scripts. 
   Notice that the Green Flag script only contains two blocks, the names of the defined purple-topped blocks.  Sliders provide the inputs to radius and arc.
   Here’s how the project works.
   Using the origin (0, 0) as the center of a circle, set the arc length and radius parameters of the circle with the sliders.
   Click on the green flag to see the circle or arc you set in the sliders.
   You can download a copy of this program (not Scratch.20) that can then be uploaded into the browser or you can just stay in the browser to make arcs. Here's the link.

Wednesday, May 8, 2013

The Golden Rectangle in Scratch Project

   Several months ago I completed a Scratch project on the golden rectangle of mathematical, architectural, and artistic fame. Below is a screenshot at the completion of a run of the scripts.
   The first script draws a series of squares, starting with the largest square on the left. It continues drawing successively smaller squares in a clockwise spiral.  Each square cuts the larger golden rectangle into a a smaller square and a smaller golden rectangle.

   The second script starts in the lower left corner and draws (in yellow) the spiral, in one smooth motion.

   I have now written a pdf file that describes a bit of the history of the golden rectangle, its relationship to the Fibonacci numbers, and the cool script that draws the spiral. When given the radius and arc length, the script draws the arc with that radius. Scratch (unlike Logo) doesn’t have any circle tools so if Scratch 2.0 really lets us create our own “blocks” then I will make this script into a block and write other circle tools.
   You can view and download this project by clicking on this link.
   The free pdf file can be had by sending an email request for The Golden Rectangle in Scratch file to