Modeling Physics With Easy Java Simulations
Modeling Physics With Easy Java Simulations
M
odeling has been shown to correct weak- what science is about.2
nesses of traditional instruction by en- Wells, Hestenes, and Swackhamer point out that
gaging students in the design of physical introductory mechanics courses are organized around
models to describe, explain, and predict phenomena.1 a small number of basic models that are adapted to
Although the modeling method can be used without various contexts. Constant acceleration, simple har-
computers, the use of computers allows students to monic motion, Newton’s universal law of gravitation,
study problems that are difficult and time consuming, and energy/momentum conservation form the core
to visualize their results, and to communicate their of this course. Ready-to-use models and associated
results with others. This combination of computer curricular material described for these topics are avail-
modeling with theory and experiment can achieve in- able on the Open Source Physics (OSP) website in the
sight and understanding that cannot be achieved with ejs_tpt_modeling.jar archive.3
only one approach. This paper describes the Easy Java The OSP Launcher shown in Fig. 1 is a Java
Simulations (Ejs) modeling and authoring tool and program that contains mechanics models and docu-
shows how it can be used to teach mechanics concepts mentation in a single archive known as a Launcher
with computer modeling. package.4 Clicking on an item in the table of contents
A model is a surrogate object or a conceptual rep-
resentation of a physical system and/or its properties,
and modeling is the process whereby we construct
this representation. Computer modeling requires (1)
a description and an analysis of the problem, (2) the
identification of the variables and the algorithms, (3)
the implementation on a specific hardware-software
platform, (4) the execution of the implementation
and analysis of the results, (5) refinement and gener-
alization, and (6) the presentation of results. A com-
puter simulation is an implementation of a model that
allows us to test the model with different initial condi-
tions with the objective of learning about the model’s
behavior. The applicability of the results of the simu-
lation to those of the real (physical) system depends
Fig. 1. An Ejs Launcher package contains compiled ready-
on how well the model describes reality. The process to-use models. Clicking on a Launch Node runs the model.
of devising more general and more accurate models is Right-clicking on a Launch Node passes the model to the Ejs
authoring tool.
The Physics Teacher ◆ Vol. 45, November 2007 DOI: 10.1119/1.2798358 475
tree (left-hand side of the Launcher window) loads choice.6 Executing the EjsConsole.jar file in the
an html page that describes the model. Users execute installation directory creates an empty Ejs workspace,
(run) models in our package by double clicking on the as shown in Fig. 2.
“Launch Nodes” (green arrows) in the tree. Easy Java Simulations is well-suited for education
Users without vendor-installed Java must, of because it is simple to use and combines authoring
course, first download and install Java in order to run with powerful modeling tools. Its dynamic and highly
our models.5 Running a Java program on a modern interactive user interface greatly reduces the amount
operating system is straightforward because a typical of programming required to implement an idea. Even
(default) Java installation recognizes a Java archive experienced programmers find Ejs useful, because it is
(jar) file as a compiled Java program. Users need only faster and easier to:
double-click on the jar file to run our models.
Although the models in our mechanics package • Develop a prototype of an application in order to
are compiled and ready-to-use Java applications, an test an idea or algorithm.
important pedagogic feature is that our package is • Create user interfaces without programming.
created in such a way that users can return to Ejs at • Create models whose structure and algorithms
any time to examine, modify, and adapt the models. nonprogrammers can inspect and understand.
The Launcher package contains a small Extensible
• Encourage students or colleagues (who may be
Markup Language (XML) description of each model, new to Java) to create their own simulations.
and right-clicking on a Launch Node passes this XML
document to the modeling tool, thereby allowing us- • Quickly prepare simulations to be distributed as
applets or as stand-alone programs.
ers to examine and modify the model. Ejs can repack-
age the modified model in a new jar file for redistribu- • Create a package containing multiple programs
tion or submission to an instructor as a completed and the associated curricular material.
exercise.
Easy Java Simulations simplifies the modeling
Ejs Modeling process by breaking it into activities that are selected
Easy Java Simulations is a Java program that en- using radio buttons: (1) documentation, (2) model-
ables both programmers and novices to quickly and ing, and (3) interface design. The model’s html-based
easily prototype, test, and distribute packages of Java documentation is accessed by selecting “Descrip-
simulations. It can be downloaded from the Ejs web- tion.” The physics is accessed by selecting “Model,”
site and installed (unzipped) into a directory of their which provides access to the data and the methods
(Java code) by which the model can change. A plot
is a visual representation of data and is an example
of a “View.” Because it is possible to have multiple
views of the same data and because the model and its
views are controlled by buttons and other on-screen
components, Ejs provides a graphical drag-and-drop
editor for the user interface, which eliminates much
coding. The Ejs model-view-controller paradigm is
well known in computer science and provides a solid
foundation for software development.
Pendulum Model
Screen shots are no substitute for a live demonstra-
tion, and we encourage readers to load, inspect, and
run the Pendulum model described in this paper. Ex-
Fig. 2. The Easy Java Simulations user ecute the EjsConsole.jar program in the directory
interface (with annotations).