In this particular cases rational numbers provide 
an escape:

   hilbert 10x
   1  1r2  1r3  1r4  1r5  1r6  1r7  1r8  1r9 1r10
 1r2  1r3  1r4  1r5  1r6  1r7  1r8  1r9 1r10 1r11
 1r3  1r4  1r5  1r6  1r7  1r8  1r9 1r10 1r11 1r12
 1r4  1r5  1r6  1r7  1r8  1r9 1r10 1r11 1r12 1r13
 1r5  1r6  1r7  1r8  1r9 1r10 1r11 1r12 1r13 1r14
 1r6  1r7  1r8  1r9 1r10 1r11 1r12 1r13 1r14 1r15
 1r7  1r8  1r9 1r10 1r11 1r12 1r13 1r14 1r15 1r16
 1r8  1r9 1r10 1r11 1r12 1r13 1r14 1r15 1r16 1r17
 1r9 1r10 1r11 1r12 1r13 1r14 1r15 1r16 1r17 1r18
1r10 1r11 1r12 1r13 1r14 1r15 1r16 1r17 1r18 1r19

   x=: hilbert 10x
   y=: %. x
   >./|, (=i.10) - x +/ .* y
0

That is, y is the exact inverse.  My favorite 
factoid on Hilbert matrices:

   H=: hilbert          NB. synonym
   det=: -/ .*          NB. determinant    
   det H 5x
1r266716800000
   % det H 5x           NB. reciprocal is integral
266716800000
   q: % det H 5x        NB. prime factors
2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 5 5 5 5 5 7 7 7
   ~. q: % det H 5x     NB. unique prime factors
2 3 5 7
   i.&.(p:^:_1)@+: 5x   NB. all primes < 2*n
2 3 5 7

   (i.&.(p:^:_1)@+: -: [EMAIL PROTECTED]:@(%"_)@[EMAIL PROTECTED]) 5x
1
   (i.&.(p:^:_1)@+: -: [EMAIL PROTECTED]:@(%"_)@[EMAIL PROTECTED]) 50x
1



----- Original Message -----
From: John Randall <[EMAIL PROTECTED]>
Date: Monday, January 15, 2007 9:25 am
Subject: Re: [Jgeneral] Invert max  and LAPACK

> Joey K Tuttle wrote:
> > On my G5 iMac -
> >
> >     x=: 1000 1000 [EMAIL PROTECTED] 0         NB. random real matrix
> >     6!:2 'y=: %. x'             NB. invert it
> > 13.7781
> >
> >     >./|, (=i.1000) - x +/ .* y  NB. how accurate?
> > 1.97126e_13
> >
> 
> Random matrices tend to be numerically stable.  Unstable ones crop 
> up all
> the time.
> 
>   hilbert=:]\ %@(i.&.<:@+:)
>   x=:hilbert 10
>   y=:%.x
>   >./|, (=i.10) - x +/ .* y
> 0.108042


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to