Introducing Computational Tools in the Upper‐Division

advertisement
Computers in Physics
Introducing Computational Tools in the Upper‐Division Undergraduate Physics
Curriculum
David M. Cook
Citation: Computers in Physics 4, 197 (1990); doi: 10.1063/1.4822900
View online: http://dx.doi.org/10.1063/1.4822900
View Table of Contents: http://scitation.aip.org/content/aip/journal/cip/4/2?ver=pdfcov
Published by the AIP Publishing
Articles you may be interested in
Multiple roles of assessment in upper-division physics course reforms
AIP Conf. Proc. 1413, 307 (2012); 10.1063/1.3680056
Studio optics: Adapting interactive engagement pedagogy to upper-division physics
Am. J. Phys. 79, 320 (2011); 10.1119/1.3535580
Paradigms in Physics: A new upper-division curriculum
Am. J. Phys. 69, 978 (2001); 10.1119/1.1374248
Computational Exercises for the Upper‐Division Undergraduate Physics Curriculum
Comput. Phys. 4, 308 (1990); 10.1063/1.4822915
Optics and Spectroscopy—An Upper-Division Course in Physics
Am. J. Phys. 35, 79 (1967); 10.1119/1.1973972
Reuse of AIP Publishing content is subject to the terms at: https://publishing.aip.org/authors/rights-and-permissions. Download to IP: 78.47.19.138 On: Sun, 02 Oct
2016 20:24:35
COMPUTERS
IN PHYSICS
EDUCATION
Introducing Computational Tools In The
Upper-Division Undergraduate Physics
Curriculum
David M. Cook
ince the mid-l 960s, computers have been used
increasingly for undergraduate physics instruction.
Numerous conferences have been held, I many projects-large and small-have been supported by private
and public sources," and many papers have been published.:' In its day, the Commission on College Physics
contributed to these efforts," and the AAPT Committee
on Computers in Physics Education has been active in
arranging sessions and workshops at national meetings for
many years. Until recently, the focus has been on
introductory courses and on laboratories. As the cost of
workstation-quality hardware continues to fall and easyto-use yet sophisticated software becomes more and more
available, however, applications in upper-division undergraduate theoretical courses are beginning to appear. A
few colleges and universities have introduced single upperlevel courses in computational physics.' and some
textbooks have been published"; some institutions have
incorporated subject-specific computer exercises in individual courses.' Despite the potential pedagogic benefits
of giving undergraduates experience in the use of
contemporary computational tools, however, systematic
efforts to build use of these tools into the upper-division
undergraduate curriculum are rare.
In the fall of 1988, the Department of Physics at
Lawrence University began a 3-year project to create an
environment within which undergraduate majors will
become expert at using state-of-the-art computational
tools intelligently and independently for the conduct of
nontrivial physics. Rather than create a single course in
computational physics, we seek to embed numerous
computer-based classroom demonstrations and homework exercises in most of our upper-division offerings.
Rather than expect students to learn both numerical
analysis and computer programming in detail, we use
professionally developed applications packages for the
execution of common computational tasks. Our efforts
embrace two components: First, we are incorporating an
explicit introduction to appropriate computational tools
in our intermediate courses in mechanics, electronics,
electromagnetic theory, and quantum mechanics, all of
which our majors normally complete by December of the
junior year." Second, we are adapting much of the rest of
our curriculum? so that, without further explicit instruction, students continue using the tools to which they were
introduced in the earlier courses. In this article, we discuss
S
David M Cook is professor ofphysics and Phi/etus E Sawyer professor of
science at Lawrence University. Appleton. WI
the structure of the project and describe two simple
exercises; additional exercises will be presented in a
sequel. 10
I. THE PROJECT
The project at Lawrence embraces curriculum development, faculty development, and facilities development.
While we admit that students must develop some
programming skills, we are much less interested in
teaching programming per se than in developing the
student's abilities to use computational tools for such
tasks as graphing functions and surfaces, manipulating
expressions symbolically, solving algebraic equations,
evaluating integrals, solving ordinary and partial differential equations, manipulating one- and two-dimensional
arrays, designing electronic circuits, and preparing technical manuscripts. Furthermore, we seek to nurture these
abilities through repeated use of these tools in concrete
physical as opposed to abstract mathematical contexts.
This project focuses on curriculum development as a
means to the desired end. Operationally, at least in its first
phase, the project involves identifying a selection of
exercises using various computational tools, sorting them
by the course in which they are appropriate, modifying the
first course in which a particular tool is used to include appropriate instruction, and modifying subsequent courses
so that students routinely review and use tools learned
earlier. In mechanics, fall-term sophomores are introduced to tools for graphing, solving linear and nonlinear
ordinary differential equations, finding eigenvalues and
eigenvectors of matrices, and manipulating expressions
symbolically. In electronics, winter-term sophomores
continue to use many of these tools and are also
introduced to software for circuit analysis. In electricity
and magnetism, spring-term sophomores again use by
then familiar tools to graph numerous analytic solutions,
explore problems in electron optics, evaluate integrals
giving fields and potentials, produce field diagrams,
expand expressions to deduce multipole moments, and
explore interference patterns. In quantum mechanics, fallterm juniors use tools for finding and graphing solutions
of ordinary and partial differential equations, solving
eigenvalue problems, manipulating matrices, evaluating
integrals, combining angular momenta, and manipulating
expressions symbolically.
None of these objectives can be pursued effectively
unless faculty members develop the expertise to guide
students in the use of these tools. Faculty members are
Reuse of AIP Publishing content is subject to the terms at: https://publishing.aip.org/authors/rights-and-permissions. Download to IP: 78.47.19.138 On: Sun, 02 Oct
COMPUTERS IN PHYSICS, MARlAPR 1990
197
2016 20:24:35
COMPUTERS IN PHYSICS EDUCATION
spending parts of summers and institutionally provided
released time during the academic years to enhance their
skills and generate course exercises.
Finally, the software and hardware necessary to
support this project are dictated by the anticipated tasks
enumerated in the opening paragraph of this section.
Numerous choices are possible, and specificselections will
be influenced by local circumstances and budgets. The
software currently available at Lawrence is listed in Table
I. II The hardware currently available consists of the
networked components listed in Table II. PHYSLAN is
the local area network that serves this project. Four of the
workstations are in faculty offices and five comprise a
Computational Physics Laboratory serving 35-40 distinct
individuals each term.
II. GRAPHICS SUPPORT
Perhaps the single most important resource is a
computational tool for producing a variety of graphs. (In
PHYSLAN, this capability is provided primarily by
MATLAB; see Table I.) In describing the subsequent
exercises, we assume the availability of a routine for
graphing a function of one variable and the availability of
routines for producing mesh surfaces and contour plots of
functions of two variables, and we introduce the generic
commands
Plot Y versus X
Draw mesh surface of Z
Draw contours of Z
TABLE I. Applications software currently available at Lawrence.
Beyond the operating system (VMS), windowing software (currently,
VWS; ultimately DECWindows), compilers (PASCAL, BASIC, FOR·
TRAN, C), an assembler (MACRO), graphics routines (GKS, UIS,
HOOPS), drawing aids (SIGHT, PAINT), a file transfer program
(KERMIT), and text editors (EDT, EVE, TPU), our selection of
applications packages is enumerated in this table. We expect to add a
package for design of optical systems, a package for image processing, a
package for finite element analysis, and possibly a CAD package. All
product names are trademarks of their respective owners.
MATLAB
for processing arrays and producing
graphs, including perspective drawings of
surfaces in 3D; from The Math Works, Inc.
MACSYMA
for manipulating expressions symbolically,
performing numerical analyses, and producing graphs; from Symbolics, Inc.
NUMERICAL RECIPES for accomplishing a wide variety ofnumerical tasks; from Numerical Recipes Software, Inc.
DSS/2
for solving ordinary and partial differential
equations numerically; from Lehigh University.
PSPICE
for designing and analyzing electronic
circuits; from MicroSim Corporation.
GRAPHIC OUTLOOK for working with spreadsheets; from Stone
Mountain Computing Corporation.
TeX
(and its derivatives) for preparing technical manuscripts; from the American Mathematical Society.
INTERLEAF
for preparing technical manuscripts
(WYSIWYG); from Interleaf, Inc.
TABLE II. Networked hardware currently available at Lawrence.
Because we have substantial local expertise in VMS and little expertise
in UNIX and because DEC's local service center is headquartered only 3
miles from our campus, we have selected mostly DEC equipment. All
product names are trademarks of their respective owners.
Administrative Hardware:
VAX 6210, DECserver 500, about 75 terminals
Academic Hardware:
VAX II/780, about 50 terminals
CMSCLAN:
MicroVAX II, MicroVAX-GPX, 4 VAXstation 2000
PHYSLAN:
VAXserver 3500,8 VAXstation 3100, Macintosh IIci, LN03R Script
Printer
to effectthese graphics operations. In accordance with the
typical behavior of these commands, we suppose that the
first takes as input two vectors, X containing values of the
independent variable and Y containing the corresponding
values of the dependent variable, and that the second and
third take as input a two-dimensional array Z, each of
whose elements gives the altitude of the surface above the
xy plane. The necessary vectors and arrays might be
generated by evaluating analytic solutions to problems;
they might express a numerical solution to an ordinary or
partial differential equation; they might contain experimental data; they might be calculated within the graphics
'package; or they might be imported from an external
source. Pedagogically, of course, we assign early on a few
exercises focusing explicitly on producing graphics displays. Since these commands will be amply illustrated in
later exercises, however, we here point out only that
students typically find their use so appealing that they can
hardly keep from finding and aggressively pursuing their
own applications.
III. SAMPLE EXERCISES
Several broadly applicable computational toolssome for numerical tasks, some for symbolic taskscontend for a position second only to those for graphing.
In the remainder of this article and in its sequel, we
describe exercises illustrating several such tools. For each
exercise, we present first a statement of the exercise, then
an outline of the solution that students create more or less
on their own, and finally some comments on the
pedagogic role of the exercise. In each exercise, we
indicate the essence of the individual instructions to the
appropriate generic applications package without trying to
convey their specificsyntax in the particular package used
at Lawrence.
A. Numerical operations
Numerical tasks include solving algebraic and differential equations, evaluating integrals, and finding the
eigenvalues and eigenvectors of a matrix. In introducing
numerical tools to students, one must, of course, be sure
Reuse of AIP
Publishing
content is subject to the terms at: https://publishing.aip.org/authors/rights-and-permissions. Download to IP: 78.47.19.138 On: Sun, 02 Oct
188
COMPUTERS IN PHYSICS, MAR/APR 1880
2016 20:24:35
that they understand the essential elements of the
underlying algorithms and even more that they are fully
aware both of the approximate nature of numerical
calculations and of the hazards inherent in computer
round-off. Provided these issues are discussed fully
enough to assure wise use, we see little reason to be any
more concerned about using "canned" routines for solving
differential equations or finding eigenvalues than about
using the log button on a pocket calculator.
As the one numerical illustration for this article, we
choose an exercise involving the solution of a set of
differential equations.
Exercise 1: Spaceship near two suns
Explore the trajectories of a spaceship "coasting"
under the gravitational influence of two equally massive
fixed suns (Fig. 1). In particular, explore launches from the
point midway between the two suns and seek an initial
velocity that results in a figure-8 orbit around the two suns.
Computational Task: Numerical solution of ODE's
Software Package: MATLAB
Pertinent Course: Mechanics
Prerequisites: Students approach this exercise after
classroom discussion of Newton's laws, the law of
universal gravitation, and numerical approaches to
ODE's, including demonstration of the ODE-solving
routine to be used.
Outline of solution: The student first uses Newton's
laws of motion and Newton's law of gravitation to find the
equations of motion
=
V.
'
dY =
dT
dV
dT
w:
dX
dT
(1)
here expressed in dimensionless form by setting X = x/D,
y = y/. D, and T = ~ GMt 21D 3. The student next constructs a file containing statements expressing the righthand sides of equations (1)-(4) in a FORTRANlike
syntax. Then, only two commands are required to produce
a graph of the orbit of the spaceship. The first invokes a
routine-in our case an adaptive Runge-Kutta algorithm-for solving the equations, by saying essentially
Create a table giving X, V, Y, and W for T between
o and 10 and for initial values X = 0, V = 1, Y = 0,
W = 1, finding the solution to an accuracy of 0.001
and the second says
Plot Y versus X
Figure 2 shows several trajectories produced in this way.
In each, the spaceship is projected more or less northeast
from the origin, midway between the two suns at [ - 1,0]
and [1,0]. The four trajectories together summarize a
search for a figure-8 orbit. The student simply tries a set of
starting conditions, estimates from the resulting trajectory
a reasonable next try, and repeats the process until it
converges on the desired conditions.
Comments: Most students require only a few trials
and no more than 15 minutes to determine the desired
conditions, and then go on to explore a wide variety of additional trajectories of their choosing. In addition to
providing insight into the specific system explored, this
exercise both introduces a tool for solving systems of
ordinary differential equations and acquaints students
with the general approach to the sorts of dynamic systems
that arise not only in physics (including some aspects of
chaos, one of the current "hot" topics), but also in
chemistry, population biology, economics, and many
(2)
'
X-I
X
[(X
+1
+ 1)2 +
(b)
(a)
y 2]3/2 '
(3)
and
dW
dT
y
y
[(X
+ 1)2 + y2]3/2
'
o
(4)
(d)
(c)
y
2
X
m. (x,y)
D
D
x
M
M
FIG. 1. A spaceship near two suns.
o
X
2
o
2
X
FIG. 2. Several trajectories in the gravitational field of two suns. The
suns are located at [-1,0] and [1,0], and the spaceship is projected from
the origin with X and Y velocities V and W as follows: (a) V(O) = 1.00,
W(O) = 1.00;(b) V(0)=0.90, W(O)=1.00; (c) V(O)= 0.80, W(O) = 1.00; (d)
V(0)=0.75,W(0)=1.00. All values are in dimensionless units.
Reuse of AIP Publishing content is subject to the terms at: https://publishing.aip.org/authors/rights-and-permissions. Download to IP: 78.47.19.138 On: Sun, 02 Oct
COMPUTtRS IN PHYSICS. MARlAPR 1990
199
2016 20:24:35
COMPUTERS IN PHYSICS EDUCATION
other disciplines. Incidentally, the wisdom of casting
problems in dimensionless form is illustrated.
B. Symbolic operations
The second category of computational tools accomplishes symbolic tasks 12 and thus does for algebra and
calculus what pocket calculators have already done for
arithmetic. In contrast to the situation with numerical
tools, where pedagogic concerns center on understanding
algorithms and appreciating the nature of computational
errors, the pedagogic concern here is to avoid undermining the student's fundamental understanding of and
ability to work by hand with elementary algebra and
calculus. While the rule for differentiating products is
probably not in any danger of following the algorithms
some of us learned in high school for extracting square
roots, this concern must nonetheless be given due respect.
At the same time, we cannot ignore the immense power of
these tools to reduce the extent to which purely
mathematical operations distract from the pursuit and
understanding of interesting physics.
As the one symbolic illustration for this article, we
choose an exercise determining and exploring a magnetic
field.
Computational Task: Symbolic integration and series
expansion
Software Package: MACSYMA
Pertinent Course: Electromagnetic Theory
Prerequisites: Students approach this exercise after
classroom discussion of the Biot-Savart law. Familiarity
with MACSYMA will have been developed in an earlier
course.
Outline of solution: Evaluating the Biot-Savart law
B = /1(1'
41T
J,
dl'X (r - r')
J
[r - rT
(5)
'
the student first uses a succession of commands such as
the following to find the field at the point [O,O,z = sa 1on
the axis of a single loop of radius a lying in the xy plane
with its center at the origin:
r +- [O,O,sa 1
r' +- [a cos ,p,a sin ,p,Ol
d l' .- [ - a sin ,p,a cos ,p,01
! (The syntax requires omISSIOn
! of the differential d,p.)
SEP.-r - r'
MAG2.-SEP·SEP
dB.- (/1(1' /41T) * (d l' XSEP)/MAG2 (3/2)
Bv-Jntegral of dB on ,p from 0 to 21T
Bz'-z component of B
Bo.-Bz at s = 0
s, .-BJBo·
Exercise 2: On-axis magnetic field of two coils
Determine the on-axis magnetic field produced by a
pair of identical coaxial circular coils of arbitrary
separation, display the resulting field graphically, and then
explore the field near the center of the arrangement,
seeking the special properties characterizing the Helmholtz
coil (separation equal to the common radius).
h
The result
Bz(s)
=
I
(S2
+ 1)3/2
(6)
expresses B, (s) in units that make B, (0) = 1.
To find the field of a pair of identical loops, the
student then superposes two single loops, one a distance ca
above the xy plane and the other a distance ca below the xy
plane, and normalizes that field to be I at s = O. The
commands might be
B pair
-i
B, (s - c)
Bo.-Bpair
B pair
+ B, (s + c)
at s = 0
-ec:»:
The result is
s
B pair
+
(c 2
1)3/2
(s) = ....:...----:.-:....--
2
FIG. 3. Mesh surface showing the magnetic field of a pair of coils. While
the normalization in this display distorts the relative magnitudes of the
fields at different separations, the display reveals the special flatness at
c=O.5, the Helmholtz separation.
Reuse of AIP
Publishing
content is subject to the terms at: https://publishing.aip.org/authors/rights-and-permissions. Download to IP: 78.47.19.138 On: Sun, 02 Oct
200
COMPUlliRS IN PHYSICS, MARlAPR 1990
2016 20:24:35
whose graph, shown as a mesh surface in Fig. 3, can be
readily produced by submitting an array containing values
of Bpa ir (s) at points in the sc plane to the mesh command
described in Sec. II.
Finally, to reveal the specialness of the Helmholtz
separation, the student examines the field near x = 0 by
requesting the Taylor series for this expression with a
command like
Evaluate Taylor series about s = 0 for Eq. (7)
obtaining the result
(8)
Clearly, the quadratic term can be eliminated by choosing
the loop separation c to be ~-the Helmholtz separation.
Alternatively, the student might evaluate d2Bpair(s)lds2
symbolically and show that this second derivative has the
value zero when c = ~.
Comments: The above setup and integration of the
Biot-Savart law is, in fact, straightforward and frequently
done by hand. That part of this exercise thus acquaints the
student more with the character of symbolic operations
than with their power. The evaluation of the Taylor series,
however, is quite the opposite. Rarely do students actually
confirm for themselves what teachers usually assert
without proof regarding the derivatives of the field of the
Helmholtz coil at the center of the coil.
IV. ASSESSMENT
It is, of course, far too early to assess the final
outcome of this project. Encouraging signs, however,
include the enthusiasm of the participants-students and
faculty alike; the ease with which, given a small amount of
guidance, all students are learning to use the facilities; the
variety of applications being conceived at several levels in
our curriculum; the promptness with which the facilities
have figured in senior-level honors work; and the
productivity of the two students who assisted the author
during the summer of 1989. In the author's experience, attempts in the past to bring computing resources into the
physics curriculum have faltered, in large part because
serious use of computers for physics required students to
invest much time learning numerical analysis and developing programming skills. With contemporary software,
statements like "solve this differential equation," "integrate this function," and "draw a mesh plot of this
surface" are primitive commands! But these commands
correspond identically to the high-level operations in
terms of which practicing physicists construct solutions to
problems in physics. The availability of primitive commands at this level bodes well for the ultimate success of
attempts to use software of the sort described in this article
in the physics curriculum at all levels.
ACKNOWLEDGMENTS
This project has received support from the W. M.
Keck Foundation of Los Angeles (#880969), the
National Science Foundation ( # USE8851685), and
Lawrence University.
•
REFERENCES
1. To name some: Conference on Computers in Undergraduate Science
Education, held at the Illinois Institute of Technology in August
1970; nine Conferences on Computers in the Undergraduate
Curricula (CCUC), held annually from 1970 through 1978; three
National Educational Computing Conferences (NECC, successors
to CCUC), held annually from 1979 through 1981; Conference on
Computers in Physics Instruction, held at the University of North
Carolina at Raleigh in August 1988 [Computers in Physics
Instruction, edited by E. F. Redish and J. S. Risley (AddisonWesley, Reading, MA, 1990)]; two Conferences on Computational
Physics in the Undergraduate Curriculum, held at the University of
North Carolina at Asheville, October 1987, and October 1989.
2. To name some: COEXIST at DartmouthCollege; ATHENA at the
Massachusetts Institute of Technology; The Physics Computer
Development Project at the University of California at Irvine;
PLATO at the University of Illinois; On-Line Laboratory Computing at Lawrence University; Workshop Physics at Dickinson
College; M.U.P.P.E.T. at the University of Maryland.
3. See the Resource Letter by R. G. Fuller [Am. J. Phys. 54, 782
(1986)] and/or the entry Education in the index of Computers in
Physics [Comput. Phys. 2 (6), II (1988); Comput. Phys. 3 (6),104
(1989)] and/or the entry Instructional Computer Uses (PACS
1.50.H) in the index of each December issue of the American Journal
of Physics.
4. A. M. Bork, A. Luehrmann, and J. W. Robson, Introductory
Computer-Based Mechanics ( 1968); R. Blum et al., Computer-Based
. Physics:An Anthology (1969); Computer-Oriented Physics Problems,
edited by J. W. Robson and D. M. Cook (1971); R. Blum et al.,
Templatesfor the Construction ofComputer-Based Self-Instructional
Dialogs: Gauss' Law (1971); all published by the Commission on
College Physics.
5. W. J. Thompson, Comput. Phys. 2 (4), 14 (1988).
6. W. J. Thompson, Computing in Applied Science (Wiley, New York,
1984); S. E. Koonin, Computational Physics (Addison-Wesley,
Reading, MA, 1986); Theoretical Physics on the Personal Computer,
E. W. Schmid, G. Spitz, and W. Losch (Springer-Verlag, New York,
1988); H. Gould and J. Tobochnik, An Introduction to Computer
Simulation Methods, Parts 1 and 2 (Addison-Wesley, Reading, MA,
1988), D. Stauffer, F. W. Hehl, V. Winkelmann, and J. G.
Zabolitzky, Computer Simulation and Computer Algebra, Second
Edition (Springer-Verlag, New York, 1989); S. E. Koonin and D.
Meredith, Computational Physics: FORTRAN Version (AddisonWesley, Reading, MA, 1990).
7. J. A. Lock, Am. J. Phys. 55,1121 (1987); X. Chen, J. Huang, and E.
Loh, Am. J. Phys. 55, 1129 (1987).
8. The Lawrence academic year is divided into three terms.
9. Optics, Thermodynamics, Advanced Laboratory, Advanced Mechanics, Advanced Modern Physics, Advanced Electricity and
Magnetism, Mathematical Methods of Physics, Solid State Physics,
Laser Physics, and Independent Studies in Physics.
10. D. M. Cook, Comput. Phys. (in press).
11. All product names are trademarks of their respective owners.
12. A recent review of several symbolic manipulating programs will be
found in J. F. Ogilvie, Comput. Phys. 3(1), 66 (1989); MATHEMATICA is reviewed in R. K. Cralle, Comput. Phys. 3 (6), 92
(1989).
Reuse of AIP Publishing content is subject to the terms at: https://publishing.aip.org/authors/rights-and-permissions. Download to IP: 78.47.19.138 On: Sun, 02 Oct
COMPUlOS III PHYSICS, MARlAPR 1990
201
2016 20:24:35
Download