Showing posts with label Education. Show all posts
Showing posts with label Education. Show all posts

Saturday, April 15, 2017

Qubits or Wave Mechanics?

A few days ago Sean Carroll tweeted a poll:

As someone who’s been wrestling with this question for 30 years, I perked up at this tweet, and not only voted but even tweeted a couple of responses. It’s a fascinating question! 

The second answer is the traditional one, and there are many good arguments for it: a solid experimental basis in phenomena that are easy to demonstrate; vivid images of wavefunctions for building intuition from classical waves; and a huge array of practical applications to atomic physics, chemistry, and materials science. The down-side is that the mathematics of partial differential equations and infinite-dimensional function spaces is pretty formidable. Mastering all this math takes up a lot of time and tends to obscure the logical structure of the subject. Especially if your main interest is in the new field of quantum information science, this is a long and indirect road to take.

Hence the alternative of starting with two-state systems, which are mathematically simpler, logically clearer, and directly applicable to quantum information science. The difficulty here is the high level of abstraction, with an almost complete lack of familiar-looking pictures and, inevitably, no direct connection to most of the traditional quantum phenomena or applications.


A fundamental challenge with teaching quantum mechanics is that it’s like the proverbial Elephant of Indostan, with many dissimilar parts whose connections are difficult for novices to discern. From various angles, quantum mechanics can appear to be about Geiger counters and interference patterns, or differential equations and their boundary conditions, or matrices and their eigenvalues, or abstract symbol-pushing with kets and commutators, or summing over all possible histories, or unitary transformations on entangled qubits. Stepping back to get a view of the whole beast is challenging even for experts, and bewildering for “blind” beginners.

I think most physicists would agree that an undergraduate degree in physics should include some experience with both wave mechanics and two-state systems. Carroll’s Twitter poll, though, asks not what a degree program should include, but how we should introduce physics students to quantum mechanics. That’s a hard question, and one’s answer could easily depend on any number of further assumptions:
  • Who exactly are these “physics students”? Students taking an introductory course, which may be their last course in physics? Typical undergraduate physics majors? Undergraduate physics majors at Caltech? What’s their math background?
  • How long an introduction are we talking about here? A single lecture, or a few weeks, or an entire course?
  • Will this introduction be followed by further study of quantum mechanics? In other words, is the question merely about the order in which we cover topics, or is it also about the totality of what we should teach, and what we can justifiably omit, when we design a course or a curriculum?
  • Are we constrained to use existing resources, including textbooks, instructor expertise, and locally available lab equipment? Or are we dreaming about an ideal world in which any resources we might want are magically provided?
Due to all these ambiguities, we should interpret the poll results with caution. Carroll’s interpretation was that the winning second option “probably benefits from familiarity bias. I’ll call it a tie”—so I infer that his own preference is to start with two-state systems. I agree that some respondents were probably biased in favor of what’s familiar, but I also suspect that Carroll’s Twitter followers have more interest in fundamental theory, and less interest in atoms and molecules, than would a random sampling of physicists.  I also wonder if some respondents weren’t biased in favor of what’s unfamiliar: it’s easy to suggest a radical curricular change if you’ve never actually tried it out and had to live with the unintended consequences. Carroll himself is currently teaching an advanced quantum course that emphasizes two-state systems, but as far as I can tell he has never taught a first course in quantum mechanics for undergraduates.

No professional quantum mechanics teacher should be completely unfamiliar with the two-state-systems-first approach, because it’s used, more or less, in Volume III of the Feynman Lectures on Physics, published in 1965 (thirty years before Schumacher and Wootters coined the term qubit!). I say “more or less” because Feynman actually starts with two-slit interference and other wave phenomena, and then he introduces a three-state system (spin 1) before settling into a lengthy treatment of spin 1/2 and other two-state systems.

There are also some well-known graduate-level texts that begin with two-state systems:  Baym’s Lectures on Quantum Mechanics (1969) and Sakurai’s Modern Quantum Mechanics (1985).

At the upper-division undergraduate level, the earliest text I know of that takes the two-state-systems-first approach is Townsend, which first appeared in 1992. Several others have appeared more recently: Le Bellac (2006), Schumacher and Westmoreland (2010), Beck (2012), and McIntyre (2012). Instructors who want to take this approach in such a course can no longer complain about the lack of suitable textbooks.

But at the lower-division level, where most students first encounter quantum mechanics, the pickings are still slim. Nobody actually teaches out of the Feynman Lectures. You could try to use a few chapters out of one of the more advanced books (McIntyre would probably work best), or you could use Styer’s slim text The Strange World of Quantum Mechanics (2000, written for a course for non-science majors), or you could use the new (2017) edition of Moore’s introductory Six Ideas textbook (which inserts three short chapters on spin and “quantum weirdness” in between electron interference and wavefunctions), or you could try Susskind and Friedman’s Theoretical Minimum paperback (2014, an insightful tour of the formalism with little mention of applications—see Styer’s review here).

I suspect that the time is ripe for someone to write an otherwise-conventional sophomore-level “modern physics” textbook that introduces quantum mechanics via two-state systems and qubits before moving on to wave mechanics. I really wish Moore would expand his Units R and Q into a more complete “modern physics” text!

Personally, I’ve had a soft spot for spin ever since I took a quantum class from Tom Moore in 1982, at the end of my sophomore year (after a conventional “modern physics” class) at Carleton College. This half-term class was mostly based on Gillespie’s marvelous little book, which lays out the logic of quantum mechanics for a single spinless particle in one dimension. But Moore departed from the book to introduce us to two-state and three-state spin systems as well, even writing a simple computer simulation of successive spin measurements for us to use in a homework exercise. The following year I saw more spin-1/2 quantum mechanics in the philosophy of science course that I took from David Sipfle, using notes prepared by Mike Casper, probably inspired by the Feynman Lectures. So when I took Casper’s senior-level quantum course after another year, I was well prepared.

A few years later, while procrastinating on my thesis work during graduate school, I converted and expanded Moore’s computer simulation into a graphics-based Macintosh program. Moore and I published a paper about this program, and how to use it at various levels, in 1993. From there the concept made its way into Moore’s Six Ideas course, and also into the Oregon State Paradigms curriculum and McIntyre’s book. Last year I ported the program to a modern web app.

I recount this history mainly to establish my credentials as an experienced advocate for, and contributor to, the teaching of quantum mechanics via two-state (and three-state) spin systems. So you may be surprised to know that on Carroll’s quiz I actually voted against this approach and in favor of starting with the traditional wave mechanics. And in my own teaching I’ve actually never started with spin systems: I’ve always started with one-dimensional wave mechanics in both upper-division quantum mechanics and sophomore-level modern physics. In calculus-based introductory physics I teach a little about wave mechanics and don’t really cover two-state systems at all. My reasoning is simply that for these students, in these courses, the balance of the pros and cons listed above seems to weigh in favor of starting with wave mechanics.

Meanwhile, I think there are opportunities to improve on the way we teach wave mechanics. One serious drawback with most wave mechanics text materials is their relative neglect of systems of more than one particle. As a result, students tend to develop some misconceptions about multiparticle systems, and don’t hear about entangled states—an important and trendy topic—as early as they could. I’ve recently written a paper on how to address this deficiency, with some accompanying software to help students visualize entangled wavefunctions.

My bottom-line opinion, though, is that the best answer to Carroll’s question depends on both the students’ needs and the instructor’s inclinations. Back in 1989, Bob Romer published an editorial in the American Journal of Physics titled “Spin-1/2 quantum mechanics?—Not in my introductory course!” But he hastened to clarify: “not in my course, thank you, but maybe in yours”—enthusiastically encouraging instructors to innovate and to follow whatever teaching plan they believe in. I wholeheartedly agree.

Thursday, March 17, 2016

Ivory Tower

Thanks to the Utah Film Center and all its generous supporters, I just saw a free screening of Ivory Tower, the 2014 documentary about the problems facing American higher education.

For the most part I thought the film was excellent. It focused on the crisis of rising tuition and student loan debt, and touched on most of the reasons why this crisis has arisen: growing enrollments, shrinking state subsidies, and increased overhead costs for bloated administrations and frivolous amenities. The film also explored a variety of innovative variations on higher education, ranging from massive open online courses to the tiny Deep Springs College. It came down heavily against impersonal, one-size-fits-all solutions, and emphasized the importance of one-on-one human interaction.

The film fell short, though, in its inadequate attention to profit motives. It didn’t even mention the for-profit college sector, which has played a disproportionate role in the student debt crisis. It seemed to blame the federal government for pushing loans on students, when in fact it’s private banks and investors who are profiting from those loans. And although it highlighted the for-profit MOOC startups Udacity and Coursera (and the much-publicized collaboration between Udacity and San Jose State University), it failed to mention the lower-profile infiltration of software for canned courses that’s coming from traditional textbook publishers.

To get to the bottom of a scandal, you need to follow the money.

Saturday, December 12, 2015

Textbook Price Pandemonium

Physics textbook prices have gotten crazier than ever. Just look:

Author Subject Publisher List price
SerwayModern physicsCengage$368.95
Thornton and RexModern physicsCengage$355.95
Tipler and LlewellynModern physicsMacmillan$182.99
OhanianModern physicsPearson$179.00
Taylor et al.Modern physicsUniv. Sci. Books   $98.50
Fowles and CassidayMechanicsCengage$404.95
Marion and ThorntonMechanicsCengage$401.95
HamillMechanicsJones & Bartlett$303.95
TaylorMechanicsUniv. Sci. Books$124.50
WangsnessElectrodynamicsWiley$205.95
GriffithsElectrodynamicsPearson$174.60
OhanianElectrodynamicsJones & Bartlett$164.95
CookElectrodynamicsDover$34.95
GasiorowiczQuantum mechanics   Wiley$224.95
GriffithsQuantum mechanicsPearson$193.20
McIntyreQuantum mechanicsPearson$135.20
TownsendQuantum mechanicsUniv. Sci. Books$98.50
BeckQuantum mechanicsOxford$89.00
CarterThermal physicsPearson$187.20
Kittel and KroemerThermal physicsMacmillan$154.50
ReifThermal physicsWaveland Press$111.95
BaierleinThermal physicsCambridge$105.00
SchroederThermal physicsPearson$71.60
HechtOpticsPearson$209.40
Pedrotti et al.OpticsPearson$204.40
GuentherOpticsOxford$98.50
Peatross and WareOpticsLulu/self$21.30
FowlesOpticsDover$19.95
Ashcroft and Mermin   Solid stateCengage$398.95
KittelSolid stateWiley$203.95
SnokeSolid statePearson$165.20
MyersSolid stateTaylor & Francis$87.95

Here I’ve tried to list a representative sample of textbooks, including the most popular ones, for seven standard physics courses at the sophomore through senior level. The list prices came from the publishers’ web sites, accessed during November and December 2015. To see a more complete list, click here.

How did the average price of such books climb to nearly $200? And what are we to make of the fact that Cengage now gouges students for $350 to $400 per book, even while other publishers sell competing books for under $100?

Nearly 18 years ago I wrote a web article about physics textbook prices, showing how they generally tracked inflation from 1960 through the early 1980s but then began rising steadily, outpacing inflation by about 50% by 1998. At that time there was much less variation in prices, and the average price for books at this level was about $80. But the cost of living in the U.S. has increased by nearly 50% since then, so in today’s dollars the 1998 average would be about $120. Before 1985 the average price, in today’s dollars, was about $75. So on average, after inflation, these types of textbooks now cost about two and a half times what they did 30 (or 50) years ago. 

I won’t repeat every explanation I offered in that earlier article, or in a more recent post on this blog, but the most important factor behind high textbook prices hasn’t changed: The people buying the books (students) aren’t the same as the people choosing the books (professors). This system effectively eliminates most of the price competition you would otherwise expect.

A secondary factor, though, has been the bewildering series of mergers, acquisitions, spin-offs, and rebrandings of the major commercial textbook publishers. Addison-Wesley and Prentice Hall are now Pearson; Freeman is now Macmillan; Saunders, Harcourt Brace, Brooks Cole, and others are now Cengage. And the bigger a publishing company gets, the more separated the corporate decision makers become from the people who are affected by their decisions.

Meanwhile, the major commercial publishers are devoting more and more resources to frequent revisions of mass-market introductory textbooks and, especially, to the online homework and tutorial systems that accompany these textbooks. Their ultimate goal seems to be to take over the teaching of these courses entirely, making faculty superfluous.

But software development is expensive, so such a program is out of the question for courses that enroll under ten thousand students a year nationwide. Publishing textbooks for these smaller markets is really no different from the way it was 30 years ago, but when it happens inside a huge company whose main business is mass-market course materials, the small-market books seem to be taxed to pay for all the overhead.

Physics textbooks beyond the introductory level have become a mere afterthought for most of the big commercial publishers, and have been completely abandoned by others. McGraw-Hill, once a major publisher of advanced physics textbooks, got out of that business 10 or 15 years ago. Pearson sold the Addison-Wesley Advanced Book Program to Perseus/Westview in the late 1990s, but has remained the dominant publisher of undergraduate and beginning graduate texts; yet despite this success, it is now telling authors that it will no longer publish any new upper-division physics titles. Wiley, as far as I can tell, is the only big commercial publisher that is still whole-heartedly in the upper-division (and beyond) physics textbook business.

On the other hand, more and more undergraduate textbooks are now being published by the Cambridge, Oxford, and Princeton university presses, and by small publishers like University Science Books. These publishers demonstrate that high-quality textbooks for small-market courses can still be published at about the same (inflation-adjusted) prices as during the 1960s, 70s, and early 80s.

At still lower prices, Dover has reprinted a few classic undergraduate physics textbooks, to add to its much more extensive collection of classic graduate-level textbooks. And a small but growing number of high-quality textbooks are now being self-published through services like CreateSpace and Lulu.

Of course it must be pointed out that fewer and fewer students are paying the full list prices for their textbooks. Online retailers typically sell new textbooks at discounts of around 20%, and it’s easier than ever to buy used textbooks at deeper discounts. The lowest prices of all are on international editions that are intended for sale in Asia but, thanks to a 2013 Supreme Court decision, legally available in the U.S. Traditionally these editions have been inferior in their print and paper quality, and now Pearson, at least, is also abridging their content to deliberately lower their value.

Let me end with a few notes regarding some particular books in the list above. Modern Physics by Taylor, Zafiratos, and Dubson was published by Prentice Hall and then Pearson until 2013, when Pearson took it out of print and the authors took it to University Science Books—resulting in a significantly lower price. Similarly, Reif’s Fundamentals of Statistical and Thermal Physics was formerly published by McGraw-Hill but has now found a new lower-overhead home at Waveland Press. Snoke’s Solid State Physics apparently went out of print around the time I was writing this article, because it was available from Pearson when I compiled the list but isn’t any more. The self-published optics textbook by Peatross and Ware, available in hard copy through Lulu, can also be downloaded for free from the authors’ web site. And my own book, An Introduction to Thermal Physics, costs much less than Pearson’s other textbooks because I did all the typesetting, artwork, and layout myself, and insisted on a clause in our contract to limit the book’s price. I’m now more glad than ever that I did it that way.

Update, 2 January 2016: Here’s a plot of all the price data in my spreadsheet, grouped by publisher. This plot not only highlights what an outlier Cengage is, but also shows that there are only four other publishers with multiple books priced above $150. However, this handful of publishers produces some of the most widely used textbooks.


Sunday, August 30, 2015

Why the Cost of College Has Tripled

It’s back-to-school time, so again people are talking about the rising cost of college. I wrote about this issue two years ago, and produced a plot showing how college tuition has increased faster than virtually any other component of the U.S. Consumer Price Index. Here’s an updated version of that plot, showing the relative cost of various types of goods and services compared to the overall CPI, since 1978 (the first year for which college tuition has its own CPI category):


As I said before, it’s not hard to understand the basic economics shown in this plot. Manufactured goods have become cheaper over time, as manufacturing has been automated and outsourced. The cost of professional services has therefore risen in comparison. College is often the ticket into high-paying service professions, so the demand for college and the willingness to pay for it have risen even more.

But even if we understand why people are willing to pay ever-higher tuition, this fact doesn’t tell us where all that money is going. Has the actual cost of educating a student more than tripled since 1978 and if so, how is that possible?

The answer to this question depends on whether we’re talking about public or private colleges (and universities). We can separate the two sectors, and also look 15 years farther back in time, by going to the Education Department’s Digest of Education Statistics. Here’s the Digest’s tuition data in constant (2013-14) dollars:


Obviously the private colleges charge much higher tuition than the public ones. Notice also that tuition gradually decreased, in real dollars, from the mid-1970s through the early 1980s, probably because colleges lagged in keeping up with the double-digit inflation of that era.

If you look closely at this second graph, you’ll see that since the 1970s tuition has increased slightly faster, in percentage terms, at the public schools than at the private ones. And even at the public schools the increase has been only about 200%, slightly less than what’s shown on the CPI graph. I don’t know the reason for this slight discrepancy, but the fact remains that tuition has roughly tripled over the last 35 years. Again, where is all this money going?

Let me first answer the question for the public colleges, which currently enroll 72% of all students and 69% of full-time students. Based on the data I’ve found (described below), it appears that the cost of an education at these schools has increased since the late 1970s, but only by about 20% (after accounting for inflation). However, these schools receive a great deal of their revenue from state appropriations, and that revenue, on a per-student basis, has declined by about 25%. Amazingly, the combination of these two 20-25% effects has resulted in a tuition increase of roughly 200%.

To show how this is possible, let me present a grossly simplified “toy” model that uses rounded numbers and ignores a variety of complications as well as all the little bumps and dips in the actual data:


In today’s dollars, the actual annual cost of educating a full-time student was about $10,000 back around 1980 and has increased about 20%, to about $12,000 today. Meanwhile, state funding of higher education has declined, on a per-student basis, by about 25%, from $8000 to $6000. This means that the average tuition has had to triple, from about $2000 to $6000. Simple arithmetic has combined 20% and 25% to yield 200%.

To construct this toy model I relied on the tuition data shown above, along with data from The College Board’s annual Trends in College Pricing reports. Figure 18A of the latest Trends report shows that state and local appropriations currently cover about half the cost of education at public colleges (more at two-year schools but less at four-year schools), and that this share has been decreasing in recent years. Figure 16B shows the history of state appropriations in more detail back to 1983-84, and the corresponding figure in the 2010 Trends report goes back to 1979-80. Here I’ve plotted state funding relative to its value in 1979-80, comparing the total amount to the amount per student:


The decrease in per-student funding from 1979-80 to 2013-14 was almost exactly 25%, so that’s the number I used in my toy model. But the bumps in the data (caused mostly by economic ups and downs) have been large, so you can get very different overall changes by choosing slightly different starting and ending years.

It’s important to note, meanwhile, that total state funding of higher education has increased over time, even after allowing for inflation. As you can see, the increase since 1980 has been about 25%. The decrease in per-student funding has been caused by a combination of two further effects. First, the U.S. population has grown by about 40% since 1980, and the working-age population has grown by about the same amount, so state funding for higher education has not kept up with the growth in the population or the tax base. Second, college enrollments have grown faster than the overall population (and also faster than the college-age population). Here is a graph of full-time-equivalent enrollments as a percentage of the total population, since 1950:


Whereas attending college was once the privilege of a small elite fraction of Americans, it is now commonplace among the middle class. And while most of us celebrate this transformation, we need to realize that it doesn’t come for free. The increasing number of college students has caused the total cost of educating these students to grow to become a substantial chunk of the U.S. economy. Somehow society has to pay that cost.

In any case, the toy model shown above is based on actual (rounded) data for the current levels of tuition and state funding, the decline in state funding per student, and the observed growth in tuition. From those numbers it’s a simple matter to calculate that state funding provided about 80% of the total cost in 1980, and that the total per-student cost of education has increased by about 20% since then. (It would be nice, of course, to corroborate these results with independent data, but I don’t know where to find such data.)

And why has the per-student cost of education increased, even if only by 20%? Probably for many reasons, which I hope to explore more carefully in a later article. In brief, it appears that expenditures for faculty salaries have been almost unchanged (on a per-student basis, after allowing for inflation), although there has been a significant rise in the number of part-time faculty. Meanwhile, there has also been a steep rise in the number of professional staff, as well as a steep rise in the cost of medical insurance for all full-time employees. Other possible factors are non-staff expenses such as academic and nonacademic buildings, library books, journals, computers, software, and student financial aid. The important thing to remember is that even small increases in any of these expenses have had amplified effects on tuition (or on mandatory student fees, which are included in the tuition statistics), because state funding has not increased to absorb any of the increases.

Finally, what about the private colleges and universities? Given that they never had any state funding to begin with, you might expect their tuition to have increased by only about 20%, to absorb the same increased expenses as at the public schools. Yet they’ve actually raised tuition nearly as much as the public schools: about 150% (above inflation) since the late 1970s. Where is all that money going?

There’s good data to show that faculty salaries have been increasing faster than inflation at the private colleges, so that’s one difference. It also seems likely that the private schools have been spending increasingly more than the public ones on almost everything else: professional staff, buildings, computers, and so on. It would be interesting (but difficult) to explore whether these disparate expenditures have affected the relative quality of private vs. public education over the years.

A critical difference, meanwhile, is that the more expensive private colleges tend to provide large amounts of need-based financial aid to many of their students. In other words, the advertised “sticker price” applies only to those who can afford to pay it, and these wealthy families subsidize students who are more needy. Perhaps one could construct a toy model of the interplay between this practice and rising costs and tuition over time.

But let’s not lose sight of the big picture here. Private colleges enroll only 30% of all college students, and they couldn’t get away with raising tuition by 150% if the public colleges weren’t raising it by 200%. That increase is being driven by a variety of modest cost increases, amplified and greatly exacerbated by the decline in state funding per student.

Tuesday, August 27, 2013

College Tuition Has Outpaced Inflation by 237% Since 1978

Everyone from President Obama on down seems to be talking about how expensive college has become. Amidst all this talk you hear plenty of statistics, usually quoted without much context, by people who have a political agenda. The Democrats want to make college more affordable for the poor, while the Republicans want to help the rich tap into the tuition gravy train. College professors and administrators want to protect their own salaries and budgets. Everyone, it seems, is an expert, and indeed, there is a vast body of literature on the economics of higher education.

So, being a typical curious physicist, I decided to ignore all this literature and try to get the big picture directly from the most obvious place: Consumer Price Index data from the U.S. Bureau of Labor Statistics. The CPI has included a college tuition (and fees) component since 1978, and it’s easy to download the data and compare it to the prices of other goods and services. The results are striking.

To visualize what has happened since 1978, I chose several other CPI data sets and divided each by its 1978 value to get a consistent baseline. Then, to more or less cancel out the effects of overall inflation, I divided each number for a specific CPI category by the “all items” value. Here, without further ado, are the results:


College tuition has risen far more quickly than any other CPI component that I looked at, with the exception of pre-college tuition (which tracks college tuition very closely). You think medical care has gotten more expensive? In the last 35 years the medical care CPI has exceeded overall inflation by only 92%, while college tuition has outpaced inflation by 237%.

Shelter (buying or renting a home) has risen in price only a little faster than the overall CPI during this time. The price of energy has been quite volatile, also rising somewhat on average. Food prices have not quite kept pace with the overall CPI. Virtually all categories of manufactured goods, from apparel to household furnishings to new cars, have become much more affordable than they were in 1978.

In fact, this one graph tells much of the story of the U.S. economy over the last 35 years. Manufactured goods are now cheap because the manufacturing has been either outsourced or automated—and the retailers who sell these goods don’t pay high wages. The money is in professional services like law and finance and medicine and education that can’t easily be outsourced or automated. These professions require a college education, so the demand for college has risen, further driving up its price.

But where is all that tuition money going? That’s an excellent question, which I’ll try to address in a subsequent post.

[Addendum: Of course I’m not the first to produce a graph like the one above. Here’s one that appeared online just yesterday, although it doesn’t show as wide a variety of CPI categories and it doesn’t divide by the overall CPI as I did.]

Friday, March 1, 2013

JavaScript and HTML5 for Physics


Like a number of other physics educators, I’ve invested a fair amount of time and energy over the last decade creating educational software in the form of Java applets.

I love Java for several reasons. It’s a reasonably easy language to learn and use, with logical rules and few exceptions. It gives very good performance, typically within a factor of 2 of native code. And, crucially, for a long time it was installed on nearly everyone’s computers, so most students and others could run my applets immediately, without any huge downloads or configuration hassles.

Unfortunately, that last advantage is now disappearing. For one thing, more and more people are replacing their computers with mobile devices that can’t run Java. Compounding the problem, security concerns have recently prompted many people (and companies) to disable Java on their computers. Some tech pundits have gone so far as to pronounce client-side Java dead.

While it’s likely that Java can be kept on life-support for several more years, its long-term prospects appear grim. So it’s time for us Java applet programmers to abandon this obsolescent technology and find an alternative. But is there one?

Until very recently, I thought the answer was no. Sure, I was aware of the new HTML5 canvas element, which allows drawing directly to the screen via JavaScript, right inside any web page, with no plugins. But this technology has mostly been described as a replacement for Flash, not Java, and I assumed that, like Flash, it would mean sacrificing a lot of performance. I couldn’t imagine that a scripting language could ever approach Java’s speed. Indeed, in an early test of a canvas animation a few years ago, I found the performance to be so poor that computationally intensive physics simulations were unthinkable.

I then avoided thinking about the issue until this winter, when the repeated Java security alerts provided an abrupt wake-up call. Apparently knowledgable geeks all over the internet were telling the public to disable Java, insisting that nobody should ever need to use it again.

So I decided it was time to give JavaScript the HTML5 canvas another try—and I was simply stunned. At least under Chrome, I found that graphics-intensive physics simulations run about half as fast in JavaScript as they do in Java. I can absolutely live with that factor of one-half.

My specific tests were with three simulations that I’ve spent a lot of time with over the years. First I coded a basic Ising model simulation to go with the corresponding section in my Thermal Physics textbook. Then I tried a molecular dynamics simulation, similar to the computational physics project I’ve assigned many times and the applet I wrote a few years ago. Finally, encouraged by these successes, I coded a fluid dynamics simulation using the lattice-Boltzmann algorithm, which I learned with the prodding and help of a student, Cooper Remkes, as he worked on a class project in late 2011.

As the following graphs show, the choice of browser can make a big difference. Each graph shows the relative number of calculation steps per unit time, so higher is better in all cases. I ran the simulations on my new MacBook Pro with a 2.3 GHz i7 processor, and also on one of the Windows 7 desktop PCs in the student computer lab down the hall from my office, with a 2.93 GHz i3 chip. Comparing these two machines to each other wouldn’t be fair at all, and comparisons of the three different simulations wouldn’t be meaningful either, so I’ve normalized each group of results to the highest (fastest) value in the group. The browser versions were Chrome 25, Firefox 19, Safari 6, Opera 12, and Internet Explorer 9; all but the last of these are current, as far as I can tell.  (I tried I.E. 10 on a different Windows machine and found it to be only a little faster than I.E. 9, in comparison to Chrome. I couldn’t easily find a Windows PC with Safari or Opera installed.)



The Ising model benchmark tests a mix of tasks including basic arithmetic, if-else logic, accessing a large two-dimensional array, random number generation, evaluating an exponential function, and drawing to the canvas via context.fillRect. By contrast, the molecular dynamics (MD) and fluid dynamics (FD) simulations heavily emphasize plain old arithmetic. The fluid simulation, however, does more calculation between animation frames, uses much larger arrays, and uses direct pixel manipulation (context.putImageData) to ensure that graphics isn’t a bottleneck. The MD simulation seems to be limited, at least on the fastest platforms, by the targeted animation frame rate.

As you can see, the performance of Opera and I.E. on the MD and FD simulations is a major disappointment. Let’s hope the JavaScript engines in these browsers get some big speed boosts in the near future. Safari and Firefox seem to give acceptable performance in all cases, though neither measures up to Chrome on the demanding FD benchmark. Chrome is the clear all-around winner, although it’s a bit disappointing on the Ising simulation under Windows.

And how does this performance compare to Java? It’s hard to make a comparison that’s completely fair, because of differences in the languages and, especially, the available graphics APIs. But in general, I’ve found that similar simulations in Java run about twice as fast as the best of these JavaScript benchmarks.

The bottom line is that if you choose your browser carefully, JavaScript on a new computer is significantly faster than Java was on the computers we were using during its heyday (a decade ago). And of course, for simulations that don’t require quite as much computational horsepower, JavaScript and canvas can also reach the proliferating swarms of smartphones and tablets. I’m therefore a bit puzzled by the apparent shortage, at least so far, of physics educators who are creating JavaScript/canvas simulations. I’m sure this shortage won’t last much longer.

[Update: See the comments below for further details on the benchmarks, especially for the Ising model simulation.]

Wednesday, June 20, 2012

Intellectual Toughness


As the author of a widely used thermal physics textbook, I get a steady stream of email from students around the world who are using the book. By far the most common type of inquiry is requests for answers to the end-of-chapter problems. Some students ask for the answer to a particular problem; others want copies of the entire solution manual.

To most of these students, my standard response is “Ask your instructor.” However, not all of them are using the book in a traditional classroom setting. Some have moved on to advanced studies or workplace settings where for various reasons they need to go back and brush up on their undergraduate thermal physics.

Of course I’m delighted that people are using the book in such diverse ways. But I’m also dismayed that, even after earning an undergraduate degree, so many scientists and engineers still believe that answers come from textbook authors.

The whole point of science is that you can figure out answers for yourself, without relying on any authority. For physics textbook problems, that usually means you have to do some sort of calculation. And how do you know if the calculation is correct? Not by consulting a teacher or solution manual or some other authority! Mathematics has its own internal logic that tells you whether it’s correct, without reference to anything external.

But what about careless errors, which everyone makes from time to time? There are endless ways to catch them without any appeal to authority. Do the calculation a different way. Compare the answer to other known facts. Ask one of your peers to check your work.

Our educational system does a lousy job teaching these skills. In our fervent desire to “cover” as much material as possible in our courses, we don’t give students time to ponder their results and root out their own mistakes. Instead, we authoritatively mark their answers right or wrong, then hurry on to the next problem.

Nor is this situation unique to the mathematical sciences. Students of biology, economics, sociology, and history must all learn to distinguish truth from falsehood without an instructor’s help. Critically examining one’s methods, and thus developing confidence in one’s answers, is fundamental to every discipline that deals in hard facts.

It’s not enough to teach facts, or even to teach specific technical skills. We somehow need to help our graduates develop the intellectual toughness to know when they’re right, so they can become leaders in their chosen fields.

Tuesday, December 21, 2010

Math Doodles

If you haven’t seen them already, you must watch Vi Hart’s fantastic math doodle videos on stars, squiggles, fractals, and infinite elephants. Browse the rest of her web site too, and be awe-struck at how accomplished she is at having fun.


I’m not much of a doodler, but Hart’s masterpieces reminded me of this modest Escheresque MacPaint doodle that I made soon after buying my first (original!) Macintosh computer in 1985. That was during my first year of grad school, when I should have been putting every effort into those problem sets on quantum mechanics, statistical mechanics, and solid state physics. Why are we most creative when we’re avoiding what we’re supposed to do?

(By the way, isn’t it cool that I can still open that MacPaint file in Preview? Thanks, Apple! Now please tell me how to open my old MacWrite files...)

Thanks to Charlie Trentelman for pointing me, via Facebook, to a blog post on Hart’s videos by NPR’s Robert Krulwich. And thanks to my old grad school friend Ned Gulley, whose venerable blog featured an entry last year about Hart’s Möbius music box. It’s become trendy to gripe about the Internet and Facebook, but this is the sort of thing I love about both.

Krulwich also quotes from Paul Lockhart’s magnificent tirade about math education, “A Mathematician’s Lament.” It’s not new, but I don’t think I’d ever seen it before. Read it and weep.

Sunday, August 22, 2010

Textbook Prices


Today, on the eve of the start of fall semester classes, Mark Saal’s column in the Ogden Standard-Examiner appropriately takes aim at astronomical textbook prices. And although many of his examples are books for economics courses, he also lists the price of an introductory astronomy textbook!

(Feynman joke: “There are 1011 stars in the galaxy. That used to be a huge number. But it’s only a hundred billion. It’s less than the national deficit! We used to call them astronomical numbers. Now we should call them economical numbers.”)

As Saal points out, high college textbook prices are mainly due to the fact that the people choosing the books (the professors) are never the same ones who are paying for the books (the students). Publishers bombard professors with free copies of textbooks and in fact, I doubt that most professors even know what their assigned books cost. (The sales reps certainly don’t volunteer this information.) Under this system, textbook prices have been creeping upward considerably faster than inflation for the last 25 years.

One force that tries to counteract this trend is the used book market. Students have been selling their used books to each other for a very long time. College bookstores take an “if you can’t beat ’em, join ’em” attitude, buying back used books for half price and then reselling them at 75% of the price of a new book. (The difference, 25% of the new price, happens to be the same as the bookstores’ profit margin on new books.) Students who don’t wish to keep their books can save a lot of money under this system, buying a used book for 75% of the new price and then selling it back at 50%, for a net cost of only 25%. Students who want to keep their books, though, still pay 75% of the new price.

Fighting back, publishers do everything they can to suppress the used book market. Mass-produced introductory books are now revised every three or four years, thereby making all used copies of the previous edition worthless. The revisions rarely add anything of value to the content. If publishers could revise books even more often, I’m sure they would—but that’s pretty much impossible. So they now publish most books in paperback, designed to self-destruct after a semester of use (while saving almost nothing in production cost). Another trick is to shrink-wrap a single-use student workbook with the main book, hoping that professors will require their students to have both. More recently, publishers have started providing online extras such as self-grading homework assignments, protected by a password that students have to pay for unless they buy a new book. The password expires after a year, and cannot be transferred to another student.

Being the half-assed crusader that I am, I’ve been fighting this system, in my own small ways, since 1990. I’ve written angry letters to publishers, posted a web article documenting the alarming trend in prices, and even made my own publisher put a clause in our contract to limit the price of my thermal physics textbook. I’ve never required my students to use the shrink-wrapped workbooks or online homework systems. For my own astronomy section, I’ve started writing a free online text (emphasis on started).

But of all the ways that professors can save money for their students, the most promising by far is simply this: Turn the publishers’ tactic against them and let your students use an earlier edition of the book. College bookstores won’t stock superseded editions, because they can’t be returned to the warehouse if they don’t sell. But the Internet makes it extremely easy for students to obtain used older editions, and the prices are rock-bottom.

Thursday, June 11, 2009

Equal Opportunity?

At the start of each city council meeting we pledge allegiance to a Republic that provides “liberty and justice for all”. That’s not quite the same thing as equal opportunity for all, but many of us believe America should at least strive to provide equal opportunity. (Does this belief make me a liberal? Perhaps.)

The New York Times has just published two disturbing articles about the lack of equal opportunity in higher education.

First, Reed College (about as liberal as they get) has begun to base its admission decisions on ability to pay. Until now they practiced “need-blind” admissions, then provided adequate financial aid to every admitted student with demonstrated need. Now, as a result of the recession, they’ve decided to reject more than 100 students solely because they can’t afford to pay full tuition, and to accept 100 well-off students who otherwise wouldn’t have made the cut.

(My own liberal arts alma mater, Carleton College, began a similar practice about a year after I graduated--and I’ve protested by withholding charitable contributions to the them ever since. I’d rather see them spend money on financial aid than on fancy new buildings and higher faculty salaries.)

Second, the State of Illinois has launched a formal investigation into whether the University of Illinois (its most prestigious public university) has admitted hundreds of unqualified applicants in response to political pressure from state legislators and university trustees. If the allegations are true, this would be an egregious example of how it’s not what you know, it’s who you know.

Fortunately, my own employer can’t possibly suffer from these particular problems. Weber State University admits anyone with a high school diploma. (To borrow a cynical old Tom Lehrer quip, we’ve banned discrimination even on the basis of ability.) Does this mean we provide equal opportunity in every way? Of course not; there’s no way to be completely fair to everyone, and occasionally I hear allegations that students have been given special treatment for reasons such as family connections or gender. But overall, WSU and America’s other colleges and universities uphold much higher standards of fairness than you’ll find in the rest of our society.

Perhaps my background in higher education is part of why I get so outraged about politics, where you can almost always buy better opportunities with either money or political loyalty. Although high-profile corruption scandals draw attention to this system of unequal opportunity, for the most part the system is completely legal.

Ogden’s recent campaign finance revelations are a case in point (and a case that I’ve been obsessed with for the last few months). Just look down the list of Mayor Godfrey’s biggest campaign contributors, and you’ll see a list of people and companies who are doing business with the city. Or look at how the city attorney has the discretion to enforce campaign laws against one political faction but not against another. This is a system based on power, not equal opportunity.

Fortunately, Ogden just took a small, incremental step toward fairness, by passing a new campaign finance ordinance that will limit the largest contributions and provide more complete disclosure. Let’s hope we’ll see many more steps in the same direction.