My First Program from 1987

Back in 2010, I posted a brief story about one of the highlights of my childhood, the first time I was able to get a program to successfully compile and run on my Apple IIe clone, the Laser 128.

Here’s the tale again:

I was subscribed to a children’s magazine called “3-2-1 Contact” and in the back of every issue were a couple of programs in BASIC (as in the BASIC programming language). I can still vividly remember one of the most exciting and exhilarating moments of my childhood, perhaps of my whole life. The moment came after seemingly endless hours of trying to get the very first program to run. I knew nothing about how I was supposed to type it in, whether punctuation or case had anything to do with the code, whether the line number needed to be typed and I definitely had no idea what the code meant. Yet, I tried and I tried and I tried until finally, after pressing the “Enter” key at the “RUN PROGRAM”, something happened. Something beautiful. Something amazing. Something that made me jump up and down, hoot and holler, clap and do a little jig. Okay, specifically what happened was so basic and ordinary that no one but I would be impressed. It was the fact that it ran that made me so happy. The program just drew a multicolored box around the edge of the screen and then criss-crossed a multicolored “x” on the screen. It repeatedly drew the box and the x over and over again. It was essentially the most boring screensaver you could imagine. But, the code I entered ran. Brilliant! Genius! I still feel the excitement in my gut when I think about that moment.

from Chasing Rabbits in Stat Class (June 17, 2010)

So, today I was finally able to find the original code by digging around on the web.  I can’t believe I actually found a scanned image of the page from the back of the magazine, but here it is:


And then, thanks to Joshua Bell, I was able to use an “Applesoft BASIC in JavaScript” utility to re-create that experience again:

Here’s the code to copy and paste if you want to try it out yourself:

20 COLOR=1
30 FOR S = 0 TO 39
40 VLIN O,39 AT S
60 FOR S = 0 TO 39
70 COLOR = INT(RND(1)*232+1)
80 PLOT 0,S: PLOT S,S: PLOT S,0: PLOT 39,S: PLOT S,39: PLOT 39-S,S: PLOT S,39-S
85 FOR T=0 TO 100: M=T+100: NEXT T
100 GOTO 30

Note that I added line 85 just to slow down the rendering on the page.

Are you ready to see that amazing graphic that I created?  Again, let me just say that the moment this finally ran, I freaked out with excitement.  It was only after hours, if not days of trying to get that code entered correctly.  Seeing it again didn’t quite recreate that feeling, but I’m still feeling pretty proud of myself for being able to recreate the graphic from 1987.

Cheryl’s Birthday – Singapore Math Problem

This math problem went viral yesterday so I had my kids tackle it. It took us all working together but we got a solution.

Here’s the problem that appeared all over reddit, Facebook, and Twitter:


Don’t read any further unless you want to know the answer. #spoilers

Hint 1: Albert’s first statement rules out any month with a unique day (18 or 19) since he’s certain Bernard doesn’t know the exact date. If Bernard had been told 18, for example, that means he could know it was June 18, but Albert is certain Bernard doesn’t know so it couldn’t have been June that Albert was told. Same goes for May since the 19th is unique to May. 

Hint 2: With May and June ruled out, Bernard says he now knows what the full date is. So the day couldn’t have been one that is in multiple months (i.e., 14 is in July and August). So, the 14’s are ruled out. 

Final Hint (aka the solution): Since Albert finally says that he knows the date and we’ve ruled out May, June, and the 14th’s, we know it has to be a month with only one date left, namely July 16. Since August still has two choices, the 15th and 17th, Albert wouldn’t have been certain that he knew the date if he had been told August. So Albert must have been told July. 

Final answer: July 16 is Cheryl’s birthday. 

Dean’s Corner – First Edition

WBU flameI’m a little late in getting around to updating my blog (Natural Blogarithms) on my recent change in position at Wayland.  As of February 23, 2015, I am now the Dean of the School of Mathematics and Sciences.  (See Press Release)

Below is my first contribution to the “quarterly” newsletter.  I hope you’ll check it out and peruse the rest of the newsletter so you see what’s up in our school

Dean’s Corner

“I’m coming home…to the place where I belong!”

I actually remember it vividly, the spring of 1994, when I first walked onto the Wayland campus pondering the possibility of attending school here as an undergraduate.  I remember touring the campus and not even having a clue what I should be asking the recruiter. I had a head full of dreams but no clear vision of where my life could be headed.  I can also recall sitting in my very first course in the Moody Science Building, where my future mentor, Dr. Phil Almes, called me and several others to stay after class just so he could tell us he was glad to see us in his church the previous weekend.  It would be unfathomable to that younger version of me that somewhere down the road, I would be settling into the position of dean of this very school. Continue reading Dean’s Corner – First Edition

The Mathematics of Love

With Valentine’s Day around the corner, the whole of humanity is looking for answers on how to be truly happy in love, right?  And, certainly everyone is thinking of using the most powerful tool ever devised for answering life’s most difficult questions:

Mathematics, of course

Thanks to Hannah Fry’s TED talk posted today, we learn that Mathematics actually has a lot to say about optimizing your chances of finding love.  I’ve always been a big fan of hers, following her on Twitter (@FryRsquared), but this was an especially interesting talk.

In honor of Valentine’s day, check out the “Mathematics of Love”

Get “Things” for Free (An Excellent To-Do list app)

2014-11-21_9-33-48Before I moved all my action items to Trello, the “Things” app was my favorite To-Do list for getting things done (‪#‎GTD‬). It’s free this week if you want to try it out. I think they have separate apps for iPhone and iPad, so if you have both you might go ahead and get it now to try out later.

Remember, if you get a free app, it’s yours for good, even if they raise the price again later. So you could get it this week, then delete, but re-install it anytime in the future for free.

Apple is giving App Store customers something to be thankful for as its offering Things as its free App of the Week.


Blackboard Grader App for iOS

[Cross-posted on the E-Learning Pioneer – Blog of the Virtual Campus]

There is finally an app for Blackboard that has been designed with the online instructors in mind. The Blackboard Grader App is now available and gives instructors an option for reviewing, providing feedback, and grading student submissions to Blackboard Learn Assignments.

BbGrader_hero2_tcm21-7049 Continue reading Blackboard Grader App for iOS

Connect the Dots Like a Numerical Analyst

I have to say, teaching Numerical Analysis is one of the highlights of my job. Granted, my primary responsibility at Wayland is the Virtual Campus Director, and I will never teach Numerical Analysis online. Nevertheless, I LOVE it. In fact, the course banner that I use in Blackboard reinforces that fact to my students every time they log in:

Just as a for instance, I was able to get them to “solve” the age-old Connect-the-Dot problem. What is that, you ask? Well, simple: We all know, from the time we are toddlers, how to complete a Connect the Dot worksheet:

BUT, what is the mathematical solution? After all, math majors should look at the connect-the-dot worksheet and wonder, “What’s the equation of the solution?”

So today, as an introduction to using splines for interpolation, we derived the simple formulas for a piecewise linear interpolant:

Given a set of n+1 points with coordinates \{(x_j, y_j)\}_{j=0}^n, we can uniquely describe the piecewise linear function S(x) where S(x_i)=y_i for all i=0, 1, \ldots, n, as follows:

S(x)=\Big\{ S_j(x), \ \ x\in[x_j,x_{j+1}] \ \ , for j=0, 1, \ldots, n-1

where S_j(x)=a_j x+b_j,

a_j = \displaystyle \frac{y_{j+1}-y_j}{x_{j+1}-x_j},

And b_j = y_j - a_j x_j for j=0, 1, \ldots, n-1

At least, that’s the solution I told them in class today.  The truth is that’s not correct.  In fact, this will only “solve” the limited case where you always move left to right and never go back the other way.  What we really need is a parametric approach.  Given the initial data set above, we assign a parameter t \in \mathbb{R} to each point, say t=j for the point (x_j, y_j).  Then we have the following solution to the Connect-the-Dot problem:

Given a set of n+1 points with coordinates \{(x_j, y_j)\}_{j=0}^n, we can uniquely describe the piecewise linear parametric function \bar{S}(t) where \bar{S}(j)=(x_j,y_j) for all j=0, 1, \ldots, n-1, as follows:

\bar{S}(t) = \Big\{ \big\langle S_{j,x}(t), S_{j,y}(t) \big\rangle, for j=0, 1, \ldots, n-1

where S_{j,x}(t)=a_{j,x} t+b_{j,x} and S_{j,y}(t)=a_{j,y} t+b_{j,y}

a_{j,x} = x_{j+1}-x_j and a_{j,y} = y_{j+1}-y_j

b_{j,x} = x_j - a_{j,x} t and b_{j,y} = y_j - a_{j,y} t for j=0, 1, \ldots, n-1

That’s better, don’t you think?  From there we launched into a derivation of linear system approach to interpolation by natural cubic splines.  Then I ran out of time before finishing the derivation, which lead to the instagram post below…

That moment when class is over but you haven’t finished the proof… #mathteacherproblems

A photo posted by Scott Franklin (@splineguy) on