Language
Octave
- First appeared
- 1988
- Paradigm
- Array-oriented, imperative, dynamically typed
- Toolchain
- GNU Octave 9.4
- Container image
debian:trixie-20261027-slim + octave 9.4.0-1
GNU Octave is a free language for numerical computing, written to run MATLAB programs with few or no changes. Work on it began in 1988, as companion software for a chemical engineering textbook, and the first public release came in 1993. Like MATLAB, it’s still used in engineering and signal processing courses.
Every value is an array, and arithmetic works on whole arrays at once:
values - m subtracts from every element, and A * v is a matrix product.
Octave also ships many of the methods themselves, such as mean, var,
polyfit, and eig. The from-scratch versions here write those out. The
Octave Forge packages, such as statistics with its kmeans, aren’t
installed.
Quirks
*and^are matrix operations.[1 2 3] .^ 2squares each element and gives1 4 9;[1 2 3] ^ 2is an error, because only a square matrix has a power.- Arrays count from 1, and
v(end)is the last element.v(0)is an error. - Dividing integers rounds to the nearest whole number:
int32(7) / 2is 4, andint32(-7) / 2is −4.idividetruncates instead, giving 3. - A line without a semicolon prints its result, so
x = 5showsx = 5. Every line here ends with a semicolon unless it prints on purpose.
Concepts in Octave
- Cross-validation
- Decision tree
- Descriptive statistics
- k-means clustering
- k-nearest neighbors
- Linear regression
- Logistic regression
- Naive Bayes
- Principal component analysis
- Linear regression (built-in)
- Principal component analysis (built-in)
Run the examples locally
You need Docker and Python 3. The harness builds the pinned container and runs every Octave example:
git clone https://github.com/qnixon/dswithx.git
cd dswithx
python3 harness/run_tests.py --language octave