Errors in floating point calculations lead %. to conclude that the matrix is non-singular. To get exact results, do as follows:
%. x: z |domain error | %.x:z ----- Original Message ----- From: "Philip A. Viton" <[EMAIL PROTECTED]> Date: Thursday, August 31, 2006 9:10 am Subject: [Jbeta] matrix inverse > Is there something wrong with the matrix-inversion function in > J601v? Remember that for any matrix z, the ranks of z and z'z are > the same. > > Here's some data: > > 1 1.058 1.11936 1.11936 1.18429 1.25298 > 1 1.088 1.18374 1.18374 1.28791 1.40125 > 1 1.086 1.1794 1.1794 1.28082 1.39097 > 1 1.122 1.25888 1.25888 1.41247 1.58479 > 1 1.186 1.4066 1.4066 1.66822 1.97851 > 1 1.254 1.57252 1.57252 1.97194 2.47281 > 1 1.246 1.55252 1.55252 1.93443 2.41031 > 1 1.232 1.51782 1.51782 1.86996 2.30379 > 1 1.298 1.6848 1.6848 2.18688 2.83856 > 1 1.37 1.8769 1.8769 2.57135 3.52275 > 1 1.439 2.07072 2.07072 2.97977 4.28789 > 1 1.479 2.18744 2.18744 3.23523 4.7849 > 1 1.474 2.17268 2.17268 3.20252 4.72052 > 1 1.503 2.25901 2.25901 3.39529 5.10312 > 1 1.475 2.17563 2.17563 3.20905 4.73334 > > read it into J as a numeric matrix, z. > Note that columns 2 and 3 are identical. > > Now compute: > > mp =. +/ . * NB. matrix product > zp =. |: z NB. transpose > zpz =. zp mp z NB. z'z > > Since this does not have full rank, the inverse matrix > does not exist. But > > %. zpz > > produces a result. Why? I read my matrix z into > a statistics package and went through the same steps > there: the package refused to compute the inverse > reporting (correctly) that the matrix was singular. > > The Dictionary page for %. says that for a non-singular > matrix, mondaic %. computes the inverse. There's no > mention of what happens if the matrix is singular; one > would assume that some sort of failure would be reported, no? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
