by
David Acheson
QBasic is, so far as I know, distributed with every version of Microsoft system software, i.e. Windows 95, Windows NT and the later versions of DOS. If it is not on your hard disk try looking at the installation disks or CD-ROM.
I have tried to make the programs powerful and effective but simple to understand. They make no attempt, then, to compete with sophisticated professional software, and have a really rather different purpose.
To download any of the programs individually, click on a file name, and then save the file (using the File menu in Netscape for example). Alternatively, download all the files at once, in compressed form, by clicking at the bottom of this page.
To stop program execution at any time, press Ctrl-Break. In some programs, pressing q for "quit" will cause a request for a new set of initial conditions to appear on screen.
The first six are general-purpose programs
for the
numerical integration of systems of ordinary differential
equations.
This program numerically integrates a single differential equation of the form
It is currently set up for equation (4.1), and can be used to confirm Fig. 4.1.
This program is for an autonomous 2nd-order system
The program is currently set up for the damped linear oscillator (Fig. 5.18).
This program is the backbone for many others in the book, and is for a general nth-order autonomous system.
As it stands, it is set up for the Lorenz equations (11.7), and on inputting r=28, say, we obtain the distinctive `butterfly' of Fig. 11.10.
This program is similar to NPHASE, but plots one of the variables against time t.
It can be used to investigate
(b) whether the numerical integration can be `trusted' at all, i.e. whether it produces the same results if the time-step is either halved or doubled. This is because the user is asked, repeatedly, to input (two) initial conditions, a time-step h, and a colour (integer from 1 to 15) in which to present the resulting x-t graph. (To get out of this loop, press Ctrl-Break.)
This program is, again, similar to NPHASE, but it allows us to investigate the effects of gradually changing a parameter which occurs in the equations.
The program is currently set up for the forced Duffing equation (11.14), converted into an autonomous 3rd-order system. The parameters are as in Fig. 11.16.
Try inputting w=1, and when the system has settled into a closed curve, corresponding to a periodic oscillation, press q for "quit". You can then change the parameter w to a new value, and on pressing RETURN the numerical integration will continue from where the system had just got to.
Gradually increasing w from say 1.0 to 1.6 results eventually in a sudden change in the oscillation, and on then gradually decreasing w again the oscillation again jumps back to its original form, but at a lower critical value of w. This is hysteresis, which is quite a common feature of nonlinear systems.
This program provides an animation of simple pendulum motion, by numerically integrating the relevant equations (see Ex. 5.5). There is frictional damping in the model, and as it stands the damping coefficient in the program is k=0.1 . Try the following input values for the initial angle and the initial angular velocity:
This program provides an animation of a double pendulum which has its pivot vibrating up and down (Sections 12.4, 12.5).
The amplitude and frequency of this up-and-down pivot motion are denoted by a and w respectively. As in PENDANIM, the frictional damping coefficient is set at k=0.1 in the program. The parameter m, currently set as 0.1 in the program, is defined by:
For chaotic motion, try inputting
For instability of the unvibrated `inverted' state and consequent `collapse' try
For stabilization of the inverted state by pivot vibration, as in my upside-down pendulum theorem), try
This program corresponds to the famous `three-body problem', in which 3 point masses attract one another according to the inverse square law of gravitation (Section 6.8).
The program is essentially NPHASE, with a fixed time step h. The step-by-step method loses accuracy during `close encounters' between masses. One indication of computation accuracy is provided by the total energy, which is continually updated and displayed on screen, and should, in principle, be constant.
As the program stands, the three masses are equal, and all the initial positions and velocities are fixed, except for the initial coordinates of the `third' mass m3.
Try, for example, the following values for x3, y3:
This program uses a step-by-step method to numerically integrate the heat equation (7.16), with a given initial temperature distribution T=f(x), specified in the program.
If we input, say, m=50 (number of grid points in x-direction) and k=.0001 (time step), we see the initial hot spot spread out, quickly at first and more slowly later on.
Warning: inputting a larger value of k than is advised in HEAT will lead to a dramatic numerical instability, which can, in my experience, `crash' the computer system, so be ready to press q for "quit".