In this chapter we do our first simple simulations
and introduce some basic numerical methods techniques involving
the solution of ordinary differential equations.
Such equations are common in physics and here we look a some simple
examples that deal with the motion of a mass in a gravitational
field and a mass attached to a spring.
Thus far we presented only the basic syntax of the
language, so we will carry out the computations in a purely procedural
programming manner. That is, we will put all the code within
method of an application (or the init()
method of an applet) and not use any methods
or any object oriented features of the language.
For similar reasons, we will only use console output
here and not employ any other I/O or graphics techniques until we
cover those topics in later chapters.
The topics here include:
The demo programs will also illustrate some of the floating
point issues like round-off errors that we briefly discussed
in the Chapter 1: Tech
Latest update: Dec.12.2003