A few more MMA screencasts before the semester begins…

After going through all the things we plan to have students do computationally this semester, I realized I needed a few more screencasts to provide more support for students. I created three more:

Writing functions,

Using FindRoot,

and Writing for loops.

Ben Zwickl has posted more of his lab driven screencasts on our YouTube Channel, also. Feel free to use these in you classes. And I promise, more interesting posts are coming.

Comparing curricula using concept inventories

In the early part of my dissertation work, I was interested in comparing student performance on concept inventories. How things have changed!

Matt Kohlmyer, Michael Schatz and I wrote a paper comparing introductory E&M curricula using the Brief E&M Assessment (BEMA) in the early part of my career. You can find it here. If you want to review the BEMA, there’s a nice article here. Contact me directly if you’d like a copy of the BEMA.

In that article, we found that students taking Matter and Interactions (M&I) E&M performed better overall and on individual topics than students taking a pedagogically reformed, but traditionally sequenced E&M course at several different institutions. This led us to conclude that students taking Matter and Interactions were better prepared in E&M (as measured by the BEMA). The BEMA was specifically designed as the lowest common denominator concept inventory for E&M; hence, our conclusions were fair and justified.

In a new article that we have submitted to AJP, we performed a very similar comparison between mechanics courses: Matter and Interactions mechanics and the equivalent traditionally sequenced course. In this work, we used the Force Concept Inventory (FCI). Why? Because we had anecdotal evidence that Matter and Interactions students underperform on the FCI. This article is likely to be published in AJP which is not an open-access journal. I’m posting the preprint of the article in this post. But, it will eventually be on the arXiv.

Preprint of FCI paper

We found that students in M&I mechanics do underperform compared to students taking a traditionally sequenced course. However, in this article we did not conclude that traditional students are better prepared in mechanics. Why?

The FCI was not designed to compare curricula (or pedagogy, although it’s often used for this purpose). Moreover, the FCI is not aligned with the content and goals of the M&I course. One of the first things I learned about educational reform is the alignment of instruction and assessment. Clearly, the instruction in this case is not aligned with the FCI. In fact, the creators of M&I have clearly stated that this curriculum has fundamentally different goals (e.g., a 20th century introduction to mechanics) from a traditional course (e.g., 17th-18th century). We attempted to communicate these ideas in an earlier draft of the article.

When the preprint (and my thesis work) was originally picked up by the blog-o-sphere, our message was lost. Mark Guzdial, a member of of my thesis committee and eminent CS-ed blogger, concluded that “Computation + X doesn’t necessarily mean better learning in X“. While this might be true, it’s a terribly hard thing to measure. Nor do I believe my work in this area can make that conclusion. The whole course, not just the Python programming, is under consideration. Chad Orzel picked up an interesting thread, “practice matters.” That is quite true, but what is also important is the choice of evaluation instrument. To be fair, Chad makes a number of interesting remarks concerning the purpose of the introductory course. Is it to improve FCI scores? I think not.

In the above version of the paper, we have carefully laid out our message: concept inventories (in general) are limited. Concept inventories that are not designed with the content and goals of the course in question in mind are useful tools, but do not provide a complete picture of the course or what the students have learned. It’s very important that the evaluation match the instruction, otherwise, what are you measuring? Moreover, concept inventories are only able to compare students on concepts, methods, and tools which curricula both treat with equal intensity (like our BEMA work). Otherwise, there are caveats on the results.

Concept inventories also miss what are likely the most interesting aspect of curricular reform, the effect on new content, goals, and methods. How do we value these new effects? How are they weighed? Can we measure this? Such questions are important for those considering new ideas in their courses. And these are not easy questions are to answer. Nor are the answers fixed, but dynamically changing as we start to understand the purpose of our introductory courses.

In light of the underperformance by M&I students, is anything changing? Sure. My Georgia Tech collaborators are trying work within the curriculum to shore up conceptual difficulties. But, major changes are not planned. This is because we value the new concepts, methods, and tools of the M&I curriculum over a single measure of student performance.

Laplace’s Equation (and a useful script)

We will be starting Laplace’s equation after Thanksgiving. I wanted to create a little Mathematica problem for the homework in which students learn about relaxation methods. They would be attempting to solve for the temperature field on a 2D plate. Unfortunately, my Mathematica chops are still not up to snuff.

I did write this little Python script which uses a very basic relaxation method to compute the temperature field on a 2D surface. I plan to convert it to MMA over the break. Enjoy!

[Download]

from __future__ import division
import matplotlib
matplotlib.use('MacOSX') ## Change if you are using a different backend
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np

def SolveLaplace(nx, ny, dx, epsilon = 1e-5, imax = 1000):

    ## Initialize the mesh with some values
    T = np.zeros((nx+1, ny+1))

    ## Set boundary conditions for the problem
    T[0,:] = 100 ## Top Boundary
    T[nx,:] = 100 ## Bottom Boundary
    T[:,0] = 0   ## Right Boundary
    T[:,ny] = 0 ## Left Boundary

    ## Store previous grid values to check against error tolerance
    TN = T + np.zeros((nx+1, ny+1))
    err = TN - T

    ## Constants
    k = 1          ## Iteration counter

    ## Iterative procedure
    while k <= imax:

        for i in np.arange(1., nx):

            for j in np.arange(1.,  ny):

                TN[i,j] = (T[i-1,j] + T[i+1,j] + T[i,j-1] + T[i,j+1])/4.
                err[i,j] = np.abs(TN[i,j] - T[i,j])

        T = TN + np.zeros((nx+1, ny+1))
        k += 1
        errmax = np.max(np.max(err))

        if errmax < epsilon:

            print("Convergence after ", k, " iterations.")
            return T

    print("No convergence after ", k, " iterations.")
    return False

def PlotSolution(nx,ny,dx,T):

    ## Set up x and y vectors for meshgrid
    x = np.linspace(0, nx * dx, nx+1)
    y = np.linspace(0, ny * dx, ny+1)

    fig = plt.figure()
    ax = fig.gca(projection='3d')
    X, Y = np.meshgrid(x,y)
    surf = ax.plot_surface(X, Y, T.transpose(), rstride=1, cstride=1, cmap=cm.cool, linewidth=0, antialiased=False)
    plt.xlabel("X")
    plt.ylabel("Y")
    #plt.zlabel("T(X,Y)")

    fig2 = plt.figure()
    cs = plt.contourf(X, Y, T.transpose(), 32, rstride=1, cstride=1, cmap=cm.cool)
    plt.colorbar()
    plt.xlabel("X")
    plt.ylabel("Y")

    plt.show()

## Size of plate and mesh
nx = 32
ny = 32
dx = 1/128

epsilon = 1e-2 ## Absolute Error tolerance
imax = 10000    ## Maximum number of iterations allowed

T = SolveLaplace(nx, ny, dx, epsilon, imax)
PlotSolution(nx, ny, dx, T)

And here’s the visual output for two sides held at 100 degrees.

Our tacit knowledge (Thinking about Taylor series)

I’ve been bad about updating lately. This is mostly because the semester has really set in and I’ve found lots to do offline. I wanted to share an idea that I’ve been thinking about lately.

There are a number of things that we try to do in teaching: introduce new concepts, convey interesting information and provide students with practice using new tools and concepts. However, one practice that can make teaching very challenging (and might be neglected) is developing students’ habits of mind.

The tacit knowledge which we use daily to solve problems and design experiments is rarely communicated directly to students. In fact, as a student, I thought that many of these habitual practices were “tricks”. By the way, we don’t do them any justice by calling them “tricks”.

One such nugget of tacit knowledge is how we as physicists use Taylor series. Actually, we are often using MacLaurin series; I’ll come back to this in a moment.

We hoped to communicate some of these ideas early in the semester. We had developed a few clicker questions and a tutorial.

On the tutorial, most students demonstrated a good working knowledge of Taylor (MacLaurin) series (although they faltered a bit with interpreting their results). This might be because they had just answered several clicker questions and an example problem. Or it is likely because the tutorial had been altered (by the instructor) to include far more calculations, so they just got better at performing calculations. In this tutorial and on their accompanying homework, students received a lot of practice cranking through Taylor (MacLaurin) series. Some problems had a physical context, some didn’t.

However, many students were unable to perform four key functions:

  1. Identify the small parameter in the equation to be expanded
  2. Execute the expansion efficiently
  3. Compute a Taylor (not MacLaurin) series
  4. Interpret the results

Now, only the first three of these are related to Taylor series. The last one is part of a larger problem which students at this (and other) level exhibit, the disconnection between math and physics (saved for a future post). I’ll discuss the first three, each with an example.

Identify the small parameter

Consider the following equation which compares the acceleration due to gravity between the surface of the Earth, R, and some distance above it, d.

\Delta g = \frac{GM}{(R+d)^2} - \frac{GM}{R^2}

Students were given an equation similar to this and asked to determine the value of \Delta g in that d was near the surface of the Earth. A student (we’ll call him “Lionel”) came to my office to ask about this problem.

Lionel works with a large (~10) group of students and mentioned that his study group was unable to satisfactorily answer this question. I asked what he and his group tried to do. He immediately said they had no idea which variable was the “right” one and they tried R, d and R+d, but the group wasn’t sure what to do. The group was unable to identify the small parameter and thus tried all the possible variables. In addition, they were at a loss as to what value to expand about, they decided that zero was the logical choice.

Each of these variables could be used to determine a Taylor expansion of the function \Delta g, but which one is the right choice?

Most physicists would form a small parameter given the context of the problem. In this case, by dividing out R^2 in the first term, you’ll get a small parameter d/R. You can then compute the MacLaurin series in d/R, because this value is close to zero. It’s also possible to use R+d, if you compute the Taylor series about R.

Executing the expansion efficiently

One of the major benefits that I see to being a physicist is the ability to build a quick model and get an approximate answer quickly. So, I’ve committed a few expansions to memory (e^x, sin x, cos x, ln(1+x), etc.). Our students are still learning the benefits of this tacit knowledge.

When our students compute a Taylor series (after they’ve gotten through the mess of identifying the small parameter), they tend to use the full form of the Taylor series.

\Sigma_{n=0}^{\infty} \frac{f^{(n)}(x_0)}{n!}(x-x_0)^{n}

Now, this method will always work. But it can be very inefficient.

Suppose a student has been asked Taylor expand a function that is predominantly polynomial, maybe with a ln(1+x) added to the end of it. Such an equation appears if you consider the vertical position of a particle that experiences linear drag as a function of its range.

I interviewed a few students who were attempting to Taylor expand this function. All but one (who was a very strong student) tended to take derivatives of the entire function and evaluate them. Most physicists have adopted the technique of searching for the non-polynomial terms and replacing them with the first few terms of the recalled expansion. The binomial expansion was my savior for graduate E&M.

While students might eventually produce the correct answer (after a significant amount of algebra; none did in my interview), such a habit is good for physics students to acquire. It will make their life easier and enculturate them into the spherical cow club.

Perform a Taylor Expansion

Many of the examples of Taylor expansions in undergraduate studies tend to actually MacLaurin series (a Taylor expansion about 0). So when students are asked to compute a Taylor series then tend to fail.

Now, you might think, “well, if all the examples are around x=0, why should we bother with others.” Changing the point about which we compute the Taylor series exposes the fragility of students knowledge of Taylor series. In addition, many problems in science and engineering do not produce nice functions where the expansion variable or the point about which the expansion should be performed are immediately clear as our cooked-up examples. So, a thorough working knowledge of Taylor (not just MacLaurin) series is important.

On a recent exam, we asked students to compute the Taylor expansion (up to the first non-vanishing, non-constant term) of a position function about some non-zero value for the time, t \approx \tau.

x(t) = v_{x0} \tau (1-e^{-t/\tau})

Roughly 50% of the students computed the expansion about time equals zero; many of whom plugged in the non-zero time value to obtain a function with no time dependence. Only 10% of students solved this problem correctly.

What does this all mean?

For me, this is a lesson in the failure to fully explicate the tacit knowledge which physicists use that we want our students to employ.

These three problems might be mitigated by additional activities: Students might explore MacLaurin expansions by choosing different parameters and evaluating they expansions utility. They might evaluate the efficiency of computing a Taylor series using the formal method and the “search and expand” method. Finally, some experience with Taylor series around non-zero points would not be the worst thing in the world.

I’m planning to investigate each of these issues in detail with a few more interviews and some new questions. These investigations will hopefully codify students’ challenges with Taylor series and help to improve the quality and focus of activities that we are developing to meet these challenges.

But, ultimately this work begs the larger question, “what tacit knowledge do you assume your students are using?”

Should we crowd-source curriculum development?

I had a great meeting with Phil Wagner today. We were chatting about Google’s efforts to jump-start the development of computational thinking curriculum for K-12 students. This is work in which I am quite interested (along with John Burk and John Aiken). Phil (and Google) has some very interesting ideas about how to develop materials for computational thinking curricula in math, science, and the humanities. If you missed Phil’s talk at the Global Physics Department meeting last week, you should really give it a watch. He’s working on some very interesting stuff.

In talking with Phil, I notice that Google employs different model from a traditional “research-based” approach at work for the development of curriculum. Not better or worse, just different. This leads me to ask the question: Should we crowd-source curriculum development? And what does that mean for those of us who work in educational research?

Continue reading

Learning to Plot with Mathematica

I’ve just posted my first Mathematica screencast, Plotting with Mathematica.

I’ve introduced functions in a way that I hope illustrates how general they can be. For example, when introducing plot I start with:

Plot[function,{range}]

rather that what I want students to do:

Plot[Sin[x],{x,0,6*Pi}]

So what do you think?

I hope to have another Mathematica one posted soon and a set of Python ones to follow.

EDIT:

Andy Rundquist has provided a great tip for Mathematica users who are trying to figure out the inputs for a function.

Windows users type Ctrl+Shift+K and Mac users type Command+Chift+K after entering in the function. To search for the function start typing its name and hit type Ctrl+K (either OS) to get a list of functions matching the first few letters I wasn’t aware of this short-cut.

Here’s a link to his video below.

Thanks Andy.

Mathematica won. Ok, what can we do about it?

As I’ve mentioned before, we are planning to systematically introduce computation to the physics majors sequence. One the major decisions that we needed to make was which computational tool to support.

I’m somewhat saddened to say that a commercial piece of software has been selected as the tool that will be used at CU-Boulder.

Continue reading