Monday, August 24, 2009

Quadratic Factoring with HTML/JS/CSS/DOM

So I dusted off my old javascript/css/DOM reference and created a tool for exploring factoring of quadratics of the form x2+bx+c, where b and c are non-negative integers. The tool, called Quadratic Grid, is made using a mix of html, javascript, CSS, and DOM. My previous attempt at quadratic factoring visualization using Processing had limited interactivity (it had none), not a good learning tool. It didn't help that it was visually disappointing. I am happier about this end product. I did quickly so it's not the most efficient solution. This was also done before I learned of canvas in html5.

Here are some screenshots. Play around with the presets first, then try out the settings. Columns represent coefficient b and rows represent coefficient c. Clicking on the squares will show quadratics that are factorable over the rationals with the same b on the left and same c on the right.

Here I zoom out a bit. Notice how for non-negative coefficients b and c, most quadratics are factorable over reals. Few are factorable over rationals. The factoring practice that we do in class focus on questions marked by the yellow pixels. Click on the pixel to update the quadratics with same b/c as the "Current Quadratic" listed on top left. I didn't click before I took the screenshot so it still had the previous b/c.

Here's the chart above without the UI controls.

I apologize in advance for any browser/computer crash this tool may cause.

UPDATE: Reposted here. Edited most of text out from the old post.

Sunday, August 23, 2009

Quadratic Factoring with Processing

Inspired by Sam J. Shah’s post entitled Factoring, Schmactoring, I created this applet using Processing to explore factorization of quadratics of the form y=x2+bx+c, where b and c are integers. In the picture below, yellow means factorable in rationals, blue means factorable into reals, and green are factorable in complex numbers. Columns represent b and rows represent c in the quadratic.

Downloading and installing Processing was quick and easy. But it was about 2 hours of going through the various examples on their website before I realized the code samples and examples were included with the software that I downloaded. I played with one of their samples Primitive 3D to get a feel for how to create and manipulate basic objects. After I created a grid I played with having the camera rotate and zoom in, but after about 2 hours of experimentation I didn’t feel like I was getting closer to anything that might be visually compelling and useful for the classroom. I ended up using orthographic projection view just to fit the entire grid.

The final product is a little disappointing, especially after seeing what other people are able to create with it on YouTube and Vimeo. But for a Processing newbie who hasn’t touched java in ages, to be able to use the examples and sample code to come up with the above, I give Processing a lot of credit. I will probably play more with it during winter break.

UPDATE: Removed the applet and replaced it with image. Click on the image to go to the processing applet.
UPDATE 2: You can try the presets or just play with Quadratic Grid, which has similar visualization of the original Processing applet but done with javascript and has more options.
UPDATE 3: Reposted here. Added new screenshot and did some editing.

Friday, August 21, 2009

Why are Phone Numbers 7 Digits Long?

So I asked Google “Why are phone numbers 7 digits long” and it gave me the following links. Search results from 8/21/2009.
  1. Telephone number – Wikipedia, the free encyclopedia
  2. North American Numbering Plan – Wikipedia, the free encyclopedia
  3. American Chronicle | Why Are Phone Numbers 7 Digits Long?
  4. LincMad: Why Not 8-digit Phone Numbers?
  5. the first three digits of a 7-digit telephone number
  6. Trivia – Why are phone number seven digits? – ArcaMax Publishing
  7. WikiAnswers – How many 7 digit phone numbers are available if a …
  8. telephone numbers
  9. Phone App Only Dials 7 digit phone numbers, Email function not …
  10. How many 7-digit telephone numbers can be created if each number …
The first link gives a brief history of phone numbers but doesn’t explain why phone numbers are 7 digits long. The one interesting bit of trivia is about the fictional 555 phone numbers. If you look for them, you can see them in movies and TV shows.

Screenshots above from The Simpsons, Serendipity, Ghostbusters, Bladerunner, and Tonight Show with Conan O'Brien. Using the info from the fictional 555 phone numbers from the wikipedia article, we can ask some questions:

Questions on counting for Algebra 2/Pre-Calc:
  1. How many phone numbers are possible if the format follows NXX-XXXX, where N is a digit from 2 to 9 and X is a digit from 0 to 9?
  2. How many phone numbers are possible if we exclude the fictional 555-XXXX phone numbers?
  3. How many real phone numbers are possible if the only fictional numbers possible ranges from 555-0100 to 555-0199?

The second link offers information about the development of the phone numbers as used in the US. Back in the days when people used rotary phones, it made sense that the major population areas of the time had small numbers for area codes: New York (212), Los Angeles (213), and Chicago (312).
(CC BY 3.0 by Hyku)

Questions on counting for Algebra 2/Pre-Calc:
  1. How many 3-digit area codes are possible if the format of area codes is NXX where N is a digit from 2 to 9 and X is a digit from 0 to 9?
  2. How many area codes take as long to dial as 213 on a rotary phone?
  3. Do all area codes take the same amount of time to dial?
  4. If the phone company wanted to minimize the dialing time on a rotary phone, what 3-digit number should we assign to the 200th area code?

The third link had a promising title but was ultimately disappointing. It would’ve been more appropriately titled “What are the parts of a 7 digit phone number and what do they do?”

Link number six comes closest to answering the question.
The short-term memory capacity for most people is between five and nine items or digits. This is one reason that phone numbers were kept to seven digits (not including area code).
No evidence is provided that 7 digit long phone numbers were chosen precisely because of this 7 + 2 nature of short term memory. A little digging around and I find a post by Jeff Atwood about the so called “The Magical Number Seven Plus or Minus Two“.  Following the links and we get the original 1956 paper by George A. Miller of Harvard University as collected and organized by Christopher Green on Classics in the History of Psychology.

A study by Nelson Cowan of University of Missouri follows up on the chunking angle from the Miller paper and seems to suggest that splitting the 7 digits into two chunks — one of size 3 and one of size 4 — is no accident. He proposes that the magical number is instead 4 chunks.

My personal experience tells me that I remember a phone better when chunked into a 3-3-4 structure (the first being area code) than if i just tried to remember a sequence of 10 digits. Picking 7 digits for the length of phone numbers seems reasonable to me if we want people to be able to remember it. This could be a project for a Stats class.

Questions/Activity for Statistics:
  1. Design a study to determine how many digits a phone number should have so that 99% of the population can remember it.
  2. How would chunking affect the length of the phone number that people can memorize?

UPDATE: Included Screencaps
UPDATE 2: Troubleshooting issues with this post.
UPDATE 3: Reposted here. Updated wording and organization.