Category Archives: math

Pi Day 2019

Today was a very pi-saturated day for me (which is wonderful!). After waking up, I took a shower behind a pi shower curtain:

(that’s right, I have a shower curtain filled with the digits of pi, which are colored differently to make the shape of the pi symbol stand out…)

I dressed with a pi day t-shirt as my undershirt, and a pi tie (the same pi tie I wore last year).

On my way into work, I did a few pi day routines:

  1. reciting pi to myself to make sure I still know the digits (I usually falter in the mid 100’s and need to refresh my memory the day before so I’m solid at 200 like I was in high school, then I continue to practice that morning)
  2. buying some pies from the grocery store for my students
  3. decorating my board with pi digits and facts

We had been invited on a field trip to have our students celebrate Pi Day in Annapolis at the Maryland State House Office Building, with legislators, the lieutenant governor, and representatives from other schools and STEM education organizations. So we brought six students and three bins full of projects and things to show off, from our engineering program, our computer science program, and our STEM after-school clubs. We brought a 3D printer, which was a big hit, in constant operation producing little raven figurines which we gave away to visitors to our table (many of them younger children). We brought a laptop with Python and Java programs coded by my students that simulated flipping coins, drew a beautiful geometric flower, merged two photos together (a primitive Photoshop), and an “artificial intelligence” program that interacted with a weather API to obtain the current weather and give advice to humans on what to wear. Also some tablets with student-coded apps, and electronic devices like a robot butterfly, a random-number-generator dice LED board, and a soda-can lamp. There was also a solar-powered car, a hovercraft, and designs and blocks and shapes carved out by students using CNC mill and lathe.

For lunch there was pizza pi(e) and mini dessert pi(e)s, as you can see in the following picture of the students each holding up a slice of pie, a pie, or a pi:

Returning to school for my last period class and our after-school makerspaces club, we celebrated in the traditional way by eating more pie. 🙂

When I got home, my neighbors invited me over for a pi day and birthday celebration for their kid. So even more pizza pie for dinner, lemon meringue and key lime pies for dessert, and some discussion of pi day trivia at the dinner table, as well as anecdotes of how the neighbors celebrate pi day at their offices. A wonderful time!

Overall, lots of pi and pie from morning ’til night. A great way to celebrate a great day!

Here are some pi-day tidbits of news, information, and links about pi:

  • Today, Google announced that one of their employees, Emma Haruka Iwao, together with the Google Computing Engine, calculated pi out to 31,415,926,535,897 digits (i.e. pi times ten trillion digits, some self-referential humor in their choice of where to stop). This shatters the previous world record of 22 trillion! (sources: BBC, Forbes, 538)
  • Here are some ways NASA uses and celebrates pi.
  • As pi day gets more and more popular, I’ve seen more backlash of pi day skeptics recently (though nothing like the great pi / e wars and debates of my Williams College days, nor the great Pi/Tau Debate of 2011). I am still a pi fan, but here are some other numbers you might enjoy and wish to celebrate as well!
  • Since we handed out 3D-printed ravens as Maryland-themed souvenirs at today’s event, I feel like I need to re-post this link to the renowned retelling of Poe’s “The Raven” which has words of lengths equal to the digits of pi. Poe, E. Near a Raven.
  • In honor of my new neighbor’s birthday, there are some other famous folks who share a birthday with pi day: Many people know about Albert Einstein, but also Waclaw Sierpinski, the Polish mathematician famous for fractals, and also Alexey Pajitnov, the developer of Tetris. (h/t to Michael Lugo for the latter fact).

And finally, a few pi day jokes. Each image is linked to its source:

Hope you all had a wonderful pi day, and continue to celebrate math all year long!

Nick the Pi Guy

Advertisements

Leave a comment

Filed under computer science, engineering, math, teaching

Triangle Spaghetto?

So, this is an interesting question to think about…

If you were to break a piece of spaghetti randomly twice, to yield three smaller pieces, what are the chances that your three pieces would form a triangle?

spaghetto_poll.PNG

I encourage you to take some time to think about this before reading my solution.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

I had a little intuition based on the triangle inequality, which says that for any pair of sides of a triangle, their sum must be greater than the third side: a+b>c.

After making that guess, I actually tried to prove this to myself geometrically before moving to try a simulation via computer program, so I guess I’m still a mathematician at heart even though my current teaching load is all computer science courses! 🙂

tri_spaghetto

The outer triangle, AEF, is the probability space for the spaghetto we’re talking about, assuming (without loss of generality) that the original spaghetto has length 1. The x-axis represents our (random) choice for the first break, which could be any number between 0 and 1 with equal/uniform probability.  Let’s call the random number chosen x*. The y-axis then represents our (random) choice for the second break, which is now constrained with an upper bound of 1-x*, based on however long our first broken piece was (thus the hypotenuse of the right triangle, y=1-x). Only two breaks (or, equivalently, random numbers) are needed, 0≤x*≤1, and 0≤y*≤1-x*, since the third piece is completely determined by the first two, as 1-x*-y*.

Within our probability space, the bluish-green region in the lower right is out-of-bounds for trianglehood, since an initial break of my first piece x*>0.5 would mean that I’m left with a piece less than 0.5 which still needs to be broken into two, and that means those two pieces could never sum to more than my first piece (the triangle inequality). The magenta region near the top is similarly off-limits, even if my initial break is small enough, if my second break yields a y*>0.5, the first and third pieces could never sum to more than the second. Finally, the yellow region near the bottom represents non-triangles where both the first and second breaks are two short, yielding a combined sum less than 0.5, and therefore a third/final piece greater than 0.5 which would dominate the first two and thus not allow triangularity to flourish from our three pieces of spaghetti.

So the only triangularly-valid region is the center, which is 1/4 the total area of our probability space.

After becoming certain of this answer, I did mock up a quick random number generator function in Python:

py_spaghetto

While this was indeed closer to 0.25 than any other option in the initial poll, the fact that I ran 10,000,000 trials and got consistently less than 0.2 (and not closer to 0.25) does worry me that I coded one of the assumptions wrong. I’m still 99% certain that 0.25 is the correct answer. But if anyone spots a program error, or a logic error, please let me know!

Leave a comment

Filed under computer science, math

PI DAY 2018!

Happy pi day!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Pi Day as a holiday is 30 years old this year (unless someone had been celebrating quietly on 3/14’s before Larry Shaw publicly founded Pi Day at the San Francisco Exploratorium in 1988)!

While last year was a pi day snow day for us, this year the snow has mostly missed us in Maryland, while Boston area folks have had several huge storms in a row, and some of them do have a pi day snow day today!

The day was off to a good start this morning with a beautiful pi day sunrise:

I was up early to buy some pies, as per usual, when I stumbled across a pi-day pie sale! While I’ve seen photos of these before on social media, this is the first time I’ve actually come across one in person on a pi day myself!

 

I made my chalkboard a little busier than usual, including a few extra pi facts:

I also wore a new pi tie today (some years I’ve worn pi t-shirts). You can’t tell from the photo, but the image/pattern is made up of pi’s digits!

My first period AP CS A (Java / object-oriented programming class, with juniors and seniors) is the only class I did a pi-focused lesson with this year. In my other classes, we took a ten-minute pi and pie break, and talked about pi facts while eating, then back to our regularly-scheduled lesson. But in AP CS A, we coded an infinite series for pi in Java. We used the Leibniz formula, relatively easy to understand and code: 1/1 – 1/3 + 1/5 – 1/7 + 1/9 – 1/11 + 1/13 – …

This actually converges fairly slowly, compared to other infinite series for pi. Here are the results after ten terms, with the terms included on the left, and the running summation on the right of each line:

Here we are after 1000 iterations, just the sums:

And after a million terms, we’re getting pi accurate to five digits:

A million terms took a few minutes to run, so we didn’t dare try ten million, for fear we would break our ancient computers! Nor did we try to break the record of 22 trillion digits of pi, which would need many many times more terms if we were to use this series 🙂

Also today, in other news, a nationwide walkout against gun violence, which students at my school participated in as well. And I took two students on a field trip; the students had built a custom-engineered bicycle for a kid with a disability last month during National Engineering Week, and today we got to deliver the bike to the kid and his mother. So that was pretty cool.

Anyway, that’s how my day went, hope your pi day was similarly awesome!

Here’s my round-up of a few Pi Links:

And a few really creative pi-related photos, found via Twitter (linked to their sources):

1 Comment

Filed under computer science, math, teaching

Number Systems

Binary and hexadecimal today in AP CSP:

binary.jpg

hex.jpg

When I was in elementary school, I was fascinated with number systems. I know I read about some different number systems used by different cultures through history in a book of number history my parents had, and was also inspired by some discussion of binary / ternary / base-4 in The Math Curse. I asked my mom to explain them, and she did.

Somehow (I forget the source, if it was a news article or an “interesting fact” in some book), I got really into the Inupiaq number system, both the symbols and the base-20 place value system for writing them. I remember writing the date in the upper right-hand corners of my papers using Inupiaq numerals each day in Mrs. McCarthy’s 4th grade class (or was it 6th grade? — she was my teacher both those years).

Always lots of fun teaching number systems! One of my favorite topics. 🙂

#day16 #apcsp #teach180 #180blog

Leave a comment

Filed under computer science, math, teaching

Daily Agendas on Google Docs

I’ve been doing this with a few classes for the past two years, but this year made the move to all: I keep a Google Doc with the day’s agenda for each class. This is useful as a central location from which all of the day’s activities can progress, with links to assignment documents, links to online quizzes, links to videos, and links to resources all embedded in there. In review surveys at the end of each class, this has consistently been a highlight and something they really appreciate. For example: “The links on the agenda and the directions that gave us to do what we had to do”, and “Somenthing that I really liked about this class was the agenda because if by any reason you was absent you just have to go to the online agenda and you can make up from your home.”

Because of these reviews, this year I’m moving to all classes having an online agenda. Combined with the fact that I’m a fan of the tinyurl.com website for shortening and choosing your own url, I was laughing with a few of my students this afternoon that today I had my students use 5 different tinyurls for these agendas (and of course have to keep them straight in my head):

CSP_Agenda

[Year 12, Day 2 post]

 

Leave a comment

Filed under computer science, engineering, math, teaching

Year 12, Day 0

This week teachers headed into school to prepare for next week and students’ return. This will be my twelfth year!

My teaching this year will include more computer science than ever before:

  • AP Computer Science Principles (full year)
  • AP Computer Science A (full year)
  • Foundations of Computer Science  (spring)
  • Computer Integrated Manufacturing (fall)
  • Precalculus independent study (fall, three students, three separate periods)

I’ll also be working with our new engineering teacher and our librarian+new-computer-science-teacher to help them with their lessons, and collaborating with two geometry teachers around standards-based-grading.

Extracurricular activities and competitions:

  • Coding Club (app development, cybersecurity, & more)
  • Women’s Transportation Seminar’s “Transportation You!” Mentoring Program
  • TRAC bridge builder competition
  • CyberPatriot competition
  • STEM Competition
  • possible (in my mind, I want to do each of these this year): Cyber Movie Mondays, Saturday AP & PLTW study groups, Girls Who Code club
  • probably several others…

Ongoing projects that will occupy some of my time this year include:

  • Comp Hydro (teaching hydrology and flooding through computational simulations & modeling, in partnership with the Baltimore Ecosystem Study)
  • MyDesign (engineering design process app and learning management system, in partnership with NSF & the University of Maryland)
  • Internet of Things project to measure air quality and other environmental factors in schools (in partnership with Cool Green Schools, Johns Hopkins University, and Morgan State University)
  • Continuing work toward my Master’s Degree in Computer Science (taking “Artificial Intelligence ” course this semester)
  • Baltimore City Engineering Alliance, a nonprofit 501(c)(3) we created to provide opportunities to Baltimore City students to further their engineering education, and for which I am treasurer

School starts for students on Tuesday, after Labor Day for the first time in my twelve years here teaching in Baltimore. Wish us luck!

Leave a comment

Filed under computer science, engineering, math, teaching

Pythagorean Triple Answers

As a follow-up to yesterday’s post, here are some answers and steps toward figuring out the scarcity (or frequency) of Pythagorean triple days (like yesterday 8/15/17) in a century:

I will mention I did not get the answer right away but needed some prompting (from a math-teacher colleague on Twitter), so I’ll take you through my thought processes.

  1. I have certain primitive Pythagorean triples memorized (like 9/40/41) — perhaps from several years of teaching geometry, or from studying number theory in college where integer (or rational) values for algebraic relations are important (cf. Euclid’s formula for Pythagorean triples, Diophantine Equations, & Fermat’s Last Theorem), or perhaps even a few recalled from taking high school geometry. In my head I tried these, saw several had occurred already in the past (5/12/13), while others were not interpretable as months days and years, like 9/40/41 (since there are max 31 days in a month). To go beyond the primitive triples, I tried multiplying each times 2, times 3, etc. In this way I discovered yet to come this century: 10/24/26 (twice 5/12/13) and 12/16/20 (quadruple 3/4/5).
  2. I thought I had them all, but had forgotten some primitive triples, like 7/24/25! At this point, referring to this list of primitive Pythagorean triples, I tried to systematically enumerate all with a≤12, then go through multiples of those until all values were larger than 12 (and therefore none could fill the month slot). I did this in Excel, color coding as blue dates already past, yellow yet to come, and red invalid date formats:excel1
  3. In creating that chart I did mentally transpose months and dates to see for example, that 12/5/13 could also work as a Pythagorean triple date in addition to 5/12/13. But this only yielded more in the past so I didn’t bother to write them out. My fatal flaw, though, was not permutating with the years also, so I neglected to find two more future dates: 7/25/24 and 10/26/24. After realizing this, I did add more to my Excel chart, going through each permutation that yielded a valid date in rows below the main ones:excel2
  4. I do believe this is now a complete list of past, present, and future Pythagorean triple days, written month/day/year. By my count there will be a total of 28 this century, 23 now past and 5 still in the future. Let me know if I missed any!

 

By the way, here’s an awesome interactive generator of Pythagorean triples by Vincent Pantaloni (shared on twitter).

 

Enjoy!

 

 

Leave a comment

Filed under math, teaching