Pascal Programs for
Scientists and Engineers
by Alan R. Miller
The following listings are from my book:
Borland Pascal Programs for Scientists and Engineers,
Copyright © 1993, (SYBEX) ISBN 0-7821-1150-5
These Pascal programs can be
viewed or downloaded. To view a file, click the left mouse button
on the file name. Then, parts of the file can be copied by dragging
the left mouse button through the text (and pressing ^C if in MS
Windows). Paste the information in another application with the
middle mouse button (X Window) or by pressing ^V (MS Windows).
Download a copy of a file by clicking with the
right mouse button
and picking "Save Target/Link As" from the menu. In the dialog box, select
the directory where you want it to be saved.
These programs are designed to run with the
Windows version of Borland Pascal.
Therefore, for the DOS version, two changes must be made:
- Change the third line to: USES Crt
- Remove the next to last line: DoneWinCrt
File names for the original Pascal source
programs are given in one of three ways:
- Main programs have the corresponding figure number.
For example:
- LIST11 is from Listing 1.1
- LIST11-1 is from Listing 11.1
- LIST11D is the double-precision version of Listing 1.1
- Procedures have the INCLUDE name and appear first.
For example:
- SQUARE is Listing 3.2
- GAUSSJ is Listing 4.4
- Main programs created by combining listings, have the main
program name
For Example:
NEWTON4 combines Listing 8.3 and 8.4
- Listing 1.1,
Testing floating-point operations.
- Listing 1.2,
Testing the Ln and Exp functions.
- Listing 1.6,
Testilng the arc sine and arc tangent functions.
- Listing 2.2,
Calculating the mean and standard deviation.
- Listing 2.3,
Testing the built-in random-number generator.
- Listing 2.4,
A function to generate Gaussian distributed random numbers.
- Listing 2.5,
Testing the Gaussian random-number generator.
- Listing 3.1,
Matrix multiplication program.
- Listing 3.2,
Procedure Square.
- Listing 3.3,
The determinant of a 3-by-3 matrix.
- Listing 4.1,
Solution of three linear equations by Cramer's rule.
- Listing 4.2,
Simultaneous solution by Gauss elimination.
- Listing 4.3,
Solution of simultaneous equations by Gauss-Jordan elimination.
- Listing 4.4,
The Gauss-Jordan elimination procedure.
- Listing 4.5,
Solution of simultaneous equations and matrix inversion by
Gauss-Jordan elimination method (multiple constant vectors may be entered).
- Listing 4.6,
Solution of a set if ill-conditioned equations.
- Listing 4.7,
Reading the data from a disk file.
- Listing 4.8,
The best fit to a set of linear equations.
- Listing 4.9,
Simultaneous solution of equations with complex coefficients.
- Listing 4.10,
Solution of linear equations by Gauss-Seidel method.
- Listing 5.1,
The beginning of a curve-fitting program.
- Listing 5.2,
A plotting procedure.
- Listing 5.3,
Adding a call to procedure Plot.
- Listing 5.4,
Procedure Linfit to simulate a linear fit.
- Listing 5.5,
The revised procedure Write_Data.
- Listing 5.6,
The current main program.
- Listing 5.7,
Procedure Linfit to generate a least-squares fit.
- Listing 5.8,
The complete curve-fitting progam.
- Listing 6.1,
Program to test the sorting routines.
- Listing 6.3,
A bubble-sort routine.
- Listing 6.4,
A Shell sort routine.
- Listing 6.5,
A recursive quick sort.
- Listing 6.6,
A program to sort alphabetic data on disk.
- Listing 7.1,
A parabolic least-squares fit.
- Listing 7.2,
A parabolic least-squares fit using Gauss-Jordan elimination.
- Listing 7.3,
Inputting the polylnomial order from the keyboard.
- Listing 7.4,
Procedures Get_Data and Linfit for the heat-capacity equation.
- Listing 7.5,
Procedure Get_Data and Linfit for the vapor pressure equation.
- Listing 7.6,
An equation of state for steam.
- Listing 8.1,
Newton's method, version one.
- Listing 8.2,
The main program for the second version.
- Listing 8.3,
Newton's method with a test for zero slope.
- Listing 8.4,
Newton's method with a loop counter.
- Listing 8.5,
Procedure Func for e^{x} = 4x.
- Listing 8.6,
The solution of Sin(X) = x/10.
- Listing 8.7,
Solution of the vapor pressure equation.
- Listing 9.1,
Numerical integration by the trapezoidal method.
- Listing 9.2,
An improved trapezoidal method.
- Listing 9.3,
Numerical integration by Simpson's method.
- Listing 9.4,
Numerical integration by the Romberg method.
- Listing 9.5,
Programming the Romberg method with adjustable panels.
- Listing 10.1,
Fitting the Clausing factor to the ratio of two polynomials.
- Listing 10.2,
A least-squares fit to the linearized exponential equation.
- Listing 10.3,
A least-squares fit to the nonlinearized exponential function.
- Listing 11.1,
Calculating the Gaussian error function with Simpson's method.
- Listing 11.2,
An infinite series expansion for the Gaussian error function.
- Listing 11.3,
The error function and its complement.
- Listing 11.4,
Calculating the Gamma function.
- Listing 11.5,
Bessel functions of the first kind.
- Listing 11.6,
Bessel functions of the second kind.
Home, index |
My books |
Fortran |
Book Publishers |
PCs and PC Magazines |
Search
Last revised: January 18, 2013
-- Copyright © 1981-2013