Category Archives: News

SRHS Girls Who Code

Discovering The Crisis in Computer Science

Last week, a group of 16 girls, myself and one other instructor were invited to attend the showing of the documentary film CODE: Debugging The Gender Gap. This excursion was hosted by the Mill Valley Film Festival and included a post showing discussion with the filmmaker Robin Hauser Reynolds. We traveled to the Lark Theater with another group from our neighboring high school Terra Linda. Our group represented all the currently enrolled girls in STEM courses that offer some exposure to the field of Computer Science. The Terra Linda group was composed of both boys and girls who participate in an after school “coding” club, but none of these students are actually enrolled in a course that offers them academic credit in computer science because no such course is offered at Terra Linda.

IMG_2531Once we arrived, we sat back and watched an inspirational, sometimes shocking, movie about the state of Computer Science education and the lack of opportunities afforded young women in this ever important career field. Although there are many companies and academic institutions that are attempting to address these issues, the United States still lags behind many countries and the numbers, especially for girls and under represented populations, are still appalling.

The Numbers Are Bad For Everyone

For example, according to the movie (and some quick research I conducted), only 10% of all American high schools actually offer any courses in Computer Science, and only 5% offer the AP Computer Science exam. One would think that the numbers in California must be better than the national average because, after all, we are the center of the technology boom, right? Well, according to the numbers presented by ECS and the College Board, California isn’t doing very well either: “In California, less than 1 percent of all advanced placement exams taken in 2011 were in computer science”. The shocking thing about this statistic is that since 2011, there has actually been a decline in the number of students taking Computer Science courses in high school.

They Are Worse For Girls (and Abysmal For Students Of Color)

To make matters worse, the numbers of girls who took the AP Computer science test made up only 21% of the the original 1% of AP test takers. That’s .21% of all students taking AP tests. Of the over 320,000 AP tests taken in 2011, about 3100 were AP Computer Science, and only 650 were girls. That’s really bad, but consider that in 2011, of the 3100 AP Computer Science test takers, 29 were African American.

The Numbers In Marin Are Bad Too

The numbers of students being exposed to Computer Science in the San Rafael School District is somewhat typical of the national trend, but it does seem a bit strange considering our proximity to Silicon Valley. We have tech firms all around us, but so little of that energy and intellectual power seems to be trickling into the public school system.  Oddly enough, its not just a problem in the public school system. Many of the prestigious private schools in Marin don’t offer robust Computer Science programs either.

Terra Linda doesn’t have a single Computer Science course, and San Rafael just added one two years ago which is strictly an introductory course to the field. Neither high school offers an AP Computer Science course. The middle schools in our district are starting to offer some exposure to coding, but still are lagging far behind where they need to be.

Some Possible Reasons

There are some reasons for this that are systemic and institutional. For so many years, No Child Left Behind emphasized Math and English to the detriment of almost every other content area. Students were enrolled in double Math and double English classes in order to get their scores up on state wide tests, and enrollment in other classes like CTE and Art declined. Another problem is teacher certification. In the state of California, the AP Computer Science class is considered a Math class, so only teachers certificated to teach Math can actually teach this course. There has been a push to change this, through a supplementary authorization, but currently in the state, even if you have a degree in Computer Science, you can’t teach the course unless you have a credential in Math. The other problem is more philosophical. I am not sure if we should be seeing Computer Science as its own separate endeavor, but rather should be seeking to integrate CS into Math and Science and Econ. curriculum.

The other problem is actually due, ironically, to how financially successful a person can be if they possess a Computer Science degree (or other technical degree). Its hard for school districts to attract a teacher with these skills when they can get a job working in the tech industry that now typically have starting salaries in the six figure range.

What’s Next – SRHS GirlsWhoCode

After getting off the bus, the girls were clearly affected. And I wanted them to consider doing something about it, but I wanted them to take charge. I knew their ideas would be better than mine, and so the girls got together for a post viewing meeting and discussed what they wanted to do at our school to address this problem. The other instructor and I left them alone, and they proceeded to come up with a plan. They captured their ideas and now they are set to meet with the school’s counseling staff. These girls are an amazing group of highly motivated and talented people and I have no doubt that they are going to come up with a great plan. I’ll be updating this post as soon as an official plan takes shape. I look forward to helping them debug this problem.

Building The Central Force Model

From Lines To Angles, and Particles To Rigid Bodies

We dove straight into circular motion with the 2nd year students this past week. The primary focus of last year was linear dynamics and although we did study objects that moved along curved paths (projectiles), we were still looking at two-dimensional motion as being composed of two component motions along straight lines.

In the second year program, a good part of the first semester is dedicated to looking at objects that rotate around a central axis. There are two major shifts that will be introduced. The first is the introduction of an entirely new coordinate system – polar coordinates. The students spent most of last year learning about two dimensional vectors in Euclidean space, but this year, we will see that for objects traveling in various curved paths, a polar coordinate space can actually be much easier work with. The other shift will introduce students to collections of particles composed into continuous rigid bodies. This requires some significant changes in how the students view an object’s orientation in space and how an object’s mass is distributed. No longer can we assume that the object’s mass is located at a single point in space. In both cases, we are adding to the complexity of our conception of the universe by adding new representations of both space and the objects that inhabit that space.

Observing Circular Motion

In the modeling pedagogy, a new concept or collection of concepts is introduced using a paradigm lab. These labs are meant to introduce students to a new phenomenon and to be the launching off point of the actual building of a conceptual model.

Using the video analysis and vector visualization tools of LoggerPro, I had the students track the motion of a Styrofoam “puck” that was placed on our air hockey table (yes, we actually have an air hockey table that was donated to the school!) but was also attached to a thin thread to a fixed point on the table. The students used the video to track the motion of the puck as it essentially traveled in a circular path.

Although the lab is a bit tricky to set up, the ability to not only track the position of the object in two dimensions, but also the ability to attach velocity and acceleration vectors to the object is really helpful in engaging students in a great conversation around why the acceleration vector points to the inside of the circle. It also allows us to discover a whole new set of mathematical functions for describing motion. After tracking the position of the puck, we are ready for a class white board discussion.

The Graph Matching Mistake Game

I ask the students to draw the motion map of the puck’s motion in two dimensions including the velocity and acceleration vectors. I then ask them to include the graphs created by LoggerPro. LoggerPro produces a really interesting position vs. time graph in both the x and y dimensions. At this point the class knows the drill, and they use the mathematical function matching tool in LoggerPro to match the graph. I ask the students to include on their whiteboards the function that they think best fits the plotted data. This is where it gets really interesting.

IMG_1223

Notice in the above photo that the students used a polynomial function. I then ask the students to use Desmos to plot their graphs. Then I ask them to zoom out on the graph.

iozt61kwui

This is where they discover how this function can’t explain the position vs time data for an object that continually repeats the same path. Some of the students in the class recognize that the data is better explained using a sine function. Because not all the students have been introduced to this function, it presents an opportunity for some students to teach the other students about how these functions work.

IMG_7065

I allow the students to explore the sine function in Desmos, asking them to change the coefficients of the function in order to discover how these coefficients affect the graph.

zukr7fdnxr

The next step is to investigate more thoroughly the relationship between the acceleration and the velocity, as well as introduce the benefits of using polar coordinates to describe how an object’s position changes when you are dealing with an object that is traveling in a circular path. Desmos has the ability to change the graph type from the x,y coordinate plate to a polar representation. We discuss the difficulty of representing an object’s circular path using x(t) and y(t) functions as opposed to r(t) and theta(t) because r(t) is just a constant.

Next up, trying to answer the question: “If it’s accelerating inward, then why isn’t it speeding up towards the inside of the circle?!” Once again, the difficult concept of inertia…

3D Printing and STEM Education

As the Maker Movement spreads into the halls of nearly every school across the country, and with it the technologies that tend to be synonymous with that movement, I thought it might be useful for me to write a reflection about how we have used 3D printing in our program and some of the things that others might want to consider when thinking about investing in 3D printing for their school.

What is 3D Printing?

A 3D printer is any device that uses additive fabrication to essentially create some three dimensional object by building that object layer by layer. Currently the most popular way to do this in the educational sphere (because it is the least expensive) is to build the models by extruding melted plastic – similar to having a very precise hot glue gun. This has been the technology that we have used for the past five or six years in the Academy. Recently there has been an explosion in new inexpensive models coming to market that use light to harden photosensitive liquid polymers. These technologies (known as stereolithography  and digital light processing – DLP) use a focused light source or laser to harden the liquid layer by layer. The finished model in most cases is made of some kind of plastic – ABS, PLA, etc. Although the technology is moving forward with other materials, any kind of printer that would be used in a classroom environment is going to make plastic models.

Whatever the process of the 3D printer, these technologies are different from subtractive manufacturing which starts with a “chunk of stuff” and then carves the material away, leaving the 3D model. These always require some kind of cutting instrument like a hardened metal drill bit, or even possibly a laser or high pressure water jet. These methods are still preferred for the actual manufacturing of things like airplane parts, high precision medical instruments and all sorts of other machinery because these methods are highly precise and can be used to create parts from almost any material – metal, stone, plastic, etc. There are two issues with subtractive manufacturing though. The machinery is generally very expensive and learning how to use it properly is quite challenging.

If you would like to learn more about 3D printing in general, I suggest this great website:

http://3dprintingindustry.com/3d-printing-basics-free-beginners-guide/processes/

Our Printers

We currently have three operational 3D printers and one new DLP printer that we are currently assembling. The first 3D printer that we purchased was a Stratasys uPrint:

This printer has served us very well. It builds very precise models using really solid ABS plastic. Its precision comes at a cost though – it is quite slow. OK, its really slow! A nose cone for a rocket can take upwards of six hours to build! The other drawback of this printer is the cost and availability of build/support material. We just bought a complete restock of material and it cost us nearly $1700! Keep in mind that this should last us about six years to eight years.

The other two models that we have are the ubiquitous MakerBot Replicator 2’s. These are much simpler to operate (when they aren’t clogged) and they are much faster. They are also much less expensive. The uPrint cost us about $20,000 dollars including the rinse tank, while each MakerBot Replicator 2 cost us about $2200. Actually one of the MakerBots was part of a DonorsChoose/Autodesk program that cost us nothing (thank you donors and Autodesk!). The material for these machines is much cheaper – about $90 to $50 dollars per spool, as opposed to about $200+ per spool for the uPrint. The drawbacks of these machines is that they need constant maintenance, manual calibration, and the models that they build are not as accurate nor as precise.

We recently were very honored to be the recipients of a new 3D printer, donated by our high school’s parent organization – WeAreSR. Although we haven’t yet been able to use our new 3D printer from Kudo3D, we are excited by its potential. This DLP printer is said to have a much higher resolution, a much faster build speed, and a very large build volume. We will be posting an update once we get it running – which should be soon!

Rapid Prototyping = Rapid Learning

The really rewarding educational aspect of 3D printing, from a teacher’s perspective, is the acceleration of the learning cycle. Students can quickly identify weaknesses in their designs because they can have a part in their hands in literally hours, then make adjustments and have a new version fabricated, sometimes in a single class period. This would be nearly impossible ten years ago.

Now some might argue that it relieves students from the importance of having to think more carefully about their work, but I think this is outweighed by the advantage of allowing students to more quickly assess their spatial reasoning, and as long as we teachers force the students to also reflect on why their design failed or needed revision, then I think ultimately the students will learn more quickly.

This does not mean that we always allow the students to print whatever they want. We do act as “gatekeepers” to the printers so that we aren’t wasting student time, our time and resources. The models must pass a few minimal requirements, such as double checking dimensions, seeing if the model could be made more efficiently as multiple parts, etc.

3D Printing = 3D Spacial Problem Solving

The 3D printers have acted as a great arena for students to learn and develop their 3D spatial problem solving skills. To be clear, its actually the combination of 3D CAD software used to design the models and 3D printing to create the actualized models that helps students visualize, navigate and anticipate interesting three dimensional problems. Generally, the printers are used to create parts that are then used in more complex assemblies. The interface of these parts is where we see students encountering and having to solve complex spatial puzzles.

One of the things that I have witnessed is the advancing complexities of student designs as they become more familiar with the software and also develop their ability to mentally construct the spatial relationships between assembly components. At some point, I’d like to document this process and perhaps develop an assessment tool for measuring the development of these cognitive skills.

The Limitations (Not Star Trek Yet…)

The really amazing aspect of 3D printing is the ability to create real objects from imaginary ones with an almost perfect translation. I do think that it is important to realize that there are some limitations and also some things to consider before you run out and buy one of these things. Here are few things to consider:

All Those Plastic Things

One of my biggest complaints to the 3D printing industry is the lack of any clear and clean way to take 3D printed models that were unsuccessful and break them down back into raw materials for use in the printer. At the end of the school year, we have a fairly large bin of unwanted models that we collect for recycling. Some of the models are indeed recyclable while others are not depending on the material used. I think the manufacturers need to come up with a clear “cradle to cradle” solution for their printers that allow users to throw their models back into the machine to be re-extruded. It is theoretically possible and at least one company is offering a product called the Fillabot for addressing this issue.

Its Not That “Rapid”

Now, in relative terms when compared to milling, 3D printing is pretty fast, but it is actually slow in the context of the classroom. Even though its called rapid prototyping, it can seem really slow for some folks who are new to the world of manufacturing prototypes. You see, in the past, modelers would make a prototype out of clay, create a mold, cast the mold, make refinements, etc. Or one would calibrate and setup the CNC mill, have to change out bits, run test cuts, etc. In this context, 3D printing seems rapid. But its still not Star Trek.

The time can vary significantly based on the type of the printer, the complexity of the design, and the size of the model. This can be really frustrating for some teachers who want to be able to print an entire class’ models and have them ready for the next class period – that won’t happen. It can take hours to print just one model. You have to design your course in a way that allows the students to work on parallel tasks and then you need to have some way of keeping track of the printing queue.

It Won’t Make Everything

These machines are amazing, and we really love our array of 3D Printers, but experience has taught us that there are limitations to what they can make. Because all of these printers essentially work with liquified plastic, there are limits to the geometry of what you can build. As the models are built, they can “sag” or deform under their own weight. This can lead to small deformities, or catastrophic failures. Calibration can also be an issue with some of the less expensive or older printers. If the build plate is not properly leveled and calibrated, the entire build process can fail. Models with significant “overhang” can collapse, ruining the model.

Different printers deal with this slightly differently. Our MakerBots, for example, add “supports” to the model. These are little posts that act to hold up arching forms. The problem with this is that these posts then need to be removed from the model, and we have found this to be less than ideal. It adds extra time to the process because you have to do some post finishing work which can include filing and some sanding. Our uPrint actually adds a soluble support to the model that can be removed using a mild (but still toxic) solution. Again, this post processing adds a significant amount of time to the entire fabrication process.

Size is also a limitation. Don’t think for a minute that just because the build plate is 8 inches by 6 inches, that you can build a model with that footprint. You can’t. Once again, because you are dealing with liquified plastic that cools, it also shrinks. The larger the volume of the model, the greater the chance that the model will curl, buckle, and deform. Read the fine print from the manufacturer to get the real build size limit.

Easier, But Not Easy

The last point we want to make is that working with a 3D printing is certainly easier than running a 5 axis CNC mill, but they are not as easy to work with as an actual 2D printer. Adding that extra dimension has its challenges. Plan on spending quite a bit of time learning how to maintain your printer. Just like 2D printers, 3D printers “jam” all the time. The extruded plastic can get stuck in the nozzle and you can come back after several hours of printing and find that the very last cm of the model never printed because the nozzle is completely gummed up! Be aware that these can be infuriating moments that take significant amounts of time to fix. I have spoken to some teachers that got so frustrated that their printers ended up just sitting in a corner of the classroom, tragically unused.

Our Recommendations

Our recommendations are simple. Before you go out and buy one of these things, you have to be willing to put in quite a bit of time to maintain it and learn how to optimize your printer’s performance. There are tricks to optimizing each printer out there, and it will require that you watch some YouTube videos, dig through online support forums and be patient.

There are clear and obvious reasons to get one of these if you are running a STEM program, especially one focused on engineering or design. What might not be obvious is that these machines can also be incorporated into mathematics education, and definitely into a 3D art course or sculpture course.

There are so many models out there now, and they all claim to be the very best value. Each will obviously have advantages and disadvantages. Ease of use and less expensive generally means that your models will not be as precise or accurate. Inexpensive models can also be difficult to maintain. DLP printers are looking promising. They are coming down in price, they are faster and they are very precise. They can print models using different materials (like castable resin, or flexible resin). On the other hand, keep in mind that they are still more expensive, and they use a somewhat toxic resin that can be a non starter for some teachers.

Building the Electrical Current Model with The Amazing $25 Programmable Power Supply

Not Just For Teaching Robotics

Thanks to the generous donations of supporters of the Physics Academy, we were able to purchase a new set of Arduino Uno micro-controllers for use in this year’s robotics competition. As I was planning out the unit on teaching DC circuits, I realized that some of our DC power supplies might need to be replaced. I got to thinking – could the Arduino replace these hulking, expensive power supplies?

product.exps._hero.001.590.332

The answer has been (with one caveat) – yes. The above power supplies are nice, no doubt about it, but they are big, costly ($199) and they are not as nearly as extensible as a micro-controller.

Arduino_Uno_-_R3

The Arduino micro-controller can act as a fixed 5V power supply, or using its PWM pins, you can vary the voltage from 0V to 5V with a resolution of about 20 mV. The other advantage about using the Arduino is that it gives you a chance to teach a little bit of programming too! In our case, it allows for a great introduction to robotics well before we are ready to start our unit on robotics.

The one disadvantage is that you can’t test any circuits that need over 5V of electrical potential difference, nor can you test things like motors or other higher current (> 40 mA) circuits. We didn’t find this to be a big problem, but if you do, you can actually purchase a shield (an attachment that fits on top of the Arduino) from Adafruit Industries that allows you to use a higher voltage, higher current power supply that is controllable through the Arduino.

Mapping Electrical Potential (Voltage)

One of the first activities that the students do, which is a great activity from the AMTA curriculum repository, is to have the students “map” the voltage between two metal bars that are partially submerged in water.

IMG_1870

Using the Arduino as the power supply, the students use a multimeter to check the voltage at specific locations on a grid that is placed under the transparent pan holding the water. These numbers are recorded into a spreadsheet. Excel has a great tool for doing a 3D map of the values.

potentialmap

What results is a really nice visualization of the potential isolines and the spacial variance of the voltage, and thus the electrical field.

Ohm’s Law – A Flow Model

We then move from voltage maps to flow model. The students investigate how voltage, current and resistance are related to one another. The students begin by investigating the current flowing into and out of a resistor, and most are surprised to find that the current in the same flowing into a resistor as it is flowing out. They expect that current should be “used up” by the resistor – causing a bulb to glow for example. When they find that this is not the case, they either think that they have done the experiment incorrectly or that perhaps the multimeter is not precise enough. This confusion comes from the idea that they are expecting current and energy to be equivalent.

IMG_1918

The hydrology analogy is introduced as a possible model for describing this phenomenon. We discuss the movement of water past a water wheel, and how the water flowing into the wheel is equal to the amount of water flowing “out” from the wheel. Students quickly realize that the wheel still turns, not because the water is “used up”, but because the water looses energy.

The final challenge for the students is to confront the oddity that is parallel circuits. This is made a bit easier by thinking about the flow model, but the confusion with parallel circuits stems from the idea that a battery is a constant current supplier – which of course it is not. The Arduino, just like a battery, will increase the amount of current flowing from its digital output pins when more pathways are added for the current to flow. This is where I would be careful to make sure however that you don’t approach the 40 mA limit. If you do, you can get some weird results in your observations as the Arduino will naturally cut off current draws around this range to protect its electronics.

Conclusion

The switch to the Arduino has been quite successful, and as stated before, it launches the students into the robotics project with a knowledge that the Arduino is simply a controllable power supply. They learn very quickly from that point on that the Arduino can also act like a voltmeter too! Using its analog input and switching the digital pins to be input pins, the Arduino can also mimic the functionality of a multimeter. If you are considering new power supplies, I would recommend looking into this as an option.

Investigating The Projectile Particle Model

The Class Designs The Deployment Experiment

The video above shows the recent deployment activity where students predicted the vertical position of a projectile (a Hot Wheels car) as it traversed a known horizontal distance. The student predictions are identified by green sticky notes on the the left hand side.

The students first had to work out the problem on their own whiteboards before being given the sticky note that indicated the vertical position as measured above or below the red line. Most groups calculated the same position with two groups noting a sightly different prediction!

In this deployment, I set up the ramp, and told them that they had a photogate sensor at their disposal. They had to design the experimental procedure. A great discussion followed, and the class was quite successful as you can see (the students who had the significantly different prediction were able to hunt down their mistake – so everyone felt that the model “worked”).

Analyzing Projectile Motion in Video and Code

Prior to the deployment, students were asked to use a video camera to record the motion of a projectile. This is a great experiment to do with LoggerPro or some other video analysis tools that allow the students to track the position of the ball or some other projectile.

The students have also been learning how to simulate constant velocity and constant acceleration particle motion in Processing. We extended this to now include projectile motion, and the students analyzed simulated projectiles and compared the data gathered in the real universe to that gathered in the virtual universe. I will be writing about this process in more detail soon.

A Modernized Bridge Design Contest

IMG_0283

Modernizing An Old Classic

We have just completed the second project in the Academy for the 2014-15 school year. It was a huge success! This project takes a classic physics project and “upgrades” it by incorporating modern engineering design technology and fabrication techniques.

We started with a great project that is now available online through Engineering Encounters. This was a project that was originally published by Stephen J. Ressler of the United States Military Academy. It is a rigorous approach to designing and building bridges from file folders:

https://bridgecontest.org/resources/file-folder-bridges/

Its a great project with an incredible set of resources, background information, and step by step instructions. Unlike less rigorous and involved bridge design projects (using toothpicks for example), this project has the students building compression members (beams) and tension members (cords) and gussets to better model real world designs and to give the students the opportunity to learn and make decisions about which members to use in different parts of their own designs.

The only issue that we had with this project is that it requires the rather tedious process of having students trace out the unfolded beam designs onto file folder material and then use scissors and  blades to cut out each beam and cord. But we have a laser cutter! There had to be a way to incorporate both 3D CAD design and our laser cutter in order to modernize this process. We also knew that Autodesk Inventor had some really amazing tools for analyzing design structures.

From Sheet Metal To Manila Folders

Autodesk Inventor has an amazing set of tools for designing sheet metal parts. Using these tools, an engineer can construct 3D models made of folded metal parts made from just about any thickness of metal stock. Once you have designed the folded metal part, Inventor will create a flat pattern design for you that you could then send to a CNC plasma cutter to cut from sheet metal stock. You would then fold the part up manually and you would have your folded part.

Inventor gives you the ability to custom define the thickness of your stock, and some of the parameters around how it can be bent. We defined our stock to be as thick as manila folder paper. The next step is a bit tricky, but with the help of a great video I came across from Rob Cohee, we were able to define custom folded paper beam stock that the students could then use to build out their frames. Once again, Inventor has an amazing set of tools for defining structural frames (called The Frame Generator) that can then be populated with any kind of structural beam. You can also define your own structural beams that can be used to populate your frame.

I have included a video below that we use with the students to help guide them through this process:

Using the frame generator tool in Inventor also allows the student to miter and trim the beam members, which allows the students to focus on design rather than getting lost in the time consuming process of calculating the cut angles. The following video shows you how this can be done:

Once the students had designed the bridges, it was time to prepare the flat patterns and have the laser cutter do the work of cutting them out.

Fold, Glue, Repeat. (Some Assembly Required)

IMG_0353

The students prepare their flat pattern cut-outs for the laser cutter and then you let the laser “rip”! Its awesome to sit back and watch this machine cut. I never get sick of watching it! Having the students do this would take SO much longer, the cut parts would be less accurate, and as all CTE teachers know, one of the most dangerous tools in the shop is an Exacto blade.

IMG_0355

Some might argue that the “manual” process of cutting all these beams out by hand is “good for the students”, but we feel that saving time here allows us to use that time in other areas, such as virtual testing.  Before the students get to build their design, we ask them to use Inventor’s frame analysis tools to help them analyze potential weaknesses in their designs. The following video shows just how amazing this tool is:

Once the students have done their analysis and cut their construction members, its time for folding and gluing, and folding, and gluing, and … At this point our project does not differ from the Engineering Encounters project. The students use a sheet of paper (actually two 11 x 17 sheets) with an elevation view (printed from Inventor as a CAD drawing) glued to a board as a guide for assembling the beams, cords and gussets:

IMG_0351

IMG_0362

This process goes relatively quickly as the students have done all the prep work to make sure that the pieces all fit together. Once again, this really demonstrates how modern technology can allow the students to focus their attention on design.

To Break Or Not To Break

Once the bridges are assembled, its time to test them out. The performance metrics for the contest are not actually based on the strongest bridge but rather a more realistic approach. We have attached a monetary value to each beam, gusset and cord. The bridges are then tested to a set value – the required load. The bridge that holds that load and is “manufactured” least amount of money is then given the highest marks.

Once the bridge has been tested at the required load, we then give the students the choice to see just how much the bridges can hold before catastrophic failure. Most students (encouraged by both peers and staff!) decide to take their bridge to the limit.

Its always a fun way to end the project!

Simulating Planetary Motion (Using Code!)

Simulating Newton’s Law of Universal Law of Gravity

Interactive simulations (like those created by the University of Colorado – PhET) can be really nice for impressing students, and giving them a way to explore the dynamics of a simulation. If incorporated into a lesson well, they can add to the active learning process. The question that I always struggle with though is “are the students learning how the simulation works, or are they learning how nature works?”

I have a nagging feeling that the students would possibly get more out of being able to see the simulation source code, specifically the rules of behavior of the simulation, and then through “tweaking” the code, see how those rules govern behavior. I would like to develop curriculum that would allow my students more opportunities to explore the code “behind” the simulations. This presents a few challenges that have been identified by other great physics educators, and if you are thinking about doing the same thing – I would suggest reviewing their insights. I include a quote from Ruth Chabay’s brief, but very interesting article on this topic:

To integrate computation, especially programming, into an introductory course, it is necessary to minimize the amount of non-physics related material that must be taught. To do so it is necessary to teach a minimal subset of programming constructs; employ an environment and language that are easy to learn and use; ensure that program constructs match key physics constructs; provide a structured set of scaffolded activities that introduce students to programming in the con- text of solving physics problems

This was my first attempt at doing just this, and I had some success and realized that I have some work to do.

Which Code?

A popular programming language in the Physics Modeling community is VPython. I have chosen to use a different language to use called Processing. There are reasons I chose this language, but I am sure there are reasons one would choose VPython (or other languages). At this point, I have not had the opportunity to work with VPython, so this post will not attempt to compare Processing to other languages. Perhaps I will do so in the future…

Here are some general reasons why I like Processing:

  1. It’s free and open source.
  2. Because its built on a visual programming interface, its really easy for the students to create visual content on the screen, and it is very easy to create visual animations due to the embedded “draw” loop.
  3. The official website has great examples and tutorials. It is full of great code samples and quick tutorials. You can loose yourself for hours (or days!) just having fun exploring the examples and tutorials.
  4. The IDE is simple and very similar to the Arduino IDE, so if you plan on doing any Arduino programming, the similarity is nice for the students.
  5. There is a nice vector library for doing vector operations (.add, .mult, .norm, .dot, etc.)
  6. Its object oriented so that you can have the added benefit of teaching important programming concepts – though this might be why some people might not like it.

The Simulation

The simulation that the students were introduced to was a simulation that modeled Newton’s Law of Universal Gravitation. The students were given some instructions on the basic structure of the program, and I made sure that there was some guiding comments embedded in the code. This program was inspired/adapted from a similar program created by Daniel Shiffman who has also written an amazing book on simulating nature through code called Nature of Code.

The program defines two classes. First, there is the parent class called Particle. This class defines some basic attributes like location, velocity and acceleration as well as mass. It also has some basic functions that allow it to move and allow it to respond to a force. The second class is the child class called Planet. It can do everything that a Particle can (because it inherits from the Particle class), but it can also exert an attractive force on other Planets.  Here is the code below:

/* A parent class for all moving particles
class Particle {
  PVector location;
  PVector velocity;
  PVector acceleration;
  float mass;

  Particle(float x, float y, float m) {
    mass = m;
    location = new PVector(x, y);
    velocity = new PVector(0, 0);
    acceleration = new PVector(0, 0);
  }
  
  void applyForce(PVector force) {
    // Newton’s second law at its simplest.
    PVector f = PVector.div(force,mass);
    acceleration.add(f);
  }

  void move() {
    velocity.add(acceleration);
    location.add(velocity);
    acceleration.mult(0);
  }
}

/** 
 This class defines an object that behaves like a planet.
 Planet objects extend Mover objects, so they can move. They
 also can attract other planet objects.
 **/
   
class Planet extends Particle {

  float size;
  float G = 1;

  // To create a planet, you need to supply coordinates, mass, and size
  Planet(float x, float y, float m, float s) {
    super(x, y, m);
    size = s;
  }

  // This function allows a planet to exert an attractive force on another planet.
  PVector attract(Planet p) {

    // We first have to figure out the direction of the force
    // This creates a unit vector for the direction
    PVector force = PVector.sub(this.location, p.location);
    float distance = force.mag();
    distance = constrain(distance,size + p.size,500);
    force.normalize();

    // This is where we use Newton's Law of Universal Gravitation!
    // The stength of the attraction force is proportional to the
    // product of the mass of this planet and the mass of the other planet
    // as well as the value of G. It is also inverseley proportional to
    // the distance squared.
    float strength = (G * mass * p.mass) / (distance * distance);
    
    // To get the final force vector, we need to 
    // multiply the unit vector by the scalar strength
    force.mult(strength);

    // Return the force so that it can be applied!
    return force;
  }
  
  // Just displays the planet as a circle (ellipse)
  void display() {
    stroke(255);
    fill(255, 100);
    ellipse(location.x, location.y, size/2, size/2);
  }
  
}


/** 
  This program simulates the gravitational interaction between planet objects
  **/
  
Planet planet1;
Planet planet2;

void setup() {
  background(0);
  size(800,800);
  // Inputs for each planet:
  // (x, y, mass, radius)
  planet1 = new Planet(width/2,height/4,6000,60);
  planet2 = new Planet(width/2,height/1.25,6000,60);
  
  // This is where you can change the initial velocities of the planets.
  planet1.velocity.x = 0;
  planet1.velocity.y = 0;
  planet2.velocity.x = 0;
  planet2.velocity.y = 0;
}

void draw() {
  background(0);
  
  // f1 is a force vector that is created by calling the planet's attract function
  PVector f1 = planet1.attract(planet2); 
  // Now apply that force on the other planet.
  planet2.applyForce(f1);
  // Now deal with the opposite force pair
  PVector f2 = PVector.mult(f1, -1);
  planet1.applyForce(f2);
  
  // Allow the planets to now move.
  planet1.move();
  planet2.move();
  
  // Display the planets
  planet1.display();
  planet2.display();
}

Experimenting With The Code

The students could change the initial values of the planets, such as the starting positions, the masses and radii by changing the input values of these two lines of code:

planet1 = new Planet(width/2,height/4,6000,60);
planet2 = new Planet(width/2,height/1.25,6000,60);

The planets initial velocities could also be modified by changing the values assigned in these four lines of code:

planet1.velocity.x = 0;
planet1.velocity.y = 0;
planet2.velocity.x = 0;
planet2.velocity.y = 0;

The code that actually guides the strength of the gravitational attraction between the two planets is actually very simple. This is the magnitude of the force as defined by Newton’s Law of Universal Gravity in code:

float strength = (G * mass * p.mass) / (distance * distance);

There is some slightly complicated code that controls the direction of the force and how that force is then applied to the planet object’s state of motion, but I didn’t have the time to explain this, which was a bit disappointing (see below).

For The Future

I am currently really interested in incorporating programming into the academy program, but have found myself a bit intimidated by the challenges identified by Ruth Chabay. The most significant challenge is time:

In an already full introductory physics curriculum, there is little or no time to teach major programming skills. Students who are new to programming are also new to the process of debugging; teaching debugging strategies requires even more time…Working on programming activities only once a week in a lab or recitation section may not be adequate to keep knowledge of syntax and program structure fresh in the students’ minds.

I plan on taking some time this summer to see how I could integrate computer programming more significantly into the curriculum without causing the learning of Physics to suffer – that would of course defeat the purpose!