User:Devon McCormick/JacobiByMcIntyre
This is an article by Donald McIntyre on Jacobi's method for eigenvalues from the January, 1993 issue of Vector (Vol. 9, No. 3). It's of interest as background to the "At Play With J" essay by Eugene McDonnell which refers to it. It's a bit dated from a code perspective as it uses an older version of J but it's useful as an introduction to eigenvalues and their interpretation and use.
Also, modern versions of outdated code have been added, so this now works in a contemporary version of J.
All the code from the article, along with updated versions of two routines, is available File:JacobiMcIntyreAllCode.txt here; most of the earlier definitions will work in a contemporary (ca. 2012) version of J. The only two that had to be updated were the main "jacobi" routine and "pt" for "pivot in triangle". Also, function definitions are assigned using global assignment "=:", as is the global iteration maximum "MAXIT" (which is also capitalized in deference to the widespread practice of naming global variables in this fashion.)
It should be noted there is a J addon, jacobi.ijs, for Jacobi's method under math/misc.
The J in this following section works in the current version of J if we re-write the definition of "pt" to be one of these two equivalent sentences:
pt=: (, i. >./@(ut # ,))@:| pt=: [: (, i. [: >./ ut # ,) |
This, and the other code in this section, may be found File:P127Code.txt; this also includes a definition of the matrix "y" as shown in the article since the current random number generator gives a different answer.
The J in this section, after the initial one-line definitions, starts to get very outdated, especially in the definition of the "jacobi" function. Note the use of "y." instead of "y" and the old loop construct. Of particular historical interest are the uses of explicit loop constructs (like "end)" for line labels) and "$." for flow control. The code, as shown, may be found File:P128Code.txt.