Xem mẫu

Easy Java Simulations The Manual Version 3.4 - September 2005 Francisco Esquembre Contents 1 A first contact 1 1.1 About Easy Java Simulations . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Installing and running Ejs . . . . . . . . . . . . . . . . . . . . . . . . 2 1.3 Working with a simulation . . . . . . . . . . . . . . . . . . . . . . . . 10 1.4 Inspecting the simulation 1.5 Modifying the simulation . . . . . . . . . . . . . . . . . . . . . . . . 15 . . . . . . . . . . . . . . . . . . . . . . . . 23 1.6 A global vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 2 Creating models 39 2.1 Definition of a model . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 2.2 Interface for the model in Easy Java Simulations . . . . . . . . . . . 43 2.3 Declaration of variables . . . . . . . . . . . . . . . . . . . . . . . . . 45 2.4 Initializing the model . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 2.5 Evolution equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 2.6 Constraint equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 2.7 Custom methods and additional libraries . . . . . . . . . . . . . . . . 65 iii iv chapter 3 Building a view 77 3.1 Graphical interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 3.2 Association between variables and properties . . . . . . . . . . . . . 81 3.3 How a simulation runs . . . . . . . . . . . . . . . . . . . . . . . . . . 82 3.4 Interface of Easy Java Simulations for the view . . . . . . . . . . . . 83 3.5 Editing properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 3.6 Learning more about view elements . . . . . . . . . . . . . . . . . . . 94 4 Using the simulation 103 4.1 Using your simulations . . . . . . . . . . . . . . . . . . . . . . . . . . 103 4.2 Files generated for a simulation . . . . . . . . . . . . . . . . . . . . . 105 4.3 Ejs configuration options . . . . . . . . . . . . . . . . . . . . . . . . 107 4.4 Running the simulation as an applet . . . . . . . . . . . . . . . . . . 109 4.5 Running the simulation as an application . . . . . . . . . . . . . . . 115 4.6 Distribution of simulations . . . . . . . . . . . . . . . . . . . . . . . . 117 CHAPTER 1 A first contact 2005 by Francisco Esquembre, September 2005 We describe in this chapter how to create an interactive simulation in Java using Easy Java Simulations (Ejs for short). In order to get a general perspective of the complete process, we will inspect, run and finally modify, slightly but meaningfully, an already existing simulation. This will help us identify the parts that make a simulation, as well as become acquainted with our authoring tool. 1 1.1 About Easy Java Simulations Every technical work requires the right tool. Easy Java Simulations is an authoring tool that has been specifically designed for the creation of interactive simulations in Java. Though it is important not to confuse the final product with the tool used to create it, and, in principle, the simulations we will create with Ejs can also be built with the help of any modern computer programming language, this tool originates from the specific expertise accumulated along several years of experience in the creation of computer simulations, and will therefore be very useful to simplify our task, both from the technical and from the conceptual point of view. From the technical point of view because Ejs greatly simplifies the creation of the view of a simulation, that is, the graphical part of it, a process that usually requires 1Readers of the OSP Guide (see http://www.opensourcephysics.org) may skip this chapter. The information contained in it has been already covered in the chapter about Ejs of the guide. 1 ... - tailieumienphi.vn
nguon tai.lieu . vn