Linear Algebra

ALAMA Calclator Portrait View
ALAMA Calculator Landscape View

Welcome.  This page is primarily intended for ALAMA calculator files.  For more information about my views on the subject of linear algebra or the linear algebra textbook that I wrote in 2007 and revised in 2018, consult the URL and click on the “Linear Algebra” menu item.

If you have questions or comments about my text “Applied Linear Algebra and Matrix Analysis, 2nd ed.” (whence the acronym ‘ALAMA’), send them to my UNL email address: Questions or comments about ALAMA calculator should be sent to me via the Contact Me menu item at this site.

About ALAMA Calculator:  This calculator is an easy-to-use button calculator that I programmed off and on for the past few years.  It was originally for my amusement, but I was struck by how useful this simple button calculator could be as a tool in a linear algebra course.  So wrote it with an eye to it being a helpful companion for the ALAMA textbook, both first and revised editions.  However, it is by no means a requirement for the text and could be used by any student (or teacher or aficionado) of linear algebra.  It has enough capabilities that I could even carry out a few of my textbook projects with it and I used it to create some of the graphs that appear in the revised ALAMA, along with pretty much all the routine matrix calculations in ALAMA — nice tool if you want to check answers.   Included in downloads is the folder ALAMAprograms contains scripts for nearly all the examples from ALAMA that require technology tools, as well as a few programs that I wrote (yes, it’s a fully programmable calculator, but it takes a bit of careful thinking to do it).  I wrote a nice (in my opinion!) User Guide as part of the calculator, so if you’re interested in using more of the capabilities of ALAMA calculator, consult the guide.

I wrote this calculator in C++, so that I could use the excellent packages FLTK and Eigen. It is available on machines with operating systems macOS 10.14.1, Windows 10 and a few flavors of Linux. It will also work on some earlier versions of these operating systems, but no promises there!  Longer term, I may port it to Windows UWP or Apple iOS, but these are much more extensive projects.  I have no idea how suitable the APIs of UWP are for the calculator and good old Apple, Objective C wasn’t different enough from C++, so now we have Swift, which is a problem since FLTK and Eigen are written in C++.

Fun with ALAMA Calculator:  Recently, I ran across an incredibly charming example of how theory, application and computation blend together beautifully in linear algebra.  The example is the subject of the SIAM 2018 John von Neumann Lecture delivered by an outstanding researcher of numerical linear algebra, Charles Van Loan, where he made some fascinating observations on how to systematically “untangle” a randomly selected polygon, no matter how convoluted it is. The idea is as follows: Say that the polygon is described by distinct vertices (x0, y0),…,(xn, yn), where the last vertex is connected to the first. Consider this iterative process for constructing successive polygons:

  1. Construct the initial polygon by a random selection of x- and y-coordinates for n+1 vertices, (x0,y0),…,(xn, yn).
  2. Translate the polygon so that the centroid of the resulting polygon is at the origin (obtained by averaging each of the sums of x- and y-coordinates, dividing by n+1 and subtracting the results from each coordinate).
  3. Use the vector 2-norm to normalize the size of the polygon so that the norms of the vectors of x- and y-coordinates coordinates are both one.
  4. Plot this polygon in the xy-plane.
  5. Construct a new polygon from the old by replacing each vertex (xi, yi ) by the midpoint vertex ((xi, yi) + (xi+1, yi+1))/2 of the segment connecting these two points of the polygon, where the indices are computed mod n+1.
  6. Repeat steps 3-5 until the polygon shapes settle down to an approximately constant form.

The tools in this exploration are two ALAMA calculator programs (VanLoanExampleN.alm and VanLoanExampleNcplx.alm) which are available in the downloads below, or you may write your own programs that achieve the same results. The suffix ’N’ means that the standard normal distribution was used to generate it.  In addition, the suffix “cplx” means that the following alternative method was used in place of steps 3 and 4: View the x- and y-coordinates of a point as coordinates of the complex number z = x + yi, normalize the resulting vector of complex numbers with the complex 2-norm, plot the resulting polygon in the complex plane and construct a new polygon by averaging successive vertices.

Here are pictures of the results where the number of vertices is 14 and 10 iterations of the process above are used to generate each figure using the real and complex versions of the algorithm. The figures are scaled up by factors of 3 and 4, resp., and colors for successive figures starting with the random polygon are black, red, green, blue, dark yellow and cyan:


Every time you repeat this experiment, you get similar results: The limiting polygon takes a familiar shape.  How to explain this settling down to a constant convex figure?  Linear algebra to the rescue, and I’ll leave the full explanation for the reader to explore, but here’s the first step: the averaging of step 5 can be viewed as a matrix/vector multiplication, where the vectors are vectors of x- and y- coordinates (or a single vector with complex coordinates x + yi in the case of the complex version).

Downloads:  Below are links to pages containing instructions and downloadable copies of ALAMA Calculator along with a folder of programs for the calculator.  All of the files are in compressed format, so need to be unzipped.