Home : Map : Chapter 9 : Java : Tech : Physics :
Physics Model & Simulator
JavaTech
Course Map
Chapter 9

Introduction
Overview
Streams
Wrappers,Buffers
Console I/O
  Text Output 
     Demo 1

  Formatter/printf()
     Demo 2

  Tex 2t Input
     Demo 3

  Scanner
     
Demo 4
File Class
  File I/O
  File Output-Text
     Demo 5

  Formatter to File
     Demo 6

  File Input - Text
    Demo 7

  Scanner - Files
     Demo 8

  File I/O - Binary
     Demo 9
   Demo 10
File Chooser Dialog
  Demo 11

Character Codes
  Demo 12
   Demo13
Object I/O
Types to Bytes
Stream Filters
Other I/O Topics
Exercises

    Supplements
Character I/O
  Demo 1   Demo 2
Random Access
  Demo 3
ZIP/GZIP Streams
  Demo 4
Piped Streams
  Demo 5
NIO Framework
More NIO
  Demo 6

     About JavaTech
     Codes List
     Exercises
     Feedback
     References
     Resources
     Tips
     Topic Index
     Course Guide
     What's New

The core of any physics simulator is, of course, the emulation of the theoretical description of the phenomena of interest. This means implementing the relevant equations with numerical techniques. However, even this is not as straightforward as it first seems.

Say, for example, that we want to measure the gravitational constant G in

FG = GMm/r2

Newton, unfortunately, did not have access to a desktop computer with Java installed to do simulations of experiments to measure G. Nevertheless, we can look at how he might have used a simulator to design and analyze such an experiment. The procedure will be general to any type of physics experiment simulation.

Before we begin we must first deal with some basic questions and options for this experimental simulation:

  1. What aspects of the phenomena will we simulate?

    • We could look at the torsion on a thread holding a mass that is attracted to a nearby large mass.
    • We could look at the acceleration of a mass m due to the FG from another mass M.
       
  2. In what environment or context will the experiment be done?

    • We could simulate the FG between planet and moon, or even between binary stars, over very large distances.
    • We could look at the force on a small body over a short distance near the surface of the earth.
       
  3. How detailed is the simulation of the physics?

    • At what scale should we simulate the the interactions? For example, FG occurs between every pair of atoms in the bodies of mass m and M.
    • What are the effects of other masses such as other planets on an orbital simuation or of other nearby masses in a torsion experiment?
    • Should we include tidal effects in an orbital simulation, friction in the torsion case, or drag in mass drop?

  4. The experimental apparatus and its operation must also be simulated. This involves several questions:

    • To what detail should the experimental apparatus be simulated?
    • What are the uncertainties in the measurements made by the apparatus?
    • Should there be an option of including systematic errors, such as misalignments in the apparatus?

Regardless of what type of physics or other scientific and engineering simulations you are doing, these types of questions must be answered first before the you can start to create a useful simulation.

To illustrate a physics experiment simulation we will return to the falling body example discussed in Chapter 2: Physics and simulate an experiment common to introductory physics courses in which a student determines the gravitational constant g by measuring the acceleration of a body in free fall. Since the measurements occur over a short range at the surface of the earth, the force can be treated as a constant:

ma = FG = GMm/r2 = mg
where g = GM/Re2 and Re = earth's radius

Thus if we know Re and M, we can obtain a value for G by measuring the acceleration g.

Equations of interest:

FG = ma = md2y/d2t = mg

v = v0 + gt
y = y0 + v0t + 1/2gt2

Where v0 is the initial velocity at time t=0 and y0 is the initial position.

Our detector will provide an estimate of the acceleration by measuring the times that the object passes given points along its fall. This would simulate a photodiode setup or a spark chart system.

Latest update: Jan.27.2004

              Tech
Histogram I/O
Hist I/O - Get/Set
  Demo 1
Hist I/O - Objects
  Demo 2
HistogramStream
  Demo 3
Filtering Data
  Demo 4
Exercises

           Physics
Physics Model
Simulation Design
Physics Simulator
  Demo 1
Experiment Design
Experiment Sim.
  Demo 2
Analysis
Expt. + Analysis
  Demo 3
Exercises

  Part I Part II Part III
Java Core 1  2  3  4  5  6  7  8  9  10  11  12 13 14 15 16 17
18 19 20
21
22 23 24
Supplements

1  2  3  4  5  6  7  8  9  10  11  12

Tech 1  2  3  4  5  6  7  8  9  10  11  12
Physics 1  2  3  4  5  6  7  8  9  10  11  12

Java is a trademark of Sun Microsystems, Inc.