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!

Advertisements

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):

Leave a comment

Filed under computer science, math, teaching

Cold temperatures

Draft of a letter:

Over the past two days, many schools have tried to continue educating students in the midst of very cold temperatures. Students in many rooms had to huddle together in winter coats, hats, and gloves indoors. Some teachers in colder classrooms combined their classes with teachers in (slightly) warmer classrooms, with class sizes thus rising to 50-60 in some places and multiple lessons being taught simultaneously in the same room. Is learning really occurring for the majority of students being taught in frigid rooms, or combined in a classroom with multiple other classes?

Some students‚Äô parents kept them home because they didn‚Äôt want their children standing for long periods at a freezing bus stop, being put off the MTA bus to wait for the next one because of overcrowding, or trying to learn in classrooms that were unheated. Other parents pulled their children out of school when they found out the lack of heat, expressing outrage that the Baltimore City Public School System did not itself make the call to close schools, and gave misleading information when they claimed ‚ÄúSchool buildings were monitored for heat & water issues throughout the holiday break‚ÄĚ in a January 1st tweet. Low attendance due to these valid decisions, made looking out for children‚Äôs safety and well-being, compounds a pervasive chronic absence problem in Baltimore schools and puts our kids even further behind their peers.

This issue is not new; it has been going on for years.

I call on our leaders in my district, my union, and my state to do the following:

  1. Advocate for more state and federal funding
  2. Adopt clear and transparent standards for when schools should be closed due to extreme heat, extreme cold, and other in-building health hazards
  3. Allow principals more autonomy and authority in making the ultimate decision to close an individual school building
  4. Adopt contingency plans to provide services (that would normally be provided in school) to families and communities in the event of a school closure
  5. Improve communications to alert families and communities of an unplanned school closure

I will address each of the above calls in more detail.

At the root of this problem is a severe underfunding problem. In the early 2000s, the Thornton Commission studied the state funding formula and found that, by the Maryland state constitution‚Äôs guarantee of an ‚Äúthorough and efficient System of Free Public Schools‚ÄĚ, the Maryland state legislature should be providing $260 million more to BCPSS each year. Even with court rulings, Thornton was never fully funded, so over the past twenty years, Baltimore students and schools have been shortchanged by over three billion dollars, and have not been able to keep up with building repairs and renovations because of this. To fix this problem, I call on our union leaders, our school district leaders, our city leaders, and our state leaders to demand more funding now, not only to bring us up to “adequate” yearly funding based on Thornton (and its successor, the Kirwan commission) now, but also to make up for decades of neglect and crumbling infrastructure.

Additional funding is the only way we can truly rectify the educational harm that is being done to our children. Additionally, as a more immediate way to make sure that our children are not learning in inhumane conditions, I call on our district leaders to adopt the following recommendations, and I call upon our elected union leaders to advocate for these with the district and with the school board.

To begin with, there is little transparency in why the decision is made to close some schools due to lack of heat or water problems, while other schools with equally bad or worse conditions are not closed. I ask that BCPSS set clear and unambiguous standards in writing that dictate when a school’s temperature problems are severe enough to warrant closure of that building. For example, clear wording like:

‚ÄúIf temperatures are below 55 degrees in 25% or more of classrooms, a school will be dismissed. If fewer than 25% of classrooms are below 55, we ask that principals work with teachers to combine classes and/or move learning to warmer parts of the building.‚ÄĚ

Similar wording, of course, will be needed for circumstances of extreme heat in un-air-conditioned buildings.

Going hand in hand with this recommendation for a more transparent closure process, we recommend more principal autonomy and authority in making the call to close a school when a temperature or health hazard presents itself. Certainly communication with and consultation with the Facilities and Operations managers at BCPSS headquarters remains essential. But too often in the past, this has taken on an adversarial nature, with district personnel not believing a principal about conditions at their school, arguing that the health hazard is not real, taking hours to come out and measure, only measuring conditions in one or two locations and not where learning actually occurs. While consultation on the best course of action is important, more trust should be placed in principals who are on the ground at the schools to make the best decision for their school community.

Schools are primarily an educational institution, and as such, it is my belief that if weather or health conditions will severely impact the ability of the school to educate its students, school should not be in session. However, as BCPSS CEO Dr. Santelises pointed out in her letter, schools also provide a variety of other services to the community, one of the primary being free meals for students. I ask that BCPSS develop a plan districtwide, and work with schools to develop local community plans, for how some of these services can still be provided even when a school is forced to close due to unsafe or unconducive learning conditions. For example, some school districts allow for pickup of bagged lunches at a school with minimal staffing needs. Another possibility might be partnering with recreation centers, churches, community organizations, public libraries, or local businesses to help distribute food and/or other services.

If the above recommendations are adopted, with clear standards for when conditions at a school warrant closure, granting more authority to principals to make that call, and adopting a contingency plan for providing services, communication with parents and families will also need to be improved to deal with unforeseen closures of individual schools, at potentially later times, and to inform families of locations for other services. One possibility is enlisting teachers and parents in phone trees to help communicate more rapidly.

Sincerely,

Nick Yates

1 Comment

Filed under teaching

CS Ed Week, Part 2

To continue with my post from 12/4, a few more emails for Computer Science Education Week 2017!

Thu 12/7: Hour of Code week almost over!

Hi Patterson peeps,

Just a reminder that we are nearing the end of Computer Science Education Week. I hope you have all had the chance to try out one of the awesome lessons yourself and with your classes (or have plans to do so today or tomorrow!).

 

I leave you with this:

Fri 12/8: Last push РHour of Code!

As Computer Science Education Week draws to a close this weekend, let me leave you with three resources, two facts, and one reminder:

Resources:

  1. A new video from code.org in which basketball star Stephen Curry talks about coding and persistence
  2. A video produced last year, called¬†“Computer Science is Changing Everything”, that really hits home that CS is found in every field, from agriculture to medicine to dance
  3. If you’re not able to do a whole hour of code, check out this¬†five-minutes-of-code¬†¬†activity¬†in which you can design your own snowflake and holiday card (with thanks to Mr. Callahan)

Facts:

  1. CS Education Week was founded in honor of Admiral Grace Hopper, one of the pioneers of computer science, whose birthday is tomorrow 12/9 (if alive, she would be 111 years old tomorrow, which is sort-of a binary age!)
  2. Coding is for everyone, in the same way writing is for everyone, a way “to organize, express, and share ideas in new ways, in a new medium” (okay, maybe that’s an opinion and not a fact, but seriously, check out¬†this interview with Mitch Resnick¬†from MIT, it may change the way you think about coding).
Reminder:
  1. Don’t forget to send me student names and have your students who do the Hour of Code¬†complete the survey!
 snow
Happy holidays, and happy coding!
Nick Yates

Finally, here’s a photo of my colleagues and I encouraging everyone to “Code Like a Girl”:

CodeLikeAGirl2.PNG

Leave a comment

Filed under computer science, teaching

Computer Science Education Week 2017

Hi all, it’s CS Education Week! Am forming a blog post of the emails I send out to my school to encourage participation in the Hour of Code. Will update this post (or maybe a new one) as I email more.

 

Thu 11/30 (before CS Ed Week):

Greetings Patterson Family!

Next week is Computer Science Education Week, and we have celebrated this each of the last several years at Patterson by having students do an Hour of Code! Please check out https://hourofcode.com/us and consider picking one day next week to teach coding in each of your classes.

 

hourofcode.com
The Hour of Code is a global movement reaching tens of millions of students in 180+ countries. Anyone, anywhere can organize an Hour of Code event.

 

There are a variety of activities, including ones that can be done on computer workstations, ones that can be done on students’ call phones / mobile devices, and ones that are “unplugged” using cups or printable manipulatives etc. Depending on your classroom dynamic, you could also work together as a whole class to complete coding exercises on your teacher computer / projector screen. Or, if you’re feeling ambitious, you could try to come up with your own lesson that relates coding to your content area, and teaches problem-solving or algorithmic thinking (e.g. peanut butter and jelly making as clear communication, necessary for ELA/writing classes and also for writing computer code that breaks a process down into multiple steps and communicates them clearly to the computer to run).

 

FYI – for our ESOL population, many (though not all) of the computer-based coding activities have instructions in multiple languages that can be adjusted at the bottom of the screen.

Please let me know if you plan to do an activity, or if you want to chat about different possibilities. For computer access, I can offer my room for second period (all days next week) or fifth period (except Monday). There may also be laptop carts available on a first-come first-serve basis that you can follow the usual process to reserve. Additionally, I am interested in tracking which activities are used, as well as student names for certificates.
Happy coding!
Nick Yates
Mon 12/4 AM: The Hour of Code is here!

Greetings Patterson Family!

CS Education Week is here, and with it the Hour of Code!

Please consider teaching a coding lesson in one of your classes this week, so that we can help our students become creators of technology rather than merely consumers of technology.

Here are some intro videos to the HoC: https://hourofcode.com/us/promote/resources#videos (YouTube + download link in case YT is blocked)

Among the¬†activities, there seem to be two new ones for this year¬†that I’ve noticed near the top: Minecraft (three versions, one from each of the past two years, plus a new tutorial for this year) and Google Design-Your-Own-Logo-with-Scratch.

You can also sort the activities by the technology you plan to use (computers, student mobile devices, or unplugged Рno devices), AND nicely by content area (e.g. if you teach Science and want to teach a cross-curricular science+coding lesson):

code_options

 

Please let me know if I can help in any way, whether by consulting with you on which lesson might best fit your class, or having you bring your class down to my room, etc.

HAPPY CODING!

Best,

Nick Yates and the Academy of Engineering and Technology Team

Mon 12/4 PM: Google Doodle today celebrates 50 years of kids coding!

Hey Patterson people,

The Logo programming language, designed for kids with a turtle that moved around and could draw pictures, was invented 50 years ago! Today’s Google Doodle celebrated that fact. In case you missed it, and want to try it out,¬†here’s a link that will still work after today is over:¬†https://www.google.com/doodles/celebrating-50-years-of-kids-coding¬†.¬†It is a cool symbol-based (no words, so should work for students of any language!) HoC-style activity within a Google Doodle, with a rabbit trying to eat some carrots. Check it out!

 

Celebrating 50 years of Kids Coding #GoogleDoodle
Also, if you’re interested, there is an actual¬†Hour of Code activity¬†based on that original turtle (updated to the Python language), which can be found at¬†https://hourofcode.com/codehsturtle
Happy CS Education Week!

NY

Tue 12/5: Hour of Code subject recommendations

If you haven’t started the Hour of Code yet because you don’t have access to a classroom set of computers and aren’t sure what coding has to do with your curriculum, here are my recommendations for unplugged subject-specific activities!

  • Science –¬†Rock Paper Scissors,¬†with connections to biological population modeling¬†(unplugged activity plus presentation on teacher screen)
  • Social Studies – History of Codes and Ciphers (one lesson, plenty more material as well e.g.¬†wikipedia)
  • Art –¬†Algorithmic Doodles¬†(fractals & algorithms)
  • Math –¬†Hexahexaflexagons¬†(geometry, discrete math w/ directed graphs and finite state machines)
  • English / Language Arts –¬†Magical Book Magic¬†(computational thinking and patterns with words)

If any English teachers do have access to a set of computers, the Automatic Homework Excuse Generator looks pretty cool too!

Happy coding,

Nick Yates & the AOET Team

1 Comment

Filed under computer science, teaching

Sept/Oct Week Recap

Lots going on this past week!

Patterson held our 7th annual Community Fair and Back-To-School-Night last Thursday:

fair1

At the fair, we set up tables for engineering / computer science pathways, and for our STEM clubs (robotics, coding, cyber, engineering). I ran into Rudy Ruiz, formerly Baltimore City Schools’ executive director for college & career readiness and a supporter of our annual EDD Symposium, who is now with the Maryland Business Roundtable!

fair2.jpg

Friday was a chaotic day. With computers down all day for reimaging, we did code annotation in AP CSA, binary/octal/hexadecimal in AP CSP, and sketched out arc initials in CIM. We hosted our first monthly Patterson Girls (Who) Code mentoring lunch!

Monday back into the groove of things – my two engineering colleagues were out on a Manufacturing Week field trip to Northrop Grumman, where students assembled 3D-printed components into a “fidget cube”. AP CSP students coded their first apps in MIT App Inventor! (A “magic trick” app where a rabbit pops up out of a hat and a musical “ta-da” sound plays.)

Today was a long day, but a good one. AP CSA students are manipulating strings to use names and input information to create a new alien / science-fiction name for themselves. AP CSP students moving on to their second app. And in CIM we began our skills tracking system, which I will soon write a whole post about this year’s version of standards-based grading. CTE department meeting after school. Coach class and working with a colleague on 3D-modeling with Autodesk Inventor software. Saw a colleague engineering teacher from another Baltimore high school who stopped by. Then, leaving around 7pm, saw this sunset:

sunset20171003

#days18-21 #teach180 #180blog

Leave a comment

Filed under teaching

Hot Days of September

I know that I am super-lucky to have a classroom with two working air conditioners. But 90%+ of teachers and students in my school are not so lucky, and have to teach and learn in very inhospitable conditions. One teacher at my school recorded a temperature of 114¬į in her classroom this past Monday, and my school had the honor (or misfortune) of being written up in the Baltimore Sun on Tuesday:

Sun article: “Baltimore classrooms top 100 degrees: ‘It was impossible to learn.'”

114 degrees

Caption from Baltimore Sun: “A thermometer reads 114 degrees in a classroom at Patterson High School on Monday in this photograph posted on Twitter by Patterson English teacher Allison Greco. (Allison Greco)”

Issues of heat and cold and dilapidated building are not new to Baltimore, nor to this blog:

Leave a comment

Filed under teaching