Do not be alarmed! :-) The Hilbert matrix is notoriously ill-conditioned and attempts to invert it does go very bad very fast. This is not due to any deficiency in the algorithm or implementation but to the fact that 64-bit floats do not have sufficient precision to represent the answer.
http://en.wikipedia.org/wiki/Hilbert_matrix http://www.jsoftware.com/papers/APLQA.htm#Hilbert_matrix On Mon, Jun 18, 2012 at 4:02 PM, Paul Jackson <[email protected]> wrote: > On 2012/05/11 20:49 , Joey K Tuttle wrote: > > Thanks for the reminders - your Hilbert one gives me the first chance to > > report a crash of J on the iPad. > > > > I tried it on my iMac > > > > H=: %@>:@(+/~)@i. > > 6!:2 '%. H 100x' > > 80.0178 > > > > and then on the iPad - but after a few minutes, the app crashed, hard to > > say what happened, not likely a memory issue since it takes considerably > > less space than 500 500 ?@$ 1000 > > Notes about something I only vaguely understand can lead to an interesting > discovery process. This one was no exception. First, I hadn't read about > extended percision and rational numbers being available until I began > investigating what the trailing x meant. Having played with extened > percision a little in .Net, I was curious if the size of the > computation would indeed be smaller. It runs too slow on my tablet, but on > my Windows machine I found > 7!:2 '%. H 100x' > 22949760 > is about thirty percent larger than > 7!:2 '%. 500 500 ?@$ 1000' > 17305088 > > As I looked at the two approaches, I began noticing how fast their answers > divirged. While the ratio is excellent at H 4, it is terrible by H9. I've > done enough testing now to know this is NOT just the Android port. Both 32 > and 64 bit Windows have the same issue. The following > output was created with J64 Windows j64-701a_setup.exe > 0j2":(%.H 9)% %.H 9x > 9.21 4.19 1.64 1.00 0.98 1.01 1.00 0.99 1.10 > 15.23 5.15 1.75 1.00 0.98 1.01 1.00 0.99 1.10 > 19.85 5.88 1.82 1.00 0.98 1.01 1.00 0.99 1.09 > 23.51 6.47 1.88 1.00 0.98 1.01 1.00 0.99 1.09 > 26.48 6.94 1.93 1.01 0.98 1.01 1.00 0.99 1.09 > 28.93 7.33 1.98 1.01 0.98 1.01 1.00 0.99 1.09 > 31.01 7.66 2.01 1.01 0.98 1.01 1.00 0.99 1.09 > 32.77 7.94 2.04 1.01 0.97 1.01 1.00 0.99 1.09 > 34.30 8.19 2.07 1.01 0.97 1.01 1.00 0.99 1.09 > Having compared the results with other platforms, I can confirm it is the > floating version that is wrong. > -- > Paul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
