Wednesday, December 26, 2012

Free pdf Files linked to Scratch Projects

   One of the goals of this blog is to provide free pdf files I've written that discuss and explain the mathematics and programming techniques I used in my projects uploaded to Scratch.
  Three of these files are now available.

File: Lindenmayer Systems in Scratch

File: Koch Snowflake in Scratch

File: The Sine Function in Scratch

  Simply send an email request to grandadscience@gmail.com and I will email you any or all of the above files.
  The files are free of any copyright restrictions.
  The links to the Scratch projects uploaded to the Scratch web site are also given. 

Monday, December 24, 2012

In a Heart Beat

   Along with the beginning programming features and the math-based Scratch projects I will also be highlighting science projects.         Here's one science project I'm working on. The idea was stimulated by dapontes, a Scratch user that uploaded his 'Parts of the Cell project (here's the link http://scratch.mit.edu/projects/dapontes/2989999) to the Scratch web site.
   I had not paid much attention to the Looks menu until I saw dapontes' project, downloaded it, and looked at the code. I played around with the fisheye effect on Scratch the cat, saw how easy it was to use, and went looking for an object to try it on. There are several effects that can be accessed by clicking on the small black triangle in the [set _______ effects] block.
   Years ago I had made a 'working' heart pump from a couple of plastic bottles, plastic drinking straws, and one of those plastic tubes used to connect two plastic bottles so that a tornado is formed when water flows from the top bottle to the bottom bottle. I made a one-way valve from a piece of duct tape, connected the bottom bottle to the top bottle with plastic straws so that water with a bit of red food coloring pumped around the two bottles, through the one-way 'heart valve'.
   So, I found a heart image, converted it to a png file, imported the image as a sprite, and applied the fisheye effect to the sprite. It took a bit of experimentation to get the effect the way I wanted it but it sure was simple to do! Watch this YouTube video of my project.

   Use this link to download a copy of the project from Scratch, look at the code, and remix it!
   I found a heart beat sound effect on the web. It sounds great on my big Mac but it sounds kind of tinny on my laptop. Maybe you know where to get a better sound file. I also added a heart rate slider so that you can play with the rate at which the heart beats.

Saturday, December 22, 2012

Programming the Sine Function – the frequency parameter


  As shown in the following diagram, the amplitude is the maximum and minimum values for y when graphing the equation y =Asin(a). Change A, and the heights (amplitudes) change. 
   This  project can be viewed at http://scratch.mit.edu/projects/popswilson/2971107 on the Scratch web site.
   I’ve just uploaded to Scratch the next project in the Sine series that looks at the frequency of the sine function and the parameter that controls it. You can view and download the project at
from popswilson’s My Stuff page. Below is a screen shot of the project.
   After the first sine curve (in blue) with an amplitude of 100 is drawn, set the frequency to another value and press the space bar to plot the new curve in the color red. The red curve in the screen shot is the plot of the sine curve with a frequency of two.
   The FM after the call numbers of a radio station refers to frequency modulation. The signal (an electromagnetic wave) that carries the radio broadcast from an AM station is modulated (changed) by varying the amplitude of the wave. Varying the frequency of the wave modulates an FM radio signal. 

Wednesday, December 19, 2012

Breaking the Algebra Barrier


   It’s no news that students that are successful learning arithmetic often stumble and even fall, without ever getting up, when faced with learning algebra.
   As a math and science educator, I can report that little attention is given to laying the conceptual groundwork students need to make the transition from arithmetic to algebra.

   When classroom computers became available in the early 1980s (my first computer was an 8K Commodore PET with tape cassette drive), I believed that finally, we had a tool that would make learning algebra not only relevant but also easy! That belief was—and still is— based on the fact that programming requires algebraic thinking.

   Perhaps the most fundamental concept in algebra and programming is the concept of a variable. In the typical algebra text, the variable concept is briefly mentioned and then quickly followed by the never-ending song and dance between the x’s and the y’s. The variable x becomes synonymous with unknown and for many students, the x and algebra itself remains an unknown.

   Dr. Zalman Usiskin, in his article, Conceptions of School Algebra and Uses of Variables discusses and gives examples of the five different ways the variable concept is used in algebra. [Click here http://oak.ucc.nau.edu/smg224/401pdfs/algebrareadings/usiskin1.pdf
to download a copy of his article.]

   He goes on to say that computer programming makes use of all five uses of the variable! For this and many other reasons (problem-solving and logical thinking are just two) I hope my grand kids are willing to learn introductory programming so that I can help them understand the importance and relevance of algebra.
   It is in this spirit that I have started this blog devoted to helping beginners learn to program, maintaining contact with the teachers I work with, and to having a place to share my math and science programming projects.
 The Scratch programming language is free and can be downloaded at
and while you’re there, check out the site as it is a very friendly place for kids of all ages and offers the opportunity to become part of a programming community that has 1,337,805 registered members that have created and uploaded almost three million programming projects.
   Update: as of April 11, 2017, there are now 17,785,722 registered Scratch users and  21,608,051 projects have been uploaded to the Scratch web site.

Sunday, December 16, 2012

Algorithmic Thinking


   
   I have just finished teaching a two-unit college course in programming for middle school and secondary math teachers. Over the years I have used BASIC, Logo, Pascal, and the version of BASIC Texas Instruments uses in their programmable calculators. The last two times I have taught the course I have used Scratch. No matter what the programming language, I have found that many math teachers have a difficult time learning to program. I have pondered this phenomenon for years because in my mind, programming should be easy for math teachers.
   Over the last few years I have created a structure that I use in the course for every programming project. I insist on participants following the seven steps of algorithmic thinking. Doing this has helped participants in my course understand that programming is not a single skill, it's a set of skills.
The Stages of Algorithmic Thinking

                       Purpose: to create machine* understandable algorithms that solve a specific problem
                                               
            First, Do the Math with Paper & Pencil Part
                                    Analyze the problem

            Next, Do the Algebraic Thinking Part
                                    Identify the Variables
                                    Determine the relationships between the variables

            And Finally, Do the Algorithmic Thinking Part
                                    Create a Logic Flow diagram
                                    Translate the relationships (math syntax) à (computer syntax)
                                    [the syntax of every computer language is fixed and can not be violated)
                                    Combine the pieces of code (into the algorithm that solves the problem)
                                    Test the algorithm (debug)

*machine = any device controlled by digital logic [computer, smart phone, etc.]

Algorithmic Thinking Takes Place within a Problem-solving Environment


   If you teach programming for nonprofessionals, what structure do you use?

Saturday, December 15, 2012

Two Colorful Sine Waves

   In the recent post, The Sine Function, I explained the origin of the sine function as a ratio of sides in a right triangle and then described how to build the sine function script in Scratch.
   In Scratch parlance, making modifications to an existing Scratch project is called a remix. Since uploaded Scratch projects can be downloaded by Scratch users, remixing is encouraged and often leads to new and interesting variations on a theme.
   The remix of my Sine project has been uploaded to My Stuff at 
where you can download a copy.
   Here's a short video that describes how the project works.

Monday, December 10, 2012

Riding the Sine Wave

   I just uploaded a new project to my Scratch folder at
called The Sine Wave.
   I would imagine a surfer  likes big waves that arrive frequently. The Sine Wave project explains the sine ratio as derived from a right triangle, the unit circle, and then how to graph the sine function in Scratch.
   The project allows the user to change the amplitude of the sine curve. Oh if it was only that easy for the surfer!
   A free pdf file for this project is available on request by sending an email to grandadscience@gmail.com.
  The next sine function project will allow the user to play with the frequency of the wave.

Sunday, December 9, 2012

My Next Scratch Tutorial on YouTube


   Scratch the cat appears on the graphics screen as soon as Scratch is downloaded and opened.
   This video illustrates how easy it is to get Scratch to move and turn! Also, the block structure of Scratch is demonstrated. This feature of Scratch means you don't have a 'typing' editor that adds to the chances of making the typographical mistakes that keeps your scripts (programs) from running properly—or at all!

Following is a list of the other introductory Scratch videos on my YouTube channel. Go ahead and work ahead!

Scratch A 1.3
Pen commands, pen color, pen color, pen size programming blocks

Scratch A 1.4
The repeat and wait programming blocks

Scratch A 1.5
How to add a pen to Scratch the cat

Scratch A 1.6
The Click on the Green Flag programming block and the Presentation Mode


Scratch A1 7
Variable use as an argument, defining the variable distance

Scratch A2 1
How to change the background by importing a graphic and how to import a sprite from the animals file.

Scratch A2 2
How to set the minimum and maximum on a slider.




Friday, November 30, 2012

How to Download Scratch

  It's easy to download Scratch, at no cost, from its home site at the Massachusetts Institute of Technology. Just click on the following video for instructions.

Thursday, November 29, 2012

Welcome!


   The purpose of this blog is to provide detailed information about the mathematics, science, and programming techniques embedded in the Scratch programming projects I so love doing.
   I was motivated to start this blog by a comment one viewer made in regard to a project I posted on my Scratch page at http://scratch.mit.edu/users/popswilson.
   Here is a screen shot of the project. The squareflake has the unusual property of always maintaining the same area as its originating square (in yellow) even if the perimeter is increased indefinitely by repeatedly applying the Lindenmayer rule!


   The aforementioned Scratch user had viewed my Lindenmayer System Squareflake project at 
and posted this comment,

AWESOME! How does it work?

   How code works is always a good question. I did include numerous comments in the Scratch scripts included in the project but they would most likely be helpful only to those that already knew something about Lindenmayer systems.
   Lindenmayer systems are not difficult to understand.  In fact, I did the project because I did not understand a Lindenmayer system!
   For those with an interest in learning the mathematics behind the code, I’ve written a detailed description of what Lindenmayer systems are, how they work, the applied mathematics, and how to program such systems in Scratch.

   To obtain a free pdf file for the Lindenmayer project simply email a request to grandadscience@gmail.com and ask for Lindenmayer Systems in Scratch.

   Registered Scratch users can download the project by clicking on the above link. To download Scratch for the PC and Mac and become a registered user go to http://scratch.mit.edu/.