H=: % @: >: @: (+/~) @: i.
   det=: -/ .*

   0j_6 ": det@H"0 i.3 5x
1.000000e0   1.000000e0   8.333333e_2  4.629630e_4  1.653439e_7
3.749295e_12 5.367300e_18 4.835803e_25 2.737050e_33 9.720234e_43
2.164179e_53 3.019095e_65 2.637781e_78 1.442897e_92 4.940315e_108

The preceding computes the determinant of the Hilbert matrix of order
0-14.  The later numbers indicate that the matrices are very nearly
singular.  In such cases it is better to not to produce a result on matrix
inverse but instead more truthfully signal domain error.

As well, it's misleading to judge the quality of ⌹H n by comparing it to ⌹H
n+0x.  Better, I think, to look at how close h+.×⌹h←H n is to the identity
matrix.  You said Nars does well through 12.  I fired up Nars, and:

      ⎕fx 'z←H n' 'z←÷1+∘.+⍨⍳n'
H

      0 ¯4 ⍕ h+.×⌹h←H 12
  1.000E0   ¯1.516E¯6 9.162E¯5 ¯5.689E¯4 8.397E¯3 ¯4.418E¯2  8.586E¯2
¯1.787E¯1  1.740E¯1 ¯2.069E¯1  7.577E¯2 ¯1.666E¯2
 ¯4.262E¯10  1.000E0  9.401E¯6  3.702E¯4 6.376E¯4 ¯1.662E¯2 ¯3.609E¯3
4.427E¯2 ¯8.380E¯3 ¯5.246E¯2 ¯8.840E¯4 ¯7.011E¯3
 ¯2.106E¯9   1.310E¯7 1.000E0   4.874E¯4 1.928E¯3 ¯3.517E¯3  1.780E¯2
¯6.267E¯3 ¯5.421E¯2 ¯8.853E¯2  4.773E¯3 ¯3.261E¯3
  1.439E¯10 ¯2.240E¯7 1.361E¯5  1.000E0  1.561E¯3 ¯1.930E¯2 ¯9.595E¯3
¯8.351E¯3  1.277E¯2 ¯8.644E¯2 ¯1.020E¯4 ¯2.995E¯3
 ¯3.341E¯9  ¯8.130E¯8 4.757E¯6  2.152E¯4 1.003E0  ¯1.248E¯2 ¯9.875E¯3
¯2.338E¯2 ¯2.646E¯2 ¯2.180E¯2  3.163E¯3 ¯3.569E¯3
  2.867E¯9  ¯3.154E¯7 3.221E¯5 ¯1.622E¯4 1.797E¯3  9.907E¯1  2.314E¯2
¯5.096E¯2  2.835E¯3 ¯7.728E¯2  8.604E¯3 ¯3.089E¯3
  2.387E¯9  ¯4.019E¯7 3.047E¯5  2.491E¯4 2.982E¯3 ¯1.269E¯2  1.009E0
¯4.721E¯2  4.133E¯2 ¯5.898E¯2 ¯5.427E¯5 ¯3.163E¯3
 ¯1.555E¯9  ¯2.262E¯7 3.253E¯5  3.957E¯5 1.979E¯3 ¯1.016E¯2 ¯5.039E¯3
9.740E¯1  1.559E¯2 ¯3.719E¯2  1.313E¯2 ¯3.457E¯3
 ¯9.249E¯10  1.446E¯7 2.011E¯5  1.630E¯4 1.268E¯3 ¯9.304E¯3 ¯6.022E¯3
¯1.894E¯2  1.009E0  ¯3.097E¯2  9.581E¯3 ¯1.927E¯3
  1.453E¯9   1.888E¯7 1.126E¯5  1.977E¯4 5.719E¯4 ¯9.099E¯3 ¯3.797E¯3
¯2.931E¯2 ¯1.234E¯2  9.723E¯1 ¯9.762E¯4 ¯2.198E¯3
 ¯1.307E¯9   3.232E¯9 7.623E¯6  1.050E¯4 3.457E¯4 ¯6.768E¯3  1.071E¯2
3.447E¯2 ¯1.285E¯2 ¯2.097E¯2  1.001E0  ¯1.842E¯3
 ¯1.039E¯9   1.911E¯7 6.941E¯6  3.105E¯4 8.445E¯4 ¯6.431E¯3 ¯1.150E¯2
1.330E¯2 ¯1.604E¯3 ¯3.245E¯2  2.224E¯3  9.974E¯1



On Tue, Jun 19, 2012 at 9:43 PM, Paul Jackson <plj...@gmail.com> wrote:

> I don't expect floating answers to be exact.  However, most of my
> use of computers begins with inexact numbers, so getting the floating
> routines as good as possible seems like a worthy effort to me.
>
> Unfortunately, I stopped my reseach when J's answers went very
> wrong at H 9.  Nars also supports extended percision and rational
> numbers, so I've continued the work.  While it does well though 12, it
> goes horribly wrong at 13.
>
>   http://home.comcast.net/~paul.l.jackson/PLJsAPL/JandNars.txt
>
> Paul
>
> On Mon, Jun 18, 2012 at 7:01 PM, Roger Hui <rogerhui.can...@gmail.com>
> wrote:
> > Don't you become even a bit suspicious when the answers don't agree?
> > Consider the number on the lower right hand corner:
> >
> > PLJsAPL:     2815820646.25489
> > Dyalog:      2815825985
> > NARS2000:    2815820182
> > J Rational:  2815827300 (true answer).
> >
> > If you are proud of implementation X, I can bring it down to earth real
> > quick by asking it to invert H 2*n, or by working in rational numbers.
> >
> >   H=: %@>:@(+/~)@i.
> >   (+/ .* %.) H 20x
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to