Physics Modeling: Chapter 2 Examples

The EJS console Output area shows the program's print-line output.

Euler Falling Ball

The Euler Falling Ball model is a simple example that has a variable table and an explicit evolution page.  Although the model has only eleven lines of computer code, EJS builds a complete Java program, compiles the program, and runs the program when the the taskbar's run button is pressed.

 

The Euler algorithm applied to a falling ball is implemented in the evolution page and this page is executed at the slow rate of two times per second because we wish to see the data is it is being generated.  Most models will have a frames per second (FPS) property that is much higher.  This model starts to run automatically when the green run button is press because the Autoplay option is checked.  Values are printed in the EJS console output area after every evolution step using the _println method.

 

This first version of the Euler Falling Ball model shows:

  1. how to write Java statements and using various types of variables.
  2. that numerical errors accumulate rapidly when using Euler's method.
  3. that computer arithmetic is not exact.  (Note the time after the 22nd step in not exactly 2.2.)

 

Euler Falling Ball model is designed to teach Java syntax and does not have a user interface. This basic model will be modified in another model to include graphical output and user controls such as start/stop and reset buttons.

Questions:

Related Models

The following EJS models are described in Chapter 2.

Credits:

The Euler Falling Ball Model was created by Wolfgang Christian using the Easy Java Simulations (EJS) modeling tool version 4.1.  You can examine and modify the model for this simulation if you have Ejs installed by right-clicking within the program and selecting "Open Ejs Model" from the pop-up menu. 

 

Information about Ejs is available at: <http://www.um.es/fem/Ejs/> and in the OSP comPADRE collection <http://www.compadre.org/OSP/>.