## Finding grains

My colleague asked me to help him out with this image:

Grains in an SEM image (78 pixels per micron)

He needs to know the grain size distribution, and they’ve been having trouble automating this. He knew I’d been doing some work with Mathematica’s image analysis capabilities so he thought maybe I could make some headway. This post shows my current progress.

My first idea was do use EdgeDetect to find the boundaries:

This is the result of using EdgeDetect in Mathematica on the original image

This seems to isolate most of the grains, but I need Mathematica to isolate the areas that the edges separate. What I decided to do was to darken up the edges by dilating them and subtracting them from the original image:

original image with edges darkened and the rest set to white

Now I use the very cool MorphologicalComponents command to get this:

overlay of the identified grains on the original image. If it’s colored, it’s identified.

Here’s an animation that slowly identifies the grains:

Slowly reveals the grains (the last frame is shown in the previous image)

Cool, huh? I thought so. I’m waiting to hear from my colleague to see if this is the sort of identification he needs. My guess is that he wants something like a histogram of the areas of the grains. With ComponentMeasurements, that’s super easy:

Histogram of the areas of the grains (in square microns)

Ok, so now I admit to you my ignorance. I have no idea how people do this, though I did find this standard (paywall) at the American Society for Testing and Materials (ASTM). I’m hoping some of you can help me out with refining this technique. It’s really fast in Mathematica to run it, and I think it’s pretty robust, but it does clearly miss a few grains and inadvertently joins a few.

Thoughts? Here are some starters:

1. This is cool, but I’d love to know the exact Mathematica commands.
2. This is dumb, there’s a much better way to do it, and here’s how . . .
3. This is cool, can I send you all my data so that I can graduate sooner?
4. This is dumb, we pay grad students to do this by hand so that they learn to hate. Don’t make this available.
5. This is cool, but I bet it would struggle with . . .
6. This is dumb, it only worked this time because . . .

Posted in mathematica, physics | 4 Comments

## Human loop speed

Rhett Allain’s post about a human running around a loop has really got me (and him!) thinking (click through to see the video). I wondered if there was a more sophisticated way to do the calculation for the minimum speed needed. While Rhett tweeted out an approach based on integrating the “fake” forces involved, I wanted to see if I could do it more generally for a body with any moment of inertia.

My approach was to figure out the speed that an object with a moment of inertia (as measured about its center of mass) would have to hit the loop with so that it would have enough speed at the top to not lose contact with the surface.

Just like Rhett, I found it easier to think of the angular frequency, $\omega$, instead of the speed, at least at first. After playing around with this for a while, I’ve convinced myself that the angular speed necessary at the top is independent of the moment of inertia and is, in fact, the same as what you get with Rhett’s initial calculation:

$\omega_\text{top}\geq\sqrt{\frac{g}{r_\text{cm}}}$

How can you determine that? Well the centripetal force at the top has to be at least as big as the gravitational weight force, so that the normal force of the loop is at least zero (floors push, they can’t pull).

So if the rotation speed at the top is independent of the moment of inertia, is that the whole story? No, for two reasons: 1) what does it mean to say “how fast do you have to run?” and 2) do you slow down from the bottom up to the top due to the increase of potential energy?

First number 1: from the angular speed above, you can certainly figure out the linear speed that the center of mass has. However, that’s not where your feet are, and that’s probably a better place to measure your speed.

Now 2: if you were to do this with an ice loop with skates, you could just get a lot of speed at the bottom and coast through the ramp. That’s basically what I assumed for the rest of this post. If you’re running, I’m not sure if you’d be able to keep your speed up while running around, I guess I assume you’d likely slow down in a similar fashion.

So, given the rotational speed at the top, can we figure out the speed you’d have to enter the loop so that you’ll have that rotation at the top? Sure! All I did was figure out the total energy at the top and assume you have that same (total) energy at the bottom. If you have less potential energy at the bottom, you’d have to move faster. The nice thing is that the speed of your center of mass at the bottom is the same as your feet (assuming you’re approaching the loop on flat land).

$E_\text{total}^\text{top}=\frac{1}{2} I_\text{cm} \omega_\text{top}^2+\frac{1}{2} M r_\text{cm}^2 \omega_\text{top}^2+2 M g r_\text{cm}$

where the first term is the rotational kinetic energy around the center of mass, the second term is the translational kinetic energy of the body, and the third term is the additional gravitational potential energy compared with when the body enters the loop.

To find the speed at the bottom, we plug in the expression for $\omega_\text{top}$ and set that energy equal to the translational kinetic energy at the bottom $1/2 M v^2$, and solve:

$v_\text{bottom}=\sqrt{\left(r_\text{cm}^2+\frac{I_\text{cm}}{M}\right)\frac{g}{r_\text{cm}}+4 g r_\text{cm}}$

Note how you get the well known $v=\sqrt{5 g r}$ if the moment of inertia about the center of mass is zero (which would mean that the r becomes the radius of the loop).

But that’s not the whole story, since I’d rather express it in terms of these variables:

Schematic showing an extended body going around a loop

(sorry for the crappy drawing, I was in a hurry Note that now $r_\text{cm}=R-h/2$. With that we get:

$v=\sqrt{\left(R^2-Rh+\frac{5 h^2}{12}\right)\frac{g}{R-\frac{h}{2}}+4 g \left(R-\frac{h}{2}\right)}$

Ugly, right? But still interesting. Here’s a plot of the speed at the bottom for an R=1.5m loop for people ranging from 1 to 2 meters in height (note that I’m modeling a human as a rectangular bar with $I_\text{cm}=\frac{1}{12} M h^2$):

minimum running speed versus person height for R=1.5m

So what’s the upshot? Raise your hands when trying to run around the loop and you won’t have to run as fast.

Thoughts? Here’s some starters for you:

• I’m not convinced that the moment of inertia doesn’t affect the angular speed at the top. Prove it!
• I tried this after reading this post and now I’m in the hospital. What’s the name of your lawyer?
• Whatever Rhett says is law. You haven’t contradicted him have you?
• Don’t you have a real job?
Posted in fun, physics, twitter | 3 Comments

## flip squared check in

This semester I’m trying to flip my flipped approach. Here’s a quick description. Today was the best day so far doing it this way. It was the fourth day of class, and the others had been ok but not great, in my opinion. The first day we spent time on the Euler equation (complex numbers), vector calculus review, and linear algebra basics. I farmed out different things for each person to do and then they presented. It was a little fragmented and I don’t think everyone got a lot out of it. The second day we focused on Maxwell’s equations, again farming each one out to them. Again I felt it was a little disjointed, though, since it was mostly review, I wasn’t too worried about it. The third day went pretty well as we talked about what plane waves are. But today felt really good, so I want to describe why.

The topic was the index of refraction. The “daily question” was “Does light slow down in glass even though the speed of light is the same in all inertial frames?” Instead of jumping right on that question, I started by having them think about the trajectory of a single charged particle exposed to a plane wave. After working for ~5 minutes, I asked what some thought and got the answer that the particle would head in the direction of the field and then turn around and go back to where it started. We kicked that around a while and then I quickly coded it in Mathematica:

sol=First[NDSolve[{y''[t]==Sin[t], y[0]==0, y’[0]==0}, y, {t,0,10}]];

Plot[y[t]/.sol, {t, 0, 10}]

And they saw that they were wrong (have you put some thought into it yet?). What was cool was that their prediction matched a plot of the speed of the particle, just not the displacement.

So after we were ok with the trajectory, I asked whether that charged particle would emit any light. We went back to this great PhET simulation to see, after they put some thought into it themselves. They seemed pretty happy with the idea that a monotonic, though herky-jerky, motion would produce pulses of light.

So next I asked them to think about what would happen to lots of charges. After that we talked about atoms with heavy nuclei and light electrons. We came around to the notion of the electrons effectively behaving like they were attached to springs. So then we started playing around with this great resonance PhET simulation. It took a while, but I kept asking if they thought the mass oscillated with the same frequency as the driver, and whether it was in phase (or how much it was out of phase). Eventually we put these ideas on the board:

1. charged particles will oscillate with the same frequency as the light
2. They are most likely out of phase with the light
3. They are accelerated charged particles so they emit light
4. The light they emit is the same frequency as the shaking
5. Therefore the emitted light frequency is the same as the original light frequency
6. The emitted light is most likely out of phase with the original light
7. Particles further on in the material will experience the combined light of the original plane wave and the scattered light from the other particles.

Finally we were able to get their thoughts about the daily question. I asked whether the interpretation of bending light as a manifestation of light slowing down is wrong, if Einstein’s theory somehow didn’t apply, or something else. It was a cool discussion, involving ideas about how glass might not be inertial and how light might zigzag on its way through glass.

So here I did a little bit of lecture, talking about how multiple out-of-phase fields added, showing that the sum can lead to a total field with a slightly different phase. That phase shift happens over and over again at each scattering point, making the wavelength appear to shorten. Here’s the vid we analyzed:

100 randomly placed scatterers, all of whom shift the phase forward a varying amount (more as the movie plays). Note how the wavelength appears to shorten)

Basically, a single quick phase shift only places a single phase jump in an otherwise smooth sine wave. However, as you can see in that cartoon, lots of them together makes the wavelength appear to be shorter.

Where does that lead us? Well, if the wavelength appears shorter but the frequency is the same (see list above), then the speed appears slower! It’s an optical illusion! (get it?) In fact, it’s a remarkably powerful illusion. No photon travels slow. They don’t zigzag (because only the forward direction shows constructive interference for randomly placed particles), and they don’t pause during the scattering (it’s been confirmed to take less than ~10 attoseconds). They all cruise through at the speed of light. But the locations of constructive interference (the peaks in that cartoon) move at a different speed. Cool, huh?

So, that was a lot of fun, and they really asked some great questions. So why did I think this was a good example of flip the flip? Because if they had really read the book ahead of time, they would not have engaged as much with this conversation. How do I know? Because I’ve taught this many times. If they read the book, they’re stuck in Maxwell equation this and Polarization that (which is also important, of course).

Here’s the kicker. After all that, then we engaged with the book, following these steps:

1. light makes the charges slosh around
2. we assume they slosh at the same rate as the light
3. We assume that they slosh in a fashion linearly related to the amount of light
4. We plug in those assumptions into the wave equation (with a sloshing source term)
5. We see that it all works out as long as we let the index of refraction be related to the constant of proportionality in (3).
6. Ahhh! but the constant is complex because of the phase shift
7. therefore absorption has to happen

Now, 1, 2, and 3 were much better to work with my students on compared to previous times I’d taught this class because of the work we did ahead of time. Then I talked about the typical calculations/derivations I wanted to hold them responsible for and they asked me to provide a few screencasts to help them out. You can see them all here.

So I thought it went well for these reasons:

• They all engaged with a similar background right away
• They hadn’t seen what the trajectory of that first charged particle was, and their mistakes helped them learn
• They went on the speed-of-light tangent with me because they didn’t know it was a tangent
• The derivations were more fun to go over because they could see the physical explanations behind them
• I felt the whole day went better than the two previous attempts: 1) flipped with lots of homework due each day, and 2) flipped with standards based grading.
• The resources (scasts) that I made for them were completely tailored to their needs.

Ok, what do you think? Here’s some starters:

1. I’m in this class and I really thought that speed of light thing was cool. However, this sucked: …
2. I’m in this class and I was totally lost. I really wish I had read the material before I came.
3. I like this way of talking about the speed of light. Does it work in this situation . . .?
4. That’s not how light propagates at all! You should teach them this instead . . .
5. I think you lectured too much. It’s not flipped at all! Here’s what you should do . . .
6. I think you could do an even better job by . . .
Posted in physics, syllabus creation, teaching | 4 Comments

## Mind map standard

As I get my optics class together (it starts next week), I’ve been thinking about whether I should continue my old practice of developing a mind map of the course on a daily basis. Last time I taught the course, we would take time in each class to decide if anything needed to be added to the mind map. By the end of the term, the map was pretty impressive, but I don’t think the effort was worth it.

I’ve done work with mind maps before, including using them in final exams. I like them because students can demonstrate an understanding of what the big ideas are and how they’re connected. I figured that doing a daily activity like that would continue to get them to think globally about the concepts. However, I think each time we’d do it we’d just zoom in on the local stuff (the chapter we were in, for example) and not really focus as much on global concerns.

So here’s the new idea: A class standard called “I can make and describe a mind map of the course material up to this point using only 10 nodes.” When asked to assess it, the students would draw a mind map and talk about how they made their decision about the 10 nodes and why and how they think they’re connected. I limit them to 10 so that they don’t just do what I did last time, making the mind map continually larger as the semester goes along.

My hope is that they’ll have to recalibrate each time they are asked to assess it. It’ll be “active” from the beginning of the semester, with an initial due date of just a week later. So that’ll be a mind map talking about our earliest material (some complex numbers and Maxwell’s equations). Later, mostly in the oral exams, they’ll have to be judicious with their choices of the nodes.

One concern I have is that they’ll really only recalibrate the most recent material, giving, say, 6 nodes to old stuff and then use 4 for much more detail. I suppose I could be careful in assessing them, giving that particular approach a lower score.

So help me out. What do you think? Here’s some starters for you:

1. I was in this class last time and I thought it was great. I especially liked …
2. I was in this class last time and I thought it was a waste of time. Mostly I hated . . .
3. Why 10? I think you should do ____ nodes.
4. This is cool. You should assess it a little differently than your normal videos. Here’s what I have in mind . . .
5. This is dumb. Optics is part of physics, which is just a collection of facts to memorize.
6. This is cool, but I don’t think it would work in my class called . . .
7. I think what you did last time is better, you just have to tweak . . .
Posted in syllabus creation | 4 Comments

## Flip the flip for optics

Ah January. The time when I start to plan my spring courses and use this space to brainstorm. I probably won’t have as many posts as last year, but I do like using this blog instead of scratch sheets of paper.

I’m thinking of “flipping the flip” for my optics course. What I mean is to continue to provide resources that I need my students to engage with outside of class (in order to be ready for their assessments), but not have them engage before class. Instead, what would the course look like if class time was the first time they engaged with material? I’ve done this before, but that class wasn’t for majors and didn’t really have a clear set of material that I had to cover (physics of sound and music). This one might be one of the better major classes to try since it doesn’t act as a prerequisite for anything. I’m not sold on doing this, but I wanted to get the pros and cons down here to keep thinking about it.

One major reason for considering this is the crabbiness I always have about unprepared students in class. A few come having really studied the advance material, ready to engage more deeply, but a few come as blank slates and make interaction with the others hard. In the past I’ve been heard saying “oh well, sucks for them” and “I’ll just make those students work together rather than dragging the others down,” but I have to say that my recent class didn’t have any of that crabbiness in it.

Another reason to consider this is the great admiration I have for people who teach with the modeling pedagogy. I’m sure they nod their heads vigorously to the notion of having students interact with content before doing any homework with it. I’m trying to see if I can capture some of that spirit here.

The big downside, of course, is the potential to go super slow, doing things in class that could have been outsourced to resources like screencasts or textbook assignments. Mostly I’m worried that I’ll just go back to lecturing, which, to be honest, is a trap I fell into a bunch of times last semester.

What I want: The best days in my sound class were the ones where I’d show them something (a demo or a simulation) and they broke into groups trying to make predictions about what was going on. Things like “if you make the wave faster, we bet we’ll see more nodes” etc. We’d spend the day exploring things like that, and then we’d decide the learning goal of the day (“I can explain standing waves” or whatever). After that we’d decide what resources they’d need to be able to do well on an assessment of that learning goal.

So what does that look like in optics? Well, here’s a few examples of learning goals from the last time I taught the class:

• I can explain the plane wave solutions of the wave equation.
• I can derive the form of the complex index of refraction and the Lorentz Model for index of refraction.
• I can discuss the foundations of, usefulness of, and ramifications of the evanescent field in total internal reflection.
• I can calculate the polarization state of light after passing through an interesting system using Jones vectors and matrices.

I grabbed those because the verbs “explain, derive, discuss, and calculate” are the most common verbs we use. So how would I run a non-lecture class period that tackles those? Last time I put together chapter readings and screencasts that I wanted them to study before class so that in class we could do some examples, connect it to earlier work, plan lab etc. Now I’d want to do something like say “so what do you think a plane wave might be” or something so that we could dig in. I suppose I could have them work through the book’s derivation of something, and have them figure out where they get stuck. I’d either unstick them or we’d add it to the list of things they need resources for.

I’ve often gone to see the view counts of my scasts. It’s always interesting to see number like: N/2 views (where N is the number of students in the class) before class, 3N views before a big assessment. They use them, claim to learn from them, but don’t seem to always see value in doing it before class. Now, of course, I could do a better job of making class useless to them if they’re not prepared. But I know that just makes me crabby, and I’m always trying to reduce that.

So, an example. Let’s take the evanescent field (the field that exists on the other side of a total internal reflection barrier). In the past I’d do a scast and reading assignment showing the details of how you do the derivation. Then, in class, we’d do some calcs about how much light makes it to the other side. We’d also try to figure out more of the harder parts of the derivation. So now, here’s what I’m envisioning:

1. Prior to that class, just do something like show a vid of frustrated TIR. That’s it. No expectation that they do more than just think about it.
2. In class, ask what their thoughts are. I would hope to hear things like:
1. “How did the light know the other surface was there?”
2. “Every time I do TIR calculations my calculator barfs”
3. “Can you see the light between the two surfaces?”
3. I’d then ask what the mathematical foundation would be. They’d be familiar with the boundary conditions necessary, so I’d likely ask them to set those up for this situation.
4. I’d want them to play around with the math to see if they can figure out how the frustrated part works.
5. <not sure about this one> I’d show them a full result so that we could do an example or two.
6. We’d figure out the learning goal of the day
7. We’d figure out what resources they’d want.
8. I’d prepare the resources and post them

As I’ve written this, I’m getting more excited about this approach. Being there to diagnose what they’re struggling with (especially in a derivation) is likely much better than me guessing what they’re going to struggle with. I think I can keep us from falling behind by just saying that they’ll have to be really careful about what resources they want.

So what do you think? Here’s a few starters for you:

1. This is a good idea. I think you’ll especially be pleased with …
2. This is a dumb idea. Students have to come prepared in a flipped class because …
3. I thing the think you’ll be crabby about this time around is …
4. I’m signed up for this class and now I can’t wait. I’m especially excited about …
5. I’m signed up for this class. Where can I get a drop card?
Posted in syllabus creation | 7 Comments

## Object tracking in Mathematica

I’ve been playing with ImageFeatureTrack in Mathematica over the last few days. My interest is in helping me and my students track the beads on a swinging beaded chain (something we worked on quite a bit last summer). I just wanted to get a few of my initial results down here.

First, the raw footage:

Now the Mathematica commands:

all=Import["path-to-avi-file", {"Frames", All}];
tracks=ImageFeatureTrack[all];
Manipulate[HighlightImage[all[[i]], tracks[[i]]], {i, 1, Length[all], 1];

And here’s the movie that makes (Mathematica just makes a movie showing the slider going forward and back). I tried to export the whole thing as an avi running at the same speed as the above one but I ran into memory problems.

Here’s an animated gif of just the tracked points:

just the tracked points from the original video

And, here’s the traces of those particles (done with ListLinePlot[Transpose[track]]):

traces of all the tracked weights

The second command (the ImageFeatureTrack one) allows you to tell it what to track. However, if you don’t give it any coordinates (as I didn’t above) it finds features that it thinks are worth tracking. It takes a while (~2 minutes) but the results are pretty cool.

Here’s one more example where I dangled the camera and shook it around:

I’m pretty impressed, though I’m not sure this does any better than the very cool (and free!) tracker software. Maybe others can chime in about that. I know for sure my students really struggled to get tracker to grab all our data last summer, but I’ll let them weigh in on whether they think this is better.

Some comment starters for you:

1. This is cool, would it work with … ?
2. This is dumb, I could have done it better with …
3. This is confusing, can you explain ___ better?
4. I worked in the lab last summer and this is great because …
5. I worked in the lab last summer. I have spent months trying to forget that horror. Thanks for dredging it all back up.
Posted in mathematica, physics | 4 Comments

## Help me get more women in my engineering course

For two years now, I’ve offered what Hamline calls a First Year Seminar entitled “Hamline Engineering.” It’s been a fun class, featuring:

• daily challenges
• guest speakers (including a woman who works for the Army corps of engineers)
• catapults
• designing a year-long research activity that can take the place of general physics lab

The problem is that, for two years now, there’s only been one woman who’s signed up for the course. About all they know about the course comes from the blurb that’s printed up with all the blurbs from the other first year seminars. I figure I need to update mine to get more women interested. Here’s what I’ve used in the past:

Title: Hamline Engineering

Description:
How do engineers think? Are they any different from scientists? How can a Hamline education prepare me for potential engineering careers? What can I do with some super glue and a propane torch? These are just some of the questions we’ll tackle in this class. We’ll explore engineering challenges from lots of different directions, constantly checking that everyone has ten fingers and toes, of course. In order to understand as much as possible about the interconnections among engineering, science, and society, we’ll read about the history of engineering, talk with practicing engineers, tour engineering firms, and tackle various challenges. You’ll produce both written reports and YouTube videos to document your learning, including footage from our high speed cameras. You’ll also plan a year-long project that, if completed in the spring, can count as your General Physics I laboratory. Note that Calculus I (MATH 1170) is a co-requisite for this course.

Any help you could offer would be greatly appreciated. It’s due at the end of the month.

Edit (1/27/2014):

Here’s a new stab:

How do engineers think? Are they any different from scientists? How are engineers creative? What can I engineer that will help people? These are just some of the questions we’ll tackle in this class. We’ll explore engineering challenges from lots of different directions, constantly sharpening our own definition of engineering. In order to understand as much as possible about the interconnections among engineering, science, and society, we’ll read about the history of engineering, talk with practicing engineers, tour engineering firms, and tackle various challenges. You’ll produce both written reports and YouTube videos to document your learning, including footage from our high speed cameras. You’ll also plan a year-long project that, if completed in the spring, can count as your General Physics I laboratory. Note that Calculus I (MATH 1170) is a co-requisite for this course.

Some comment starters for you:

1. This class sounds cool, but the part that turns women off is . . .
2. The class sounds dumb. You’re a physicist/teacher, not an engineer. Get someone else to teach it who . . .
3. I’ve taken this class and it was awesome. What I especially loved was . . .
4. I’ve taken this class and it sucked. What especially sucked was . . .
5. Women are turned off from competitive challenges. Do less of those.
6. Women enjoy competitive challenges. Explain those better.
Posted in syllabus creation | 10 Comments