**Also available as eBook on:**

This book provides an introduction to the computer language A Programming Language (APL), providing quick access to the powerful computational capabilities of the language for the newcomer to APL. It focuses on the mathematical nature of the language, and complements standard curricula.

**First Steps With APL**

Interacting with APL

Order of Execution

Negative Sign, Minus Sign

Assignment and Variable Names

Example: Heron’s Formula

The Equals Function

Examples: Right Triangle Test, Conditional Incrementing

Dyadic, Monadic Functions

Functions with Vector Arguments

Examples: Some Uses of Vector Arithmetic

Shape, Reduction Operator

Examples: Average, Dot Product

More on the Reduction Operator

Index Generator

Examples: A Partial Sum, A Sequence for e

Number Forms and Print Precision

Workspaces, System Commands

Exiting APL

Exercises

Fundamentals of Arrays

Example: Polynomial Evaluation

Elementwise Arithmetic

Reshape: Defining Arrays

Reduction

Outer Product

Example: Evaluation of Polynomials at Several Points

Catenation

Catenation of Matrices

Example: Forming a Blockwise Diagonal Matrix

Catenation of Matrices with Vectors

Indexing

Example: Elementary Row Operations on Matrices

Shape

Empty Arrays

Exercises

Elementary Function Definition

Function Definition

Example: A Function for Polynomial Evaluation

Example: Approximating Areas Using Right-Hand Endpoints

Random Integers, Random Reals

Correcting a Function Line

Commands for Editing Functions

Suspended Functions; Interrupts

System Commands

Branching: Simple Loops

Example: Newton’s Method

Statement Separation, Diamond

Explicit Output

Example: Fibonacci Numbers

Exercises

Matrix Algebra

Matrix Product

Example: Markov Processes

Solving Linear Systems Matrix Divide

Example: Some Solutions of Linear Systems

Outer Product

Example: Polynomial Interpolation

Example: Polynomial Evaluation Revisited

Least-Squares Solutions of Linear Systems

Example: Least-Squares Polynomial Curve Fitting

Matrix Inverse

Matrix Transpose

Example: A Formula Using Transpose

Example: Gram-Schmidt Orthogonalization

Example: Testing for Orthonormality

The Power Method

Exercises

Data Comparison and Logical Functions

Relational Functions: Comparatives

Example: Averages on Selected Scores

Logical Functions

Example: Frequency Distribution

Generalized Inner Product: Vectors

Example: Weighted Average

Generalized Inner Product: General Arrays

Example: Paths in Graphs

Floor, Ceiling

Example: Rounding to a Decimal Position

Membership Function

Comparison Tolerance

Exercises

Simulation and More Mathematical Functions

Roll, Deal, and Random Link

Example: Matching Partners

Example: Simulating A Classical Probability Experiment

Example: Polya’s Urn Scheme

Factorial and Binomial

Example: Binomial Distribution

Example: Polynomial Translation

Trigonometric Functions

Example: Monte Carlo Integration

Exercises

Statistics and Graphics

Mean and Standard Deviation

Maximum and Minimum

Example: Range

Grade Up

Example: Median

Character Arrays

Example: Frequencies

Example: Histograms

Replicate on Vectors

Example: Separating Data

Scan

Example: Cumulative Histogram

Plotting X-Y Points

Example: Least-Squares Line Fitting

Sampling

Example: Sampling from an Exponential Population

Example: Sampling from a Binomial Distribution

Example: Sampling from a Normal Population

Exercises

More Array Manipulation

Take and Drop Vectors

Example: Polynomial Addition

Take and Drop on Matrices

Ravel Replicate, Compression, and Expansion

Example: Constructing Data with a Given Distribution

Reverse

Rotate

Example: Polynomial Multiplication

Dyadic Transpose

Transpose on Higher Dimensional Arrays

Laminate

Example: Constructing Banded Matrices

Exercises

Sorting and Coding

Grade up, Grade Down

Grade up, Grade Down on Matrices

Example: Manipulation of Grade Point Average Statistics

Index Relative to a Vector

Example: Alphabetization

Example: Removing Duplicated and Frequency Revisited

Index Origin

Example: Polynomial Evaluation in Both Index Origins

Residue: Modular Reduction

Example: Finite Field Tables

Example: Alphabetization with Mixed-Case Letters

Represent

Base Value

Example: Polynomial Evaluation, Finis

Represent and Base Value on Arrays

Atomic Vector

Example: Encoding a String into Binary

Example: Hamming Code for Error Correction

Example: Hamming Code on Natural Text

Exercises

More Function Definition

Functions for Programming Uses

Example: Descriptive Statistics

Branching

Line Labels

Example: Aggregating Preferential Ballots

Multioption Branches

Example: The Bisection Method

Recursive Functions

Example: Generating Permutations

Example: Adaptive Integration

Quad: Input and Output

Quote-Quad: Input and Output

Example: Entering a Matrix Name-List

Example: More Adaptive Integration

Format

Example: Formatting an Interest Table

Execute

Example: Entering a Matrix Name-List, Revisited

Example: Matrix to a Power-of-2 Power

Functions as Arguments of Functions

Exercises

Appendix A

Help, Error Messages, and Debugging

A.1 Surprises for New Users

A.2 Error Messages

A.3 Suspended Functions

A.4 Example: Debugging with Quad Output

A.5 Setting Traces and Stops

Appendix B

Workspace Environment

B.1 Workspace Contents: Saving and Loading

B.2 Workspace Management

B.3 System Commands

B.4 System Variables

B.5 System Reports and System Functions

Appendix C

Keyboards

Appendix D

Answers to Selected Exercises

Bibliography

References

Index

### Biography

Reiter, C.A.