Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Re: [Phys-L] simple models of QM wavefunctions, using interactive animated computer graphics and otherwise



Nice animations, John.

As the developer of GlowScript (with David Scherer, the originator of
VPython), I of course have a rather different (not necessarily correct!)
perspective on some of the issues John discusses.

First, I agree completely that JavaScript is not a nice language. There
exist various attempts to prove otherwise, including an influential book
titled "JavaScript: The Good Parts", with the notion that JavaScript isn't
bad but just different, but I'm unconvinced. For programming in a browser I
mostly prefer CoffeeScript, a somewhat Python-like language that compiles
to JavaScript, where JavaScript can be thought of as the assembly language
of the browser, for which there's lots of development work going on among
browser builders to make JavaScript code run faster. I would prefer that
the user language be Python rather than JavaScript, or even CoffeeScript,
and I note with interest that there is some work going on to be able to
compile Python to JavaScript.

I have many years of experience working not with ten-year-olds but with
college freshmen at high end private universities (Caltech and Carnegie
Mellon) and at state universities (UIUC and NCSU), teaching intro physics.
Ruth Chabay and I have developed an intro curriculum and textbook that
takes a (mid-)20th-century perspective on physics rather than the
traditional 19th-century perspective. One of the elements of dragging the
course out of the 19th century is that we've worked hard to include
computational modeling in the intro course. This has been a big challenge
along many dimensions, starting with the fact that most college freshmen,
at least at schools like NCSU, have no experience whatsoever with computer
programming, yet we wanted the nature of the computational modeling to
include real programming, with no black boxes that would hide the basic
nature of iterative algorithms.

Given all that must be done in an intro physics course, we had to select
very carefully a tiny subset of programming concepts to teach, sufficient
to the task: variable, assignment, and one kind of iteration (while). We
teach nothing about event handling and user interface issues (the 3D
animations the students see are generated as side effects of their physics
computations). We don't even introduce functions or arrays! We necessarily
go for the jugular. I assert from a lot of experience but cannot of course
prove, not having tried it, that callbacks and multithreaded parallel
processing would be a bridge too far for these students. We hope that
introducing the basic concepts of computational modeling will make it
possible for later courses in computational modeling to go farther and
deeper.

We do NOT have students in our curriculum use GlowScript! They use VPython,
which is the Python programming language, which is highly regarded by
computer scientists, plus a module to make 3D programming quite easy
instead of impossibly difficult. GlowScript is a little sister of VPython,
the purpose of GlowScript being that with an API similar to VPython it is
feasible for ordinary mortals to write programs that display navigable
real-time animations in a browser, something that otherwise requires very
high professional programming skills. Being able to run in a browser is in
contrast to the situation VPython, which requires installing Python and the
VPython add-on module, meaning that it's a much higher barrier to someone
viewing a VPython program than simply clicking a link to a URL.

John appropriately mentions that there are various kinds of browser (and/or
GlowScript) failures and bugs. The reason for this is that browser support
for the WebGL 3D graphics library, derived from the venerable OpenGL 3D
library, is new. It is so new that WebGL is supported only by recent
versions of browsers, and in the case of Safari even the most recent
version requires that you specifically enable WebGL. On my Android phone,
WebGL is supported by Firefox and by Chrome beta (but not Chrome), except
that two days ago it stopped working on Chrome beta, a measure of how new
this is. At glowscript.org, click Help for browser details. Also, one needs
a modern graphics card that has Graphic Processing Units, a requirement for
WebGL. My interest in developing GlowScript is to make WebGL-based
programming accessible to ordinary mortals, and to be forward-looking in
what will surely be a well-supported standard in the not distant future.

I ran John's animations on Windows in Chrome and Firefox but not Internet
Explorer (but this I think is fixable with a magic statement; example
programs at glowscript.org do run on IE) and on Mac in Chrome and Safari
(after enabling WebGL) but I didn't try Firefox. I didn't actually try it,
but the animations should also run on Linux in browsers.

I'm currently taking a Udacity MOOC (Massive Open Online Course) on
computer graphics, to see how such a course is structured. A recent task
was to model a (non-animated) 3D image of a "drinking bird", the toy that
dips into water and returns, using the popular WebGL library three.js. I
rewrote this in CoffeeScript using the GlowScript libraries, and added a
few statements to make the bird oscillate. You can see it here (with an
appropriate browser and an appropriate graphics card):

http://www.glowscript.org/#/user/Bruce_Sherwood/folder/Pub/program/DrinkingBird

The three.js version of the non-animated drinking bird is 320 lines.
The GlowScript version is 60 lines (not including the animation).

Bruce