xiv Preface
The included OPEN DESIRE program for Linux solves up to 40,000 ordi-
nary differential equations and implements exceptionally fast and convenient
vector operations. A smaller educational 20,000 differential-equations ver-
sion for Microsoft Windows
TM
can be obtained without charge from the
author by sending an email to gatmkorn@aol.com. The user can run, edit,
and modify the example simulations keyed to the figures in this book, plus
many other examples. Many of our programming principles also apply to
simulation programs other than DESIRE.
Chapter 1 introduces our subject with a few programs for small differen-
tial-equation models, including a simple guided-missile simulation. The
remainder of the book presents new material. Chapter 2 begins with a careful
discussion of models that involve sampled-data operations and sampled-data
difference equations together with differential equations. We model mixed
analog–digital systems such as simulated digital controllers and systems with
limiters and switches. At this point, we show that many very useful devices
(e.g., track-hold circuits, trigger circuits, signal generators, automatic scal-
ing) are neatly and efficiently modeled with simple difference equations.
Last, but not least, we propose improved techniques for proper numerical
integration of switched variables.
Truly powerful simulation programs need a readable notation for vector
and matrix assignments, differential equations, and difference equations.
Chapter 3 introduces a novel vector compiler that produces very fast pro-
grams for vector and matrix operations. We also demonstrate efficient use of
submodels. We present examples from control engineering and nuclear-reac-
tor simulation. The following chapter then shows how we use vectors to repli-
cate complete models.
Chapter 4 describes practical model replication (vectorization): a single sim-
ulation run with a vector model will replace hundreds or thousands of conven-
tional simulation runs. We apply the vectorizing compiler introduced in Chapter
3 to parameter-influence studies and Monte Carlo simulation of dynamic sys-
tems with noise-perturbed parameters and random initial conditions. We com-
pare repeated-run and vectorized Monte Carlo studies of a weapon trajectory.
Our interactive programs produce not just time histories of system variables but
also time histories of statistics such as averages, mean squares, and probability
estimates. We also show explicitly how to estimate probability densities.
Chapter 5 discusses more difficult vectorized Monte Carlo simulations
involving time-varying noise, which has to be derived from periodic pseudo-
random noise samples. Examples include Monte Carlo simulation of a contin-
uous random walk, another trajectory study, and two vectorized control-system
simulations. An inexpensive 2.4-GHz personal computer exercised 1000
random-input control-system models in seconds. We also describe a new heuris-
tic test for the quality of pseudorandom noise.