Tag Archives: MATLAB

The One-Line Maze Program in MATLAB

A classic one-line program for the Commodore 64 microcomputer is 10 PRINT CHR$(205.5+RND(1)); GOTO 10 This is essentially what was printed in the section “Random Graphics” of the Commodore 64 User’s Guide (1982). The program prints a random maze that … Continue reading

Posted in software | Tagged , | 3 Comments

Iterating MATLAB Commands

Some MATLAB commands can be “applied to themselves”. A good example is help help, which provides help on the help function. For what other functions fun is fun fun a legal statement that produces something interesting? Here are some examples … Continue reading

Posted in software | Tagged | 2 Comments

Improved MATLAB Function Sqrtm

The MATLAB function sqrtm, for computing a square root of a matrix, first appeared in the 1980s. It was improved in MATLAB 5.3 (1999) and again in MATLAB 2015b. In this post I will explain how the recent changes have … Continue reading

Posted in research | Tagged , | Leave a comment

A Collection of Invalid Correlation Matrices

I’ve written before (here) about the increasingly common problem of matrices that are supposed to be correlation matrices (symmetric and positive semidefinite with ones on the diagonal) turning out to have some negative eigenvalues. This is usually bad news because … Continue reading

Posted in research | Tagged , | Leave a comment

Empty Matrices in MATLAB

What matrix has zero norm, unit determinant, and is its own inverse? The conventional answer would be that there is no such matrix. But the empty matrix [ ] in MATLAB satisfies these conditions: >> A = []; norm(A), det(A), … Continue reading

Posted in matrix computations | Tagged | 1 Comment

Updated Catalogue of Software for Matrix Functions

Edvin Deadman and I have updated the catalogue of software for matrix functions that we produced in 2014 (and which was discussed in this post). The new version, which has undergone some minor reorganization, is available here. It covers what … Continue reading

Posted in software | Tagged , , , | Leave a comment

The Improved MATLAB Functions Expm and Logm

The matrix exponential is a ubiquitous matrix function, important both for theory and for practical computation. The matrix logarithm, an inverse to the exponential, is also increasingly used (see my earlier post, 400 Years of Logarithms). MATLAB R2015b introduced new … Continue reading

Posted in research | Tagged , | Leave a comment

Corless and Fillion’s A Graduate Introduction to Numerical Methods from the Viewpoint of Backward Error Analysis

I acquired this book when it first came out in 2013 and have been dipping into it from time to time ever since. At 868 pages long, the book contains a lot of material and I have only sampled a … Continue reading

Posted in books | Tagged | 1 Comment

Anderson Acceleration

Anderson acceleration, also known in quantum chemistry as Pulay mixing or direct inversion in the iterative subspace (DIIS), is a technique for accelerating the convergence of a fixed-point iteration. It has been widely used in electronic structure computations, but does … Continue reading

Posted in research | Tagged , , | Leave a comment

The Spotlight Factor

In my Handbook of Writing for the Mathematical Sciences I described the spotlight factor, originally introduced by Tompa in 1989. The spotlight factor is defined for the first author of a paper in which there are authors listed alphabetically, and … Continue reading

Posted in writing | Tagged | 3 Comments