For further appreciation of the inverse of a function ^:_1  I was
looking at the dot product

  dp =: +/ . *

With a 3x3 matrix

   ]m =: ?3 3$10
9 5 3
9 6 9
0 6 3

and a vector 1 2 3 it gives:
   
   m dp 1 2 3
28 48 21

Here comes the inverse:

   m dp^:_1 (28 48 21)
1 2 3

Wow! But it even produces least squares solutions:

   m dp^:_1 (28 48 22)
0.909091 2.18182 2.9697

Amazing :-)

Ben


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: dinsdag 22 maart 2011 2:24
To: 'Programming forum'
Subject: Re: [Jprogramming] Adding up digits in a long number


   n =. <.@o. 10^50x
   n
314159265358979323846264338327950288419716939937510
   
   10#.^:_1 n
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8
4 1
9 7 1 6 9 3 9 9 3 7 5 1 0
   
   10#.10#.^:_1 n
314159265358979323846264338327950288419716939937510
   
This is such a clear example of the power of an inverse of a function
^:_1
it is a shame not to stop a while and appreciate it.


   a=:2%:3
   a
1.73205
   
   2%:^:_1 a
3   
   2%:2%:^:_1 a
1.73205
   

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

Reply via email to