I painted the wall on my new space in the basement to make it a dry-erase surface. Unfortunately, I did not have an eraser to use on it, so, I decided to make my own down at the TechShop. And what started as a simple project turned into a bit of a rabbit hole.
The Shopbot CNC router is great for cutting shapes out of wood. I started with simple rectangular 2 inch by 4 inch blanks with designs and patterns, but that truly does not take advantage of the technological possibilities. Map projections can have some interesting shapes, so I tried a few that I could find black and white vector-graphic maps for on the Wikimedia commons (Mollweide and Sinusoidal projections).
The Shopbot CNC mill cutting out a blank for a Mollweide map projection.
After a little sanding (of the edges and sides in particular) I put the wooden blanks on the laser. It helped to cut out a template for the wooden blanks to sit in so I could do multiple blocks at the same time.
Lasering on the maps.
I put on a few coats of polyurethane to protect the wood surface (I also tried a spray on sealer I had sitting around–we’ll see which one works better) and then attached velcro strips to the bottom.
Adding velcro to the erasers.
One of my old sweatshirts served as material for the erasing.
A few of the first erasers with a rectangular form.Erasers with different map projections.
This September a TechShop branch opened up in St. Louis. I’ve been aware of these neat Makerspaces for a few years now, so it was a pleasant surprise when one turned up in town. Even more surprising (and just as pleasant) was that a parent at our school, who was so excited by the opportunities that a place like the TechShop would offer to a school that tries to emphasize hands-on, experiential education, donated four memberships to the school–one for a faculty member and three for students.
Since there are some age restrictions on which machines minors can use–a lot of the woodshop is off limits until they’re 16 and even then adult supervision is required, I arranged a small application for the student memberships that was only open to middle and high-schoolers. Based on the response I got back, we split the annual memberships by semester, so we have three students using it this fall and three more will have access to them in the spring.
The way the TechShop works is that they have a wide range of equipment under one roof and once you take a safety and basic usage (SBU) class on the particular machine you want to use you can reserve time on the machines. There’s a wood shop with saws, sanders, a lathe, and a CNC machine; a metal shop with the same; a set of 3d printers; a set of laser cutters/etchers; a fabric shop with some serious sowing machines, including one that is computer controlled; an electronics shop; a plastics work area with vacuum forming and injection molding machines. They also do a set of interesting classes on using the design software and some interesting projects that can take advantage of the tools available–I have my eye on the Coptic Bookbinding, and the Wooden Bowl making classes. Finally, they’re set up with classrooms where you can bring students in for small STEAM classes, which includes things like using Arduinos.
Students etching an anodized aluminum luggage tag during their SBU class on the laser cutter/etcher.
So far, we’ve all taken the Laser class, and there’s just so much that you can do with the laser that we’ve been spending a lot of time experimenting. The students have been etching signs–including a grave marker for our goat MJ who recently passed away–as well as pictures, luggage tags, and making presents. Since this is a machine that the older students can use independently I’ve lost track of everything they’ve been doing.
I’ve also taken the woodshop wood CNC class, so my own experiments have been a bit more expansive, including making dry-erase erasers, floor-holders for quivers for the archery program, simple chemistry molecular model sets (just 2d), boxes for Ms. Fu’s math cards, and I’m trying to figure out how to make a clock.
This TedEd video explains a few common sorting methods used in computer science. Sorting can be a challenging computational problem because of the enormous number of comparisons between items that can be involved, so computer scientists has spent a lot of time looking into it.
The video below shows the Quick Sort method using Hungarian folk dance.
Previously, I showed how to solve a simple problem of motion at a constant velocity analytically and numerically. Because of the nature of the problem both solutions gave the same result. Now we’ll try a constant acceleration problem which should highlight some of the key differences between the two approaches, particularly the tradeoffs you must make when using numerical approaches.
The Problem
A ball starts at the origin and moves horizontally with an acceleration of 0.2 m/s2. Print out a table of the ball’s position (in x) with time (every second) for the first 20 seconds.
Analytical Solution
We know that acceleration (a) is the change in velocity with time (t):
so if we integrate acceleration we can find the velocity. Then, as we saw before, velocity (v) is the change in position with time:
which can be integrated to find the position (x) as a function of time.
So, to summarize, to find position as a function of time given only an acceleration, we need to integrate twice: first to get velocity then to get x.
For this problem where the acceleration is a constant 0.2 m/s2 we start with acceleration:
which integrates to give the general solution,
To find the constant of integration we refer to the original question which does not say anything about velocity, so we assume that the initial velocity was 0: i.e.:
at t = 0 we have v = 0;
which we can substitute into the velocity equation to find that, for this problem, c is zero:
making the specific velocity equation:
we replace v with dx/dt and integrate:
This constant of integration can be found since we know that the ball starts at the origin so
at t = 0 we have x = 0, so;
Therefore our final equation for x is:
Summarizing the Analytical
To summarize the analytical solution:
These are all a function of time so it might be more proper to write them as:
Velocity and acceleration represent rates of change which so we could also write these equations as:
or we could even write acceleration as the second differential of the position:
or, if we preferred, we could even write it in prime notation for the differentials:
The Numerical Solution
As we saw before we can determine the position of a moving object if we know its old position (xold) and how much that position has changed (dx).
where the change in position is determined from the fact that velocity (v) is the change in position with time (dx/dt):
which rearranges to:
So to find the new position of an object across a timestep we need two equations:
In this problem we don’t yet have the velocity because it changes with time, but we could use the exact same logic to find velocity since acceleration (a) is the change in velocity with time (dv/dt):
which rearranges to:
and knowing the change in velocity (dv) we can find the velocity using:
Therefore, we have four equations to find the position of an accelerating object (note that in the third equation I’ve replaced v with vnew which is calculated in the second equation):
These we can plug into a python program just so:
motion-01-both.py
from visual import *
# Initialize
x = 0.0
v = 0.0
a = 0.2
dt = 1.0
# Time loop
for t in arange(dt, 20+dt, dt):
# Analytical solution
x_a = 0.1 * t**2
# Numerical solution
dv = a * dt
v = v + dv
dx = v * dt
x = x + dx
# Output
print t, x_a, x
Here, unlike the case with constant velocity, the two methods give slightly different results. The analytical solution is the correct one, so we’ll use it for reference. The numerical solution is off because it does not fully account for the continuous nature of the acceleration: we update the velocity ever timestep (every 1 second), so the velocity changes in chunks.
To get a better result we can reduce the timestep. Using dt = 0.1 gives final results of:
which is much closer, but requires a bit more runtime on the computer. And this is the key tradeoff with numerical solutions: greater accuracy requires smaller timesteps which results in longer runtimes on the computer.
Post Script
To generate a graph of the data use the code:
from visual import *
from visual.graph import *
# Initialize
x = 0.0
v = 0.0
a = 0.2
dt = 1.0
analyticCurve = gcurve(color=color.red)
numericCurve = gcurve(color=color.yellow)
# Time loop
for t in arange(dt, 20+dt, dt):
# Analytical solution
x_a = 0.1 * t**2
# Numerical solution
dv = a * dt
v = v + dv
dx = v * dt
x = x + dx
# Output
print t, x_a, x
analyticCurve.plot(pos=(t, x_a))
numericCurve.plot(pos=(t,x))
which gives:
Comparison of numerical and analytical solutions using a timestep (dt) of 1.0 seconds.
We’ve started working on the physics of motion in my programming class, and really it boils down to solving differential equations using numerical methods. Since the class has a calculus co-requisite I thought a good way to approach teaching this would be to first have the solve the basic equations for motion (velocity and acceleration) analytically–using calculus–before we took the numerical approach.
Constant velocity
Question 1. A ball starts at the origin and moves horizontally at a speed of 0.5 m/s. Print out a table of the ball’s position (in x) with time (t) (every second) for the first 20 seconds.
Analytical Solution:
Well, we know that speed is the change in position (in the x direction in this case) with time, so a constant velocity of 0.5 m/s can be written as the differential equation:
To get the ball’s position at a given time we need to integrate this differential equation. It turns out that my calculus students had not gotten to integration yet. So I gave them the 5 minute version, which they were able to pick up pretty quickly since integration’s just the reverse of differentiation, and we were able to move on.
Integrating gives:
which includes a constant of integration (c). This is the general solution to the differential equation. It’s called the general solution because we still can’t use it since we don’t know what c is. We need to find the specific solution for this particular problem.
In order to find c we need to know the actual position of the ball is at one point in time. Fortunately, the problem states that the ball starts at the origin where x=0 so we know that:
at t = 0, x = 0
So we plug these values into the general solution to get:
solving for c gives:
Therefore our specific solution is simply:
And we can write a simple python program to print out the position of the ball every second for 20 seconds:
Numerical Solution:
Finding the numerical solution to the differential equation involves not integrating, which is particularly good if the differential equation can’t be integrated.
We start with the same differential equation for velocity:
but instead of trying to solve it we’ll just approximate a solution by recognizing that we use dx/dy to represent when the change in x and t are really, really small. If we were to assume they weren’t infinitesimally small we would rewrite the equations using deltas instead of d’s:
now we can manipulate this equation using algebra to show that:
so the change in the position at any given moment is just the velocity (0.5 m/s) times the timestep. Therefore, to keep track of the position of the ball we need to just add the change in position to the old position of the ball:
Now we can write a program to calculate the position of the ball using this numerical approximation.
motion-01-numeric.py
from visual import *
# Initialize
x = 0.0
dt = 1.0
# Time loop
for t in arange(dt, 21, dt):
v = 0.5
dx = v * dt
x = x + dx
print t, x
I’m sure you’ve noticed a couple inefficiencies in this program. Primarily, that the velocity v, which is a constant, is set inside the loop, which just means it’s reset to the same value every time the loop loops. However, I’m putting it in there because when we get working on acceleration the velocity will change with time.
I also import the visual library (vpython.org) because it imports the numpy library and we’ll be creating and moving 3d balls in a little bit as well.
Finally, the two statements for calculating dx and x could easily be combined into one. I’m only keeping them separate to be consistent with the math described above.
A Program with both Analytical and Numerical Solutions
For constant velocity problems the numerical approach gives the same results as the analytical solution, but that’s most definitely not going to be the case in the future, so to compare the two results more easily we can combine the two programs into one:
motion-01.py
from visual import *
# Initialize
x = 0.0
dt = 1.0
# Time loop
for t in arange(dt, 21, dt):
v = 0.5
# Analytical solution
x_a = v * t
# Numerical solution
dx = v * dt
x = x + dx
# Output
print t, x_a, x
After batting around a number of ideas, three of my middle schoolers settled on building a model skate park out of popsicle sticks and cardboard for their interim project.
A lot of hot glue was involved.
The ramps turned out to be pretty easy, but on the second day they decided that the wanted a bowl, which proved to be much more challenging. They cut out sixteen profiles out of thicker cardboard, made a skeleton out of popsicle sticks, and then coated the top with thin, cereal-box cardboard.
When they were done they painted the whole thing grey–to simulate concrete I think–except for the sides, which were a nice flat blue so that they could put their own miniature graffiti over the top.