J. Hasbun's Open Source Physics (OSP) Activities - Java Applications

(Note: Open Source Physics code is being distributed under the GNU GPL [http://www.gnu.org/licenses/gpl.html] license. Also to run the applications, the Java engine is needed from  http://java.sun.com/getjava. Programmers make use of the Java development kit which is located here: http://java.sun.com/javase/ and can be used to compile actaul Java code. Much base code has already been developed in what is referred to as the OSP framework library and is very convinient for developing applications. It is available from http://www.opensourcephysics.org/ or http://www.compadre.org/osp/. The eclipse front end java compiler is very useful for debugging code and the workspace associated with the OSP library can be obtained from http://www.compadre.org/osp/webdocs/Programming.cfm?t=Environment.)

My Open Source Physics activities began during the Summer Workshops of 2003 and 2004  at Davidson College, NC amd Eckerd College, FL, with Wolfgang Christian, Mario Belloni, and Anne Cox. Below are all the accomplishments achieved since.


1) Classical Mechanics with Matlab Applications by Javier E. Hasbun (Jones & Bartlett Learning, 2009) incorporates Open Source Physics as described in the Computation in Classical Mechanics poster of the Summer 2007 AAPT topical session on Computational Physics for Upper-Level Physics Programs (Davidson College, July 27-28.) The corresponding OSP support is found here. Please refer to the book for the specifics of what the applications are about, including the equations and the physics involved.

The links associated with the classical mechanics text are:

A current list of corrections to the text is kept here: corrections.pdf

See also the publication by T. Timberlake and J. Hasbun ajp_vol76_4&5_2008. The chapter applications can be run from the mechanics.htm file from the Mechanics_Java_applications directory from which the main jar file can be downloded along with individual htm driver files. All these applications are available in a single zip file Mechanics_Java_applications.zip as well. The Launcher way to run all the applications is the file mechanics.htm from the launcher_way_Mechanics_Java_applications directory from which the jar file and the driver htm file can be obtained and downloaded in case it is not launching from this server. It might run better from your own machine. When the Launcher opens, click on Launcher, then click on programs, then click of each chapter "o-" icon which shows the clickable individual applications. The source code is available under the OSP concept in the form of eclipse_workspace_mechanics.zip which also contains the OSP library used to compile the programs (version 20071116) and which can be compiled with Eclipse, an open source developing platform (http://www.eclipse.org/). If you have any problems, send me an e-mail (see address below).

2) A First Course in Computational Physics, Second Edition by Paul DeVries and Javier E. Hasbun (Jones & Bartlett Learning, 2011) uses Matlab and, if enough interest develops, it might be possible to create java support for it.

The links associated with the computational physics text are:


Available OSP applications follow.  Note: In most of the programs below, "Initilize" before pressing "start".

1 2003 Summer Workshop Results Instructional materials developed. This includes a particular set of animations of a constant acceleration motion example (based on Illustration 2.4 of Physlet Physics by Christian and Belloni - 2003), and EJS variable acceleration simulations. While the results can be seen for the animations and the simulations, the actual xml-simulation files are hard_wall_collision_1D.xml (with introduction hard_wall_collision_1D_Intro_Page.html) , and lennard_jones.xml (with explanation lennard_jones_Intro_Page.html).
2 jh_DatasetApp.java OSP Java development included the initial (rough shape) Java code J. Hasbun wrote on the Boltzman transport simulation based on the matlab version  matlab_boltz.m which uses a Boltzman shape startup conditions. There was another version of this matlab code presented at the workshop by J. Hasbun as well, based on a Fermi distribution initial shape; i.,e., matlab_boltz2.m.
3 Brownian_jhSimulation.html Hasbun also collaborated with Morten Brydensholt in a Brownian Motion EJS simulation. The details of this work can be found in Wolfgang Christian and Mario Belloni's Fall 2003 AAPT talk. However, Hasbun has recently developed this slightly different version of the Brownian motion example. It has explanatory comments here: Brownian_jh_Intro_Page.html. Its EJS source code is Brownian_jh.xml.
4 Boltzm_applet_App.htm My latest work involves a much improved version of the above mentioned Boltzman transport java simulation. This new version incorporated the initial jh_DatasetApp.java but using the correct algorithm for solving the partial differential Boltzmann transport equation. This version was turned in to Wolfgang Christian during the Fall of 2003 as part of my continued contribution and can be found at: jahasbun_osp_BoltzApp.zip. However, a much more improved version has recently been developed. This version can be run as an applet through the use of the "WrapperApplet" concept of Wolfgang Christian. This new version, Boltzm_applet_App.htm, additionally incorporates the user input. It's source code is Boltzm_applet_App.java. This simulation, however, still needs improvements since for a value of an electric field greater than about 0.2 the simulation develops instabilities due to the algorithm used. Improvements are in progress as detailed below. Other source code here: http://www.westga.edu/~jhasbun/osp/QE/
5 RSatelliteSimulation.html Recently I modified a version of an EJS satellite example (see projectileNsatellite_e.xml in the distribution of EJS) that was originally written by Fu-Kwun Hwang. To this simulation I added friction due to the air density variation as a function of height, in addition to the inclusion of thrust which depends on the rate at which mass is burned and the speed at which the gas is ejected. This actual simulation is RSatelliteSimulation.html with comments RSatellite_author.html and whose EJS source file is RSatellite.xml.
6 projectile_motion0Simulation.html


A simple but useful EJS projectile motion simulation I wrote is projectile_motion0Simulation.html which uses the simple kinematic equations of motion (see projectile_motion0_Intro_Page.html )to track a projectile with variable initial speed, initial angle, initial height, and gravitational surface acceleration. The source code is projectile_motion0.xml.Notice that the "make your own simulations" using EJS is complementary  and yet very powerful when compared to the kinds of things we can do with the "ready made" physlets of Wolfgang Christian and Mario Belloni ("Physlets," 2001 and "Physlet Physics," 2004, both by Prentice Hall). For example, regarding projectile motion, take a look at the fig.15 demostration of  "Physlets" : WC&MB2001_3.4.fig_15.html, and then take a look at the illustration 3.4: WC&MB_2004_illustration3_4.html of  "Physlet Physics". Each concept is very useful in my view.
7 Boltzmn_applet_App.htm Hasbun submitted an abstract to the 2004 March meeting of the American Physical Society regarding the latest improvements on the Boltzman Transport simulation. The title of this abstract is "A Boltzmann Transport Simulation Using Open Source Physics Simulation." The talk can be found in the APS Bull. Session W38 - Focus Session: Computers in Physics Education.  Thursday afternoon, March 25
520E, Palais des Congres [W38.007] (2004). The applet can be run from Boltzmn_applet_App.htm and the source code is located here: Boltzmn_applet_App.java.The actual talk is Boltzmann.pdf and which details the approach to the solution. Other source code here: http://www.westga.edu/~jhasbun/osp/QE/
8 y_vs_x_line_graph.htm In an effort to help in general experiments that make use of linear fits of data sets, this modified version of a linear regression graph y_vs_x_line_graph.htm was developed.
9 LRegressionApp.htm J. Hasbun in collaboration with his student, Maxwell Perkins, developed a java version of a linear fitting program. This is LRegressionApp.htm which can do power and exponential fits, in addition to the regular linear fitting. The OSP source code is available here LRegressionApp.java. This version was stimulated by the linear regression applet "y_vs_x_line_graph.htm" mentioned above. Other source code here: http://www.westga.edu/~jhasbun/osp/QE/
10 QRegressionApp.htm A version of linear regression with quadratic fitting included and which improves up on the above LRegressionApp is QRegressionApp.htm whose source code is QRegressionApp.java. Other source code here: http://www.westga.edu/~jhasbun/osp/QE/
11 QERegressionApp.htm A much more improved version of linear regression with quadratic and some non-linear curve fitting with unlimited data input-output handling has been written with the help of my student Maxwell Perkins. The applet version is QERegressionApp.htm. This version involved the modification of some of the methods of the original library found under display, controls, and applets. The complete source code is found here: http://www.westga.edu/~jhasbun/osp/QE/. Max Perkins was sponsored by the NASA Space Grant Consortium through Dr. Ben de Mayo of the Physics Department at the University of West Georgia -Spring 2004.
12 cycloidApp.htm Sometime ago, Hasbun developed the animated gif http://www.westga.edu/~jhasbun/charge.gif in order to show the behavior of a charged particle in crossed electric and magnetic fields. OSP has made it possible for us to develop a java applet version of this that accepts user input. The applet is cycloidApp.htm, and its source code is CycloidApp.java. Other supporting code is as in item 11 above. The student Max Perkins while working with Hasbun (sponsored by the NASA Space Grant Consortium through Dr. Ben de Mayo) wrote this code. Other source code here: http://www.westga.edu/~jhasbun/osp/QE/
13 CycloidAnimation2App.htm An animated version of the cycloidic motion of charged particles in the presence of electric and magnetic fields was created during the workshop of 2004 at Eckerd College. This animation is for the purpose of looking at the effect of mass, charge, and the fields. Here the coupled differential equations are solved numerically. The applet source code is here:CycloidAnimation2App.java, and CycloidAnimation.java. Other source code here: http://www.westga.edu/~jhasbun/osp/QE/
14 KacModelApp.htm During the same 2004 Summer workshop, Dan Schroeder of Weber State Univ. wrote a java program for the relaxation of a gas to equilibrium. J. Hasbun modified that program to provide a full comparison with the Maxwell-Boltzman distribution. The applet source code of this applet is here:KacModelApp.java. Other source code here: http://www.westga.edu/~jhasbun/osp/QE/
15 SchrodApp.htm During the same 2004 Summer workshop, Kipton Barros in Collaboration with J. Hasbun developed a program to solve the Schrodinger equation for an infinite triangular shape well. J. Hasbun modified that program to include a host of square wells in addition to various triangular wells, depending on the input. The source code of this applet is here:SchrodApp.java. Other source code here: http://www.westga.edu/~jhasbun/osp/QE/
16 planck.htm, wien.htm These two programs are not necessarily OSP, but are very useful in illustrating Plank's Radiation Law. They were obtained from Mike Guidry's site at the University of Tennesee. J. Hasbun (with permission) recompiled them with a slight modification from the originals. The source code of these applets is here: planck.java and wien.java. If anyone converts them to OSP, please let me know. This is related to Black Body radiation as shown in the pictures here.

17 QM_StepApp.htm This program was written for the purpose of illustrating the step potential in quantum mechanics. The analytic formulas are used. The real, the imaginary and the probability density are plotted. One can vary the energy and the potential step height to see the effects of experimenting with them. The source code of this applet is here: QM_StepApp.java We had to use complex numbers, so the complex java class from netlib.org was used. Of course, the code is still covered under the GNU license arrangements http://www.westga.edu/~jhasbun/osp/complex/
18 Potential_Step.htm
Useful non-OSP per say, whose authors are in included within the code.
For Quantum Mechanics: Pot_Step.java, barrier.java, well.java, in addition to complex.java,
For Mathematical Physics: Fourier.java,
For general use: Calendar.java.
You can measure your reaction time with the applet due to Fu-Kwun Hwang. The source is reactionTime.java, including redCar.gif, greenLight.gif, redLight.gif, and yellowLight.gif.
The wave "Interaction" applet is due to Konstantin Lukin, and the source code consists of Box.java, MyMath.java, SineWave.java, SumWaves.java, Handle.java, and the main applet Interaction.java.
19 Cycloid3dApp.htm
Hasbun submitted an abstract to the 2005 March meeting of the American Physical Society(APS Bull. Session S17-7). The title of this abstract is "Classroom Physics Applications Using The Open Source Physics (OSP) Library Open Source Physics." Here are pdf and doc versions of the presentation (March05_APS_OSP.pdf, March05_APS_OSP.doc) The talk was given in the focus Session: Issues in Physics Education on Wednesday afternoon, March 23, at the Los Angeles Convention Center. Three applet were presented, one on the CycloidAnimation2App.htm discussed above whose code is CycloidAnimation2App.java, and these two more. The Cycloid3dApp.htm deals with the 3 dimensional version of the charged particle in general electric and magnetic fields, whose code is Cycloid3dApp.java and Cycloid3d.java . The LsqfitApp.htm is a new and more general 17 function curve fitter that can accept as well as read data. The full code for the fitter is here http://www.westga.edu/~jhasbun/osp/curve_fitter/
20 projectile_motionSimulation.html


A more useful EJS projectile motion simulation I wrote is projectile_motionSimulation.html which solve the projectile differential equations of motion numerically and they include friction.  One can  (see projectile_motion_Intro_Page.html )to track a projectile with variable initial speed, initial angle, initial height, gravitational acceleration, integration step, projectile mass, and coefficient of friction. The source code is projectile_motion.xml. The slightly more customizable simulation is projectile_motion2Simulation.html with similar explanation projectile_motion2_Intro_Page.html and source projectile_motion2.xml.
21 water4_animate_vibrate.htm The water molecule vibrational modes can be seen through water4_animate_vibrate.htm, it uses the open source molecular viewer Jmol version 11.0.If you are running Microsoft Internet Explorer on the Windows operating system you should upgrade to the Sun Java Virtual Machine by visiting www.java.com. The standalone Jmol application requires Java 1.4 or higher. The latest Java Platform is recommended. I think that all content in this lecture is open source. Jmol can read the non-open source package Gaussian output file results water4.out obtained by running Gaussian on the input file water4.gjf
22 LinearEqsApp.htm
For the programs that involve matrices, the input can be changed by double clicking the matrix, click again where a different input is desired and press return to acknowledge the change. The Linear equation solver LinearEqsApp is presently set to do up to a 10x10 system. The code is here: LinearEqsApp.java. The program elliptical_orbitsApp is an elliptical orbit illustrator with variable eccentricity, and its code is elliptical_orbitsApp.java. The eigenvalue/eigenvector solver EigenValuesApp can presently do up to a 6x6 matrix system with code EigenValuesApp.java.
23 StriatedMuscleTansientApp.htm
These programs are work in progress (paper sunmitted) in collaboration with Henry Zot (Biology) and Minh Van Nguyen (Mathematics). They were developed for the purpose of simulating a system of coupled DE's  for striated muscle contraction. The system of equations is studied in the transient and steady states. The source code for the transient state is StriatedMuscleTansientApp.java and for the steady state is StriatedMuscleSteadyStateApp.java.
24 ForcedOscillatorApp.htm
The forced harmonic oscillator is a good example of a system with resonance. The ForcedOscillator application allows the user to use a slider bar to change the frequency of the driving force. The mass' amplitude of vibration as well as its phase depend on the driving frequency. The ForcedOsAnimation actually shows how the mass at the end of the spring responds to the force as the frequency is varied in real time. The source code for each is here ForcedOscillatorApp.java and here ForcedOsAnimationApp.java.
25 nuclear_binary_system_EJS.html This is a nuclear physics problem that J. E. Hasbun and his student Benjamin E. Hogan developed. It was originally developed as an EJS simulation of a nucleus treated as two particles. The outer particle is one of the nucleons, here a neutron. The inner particle is the remaining core. The simulation treats their interaction through a force derived from the the Woods-Saxon potential. The original EJS source code is here nuclear_binary_system_EJS.xml. Here are the details of the simulation nuclear_binary_system_EJS_Intro.html. The jar file is here nuclear_binary_system_EJS.jar
26 Resonance_video-2013-05-30-15-34-14.mp4 This is a video on resonance with sample planar sheet of glass whose resonance frequency is matched with a resonating box. This is the subject of a paper on demonstrating resonance using the resonance box built by my students Daniel Sanchez-Carretero and Anton Hud. (The video is large so wait for it to load.)
27 Millikan_Oil_Drop_Experiment.htm This is a simulation for the Millikan oil drop experiment that J. E. Hasbun and his student Benjamin E. Hogan developed. It was originally developed as an EJS simulation of the actual apparatus. The simulation allows the user to select a droplet to work with and once its charge is found, the simulated experiment allows the user to continue and measure the velocities from which the charge can be found. The user can vary the charge by ionizing the drop as well. The data can be saved to a file to be analyzed separately (see the matlab file below) if the jar program is downloaded (see comments below). The original EJS source code is here Millikan_Oil_Drop_Experiment.xml. The details of the simulation can be read in the introduction within the source code that is interpreted with EJS as well here Millikan_Oil_Drop_Experiment_Intro.html. The jar file can be downloaded from here Millikan_Oil_Drop_Experiment.jar and which can be executed with java by clicking on the downloaded file or executing it by typing:
"java -jar Millikan_Oil_Drop_Experiment.jar". The jar file is also an archive and the source and other files can be unpacked separately.
The Matlab file Millikan_Oil_Drop_Experiment_Analysis.m can be run using http://www.mathworks.com/Matlab or https://www.gnu.org/software/octave/ in order to analyze the data that is generated by the downloaded jar file if saved as a .txt formatted file.

  Should there be any questions, I'd be happy to respond. J. Hasbun (jhasbun@westga.edu)