I've been trying to remember Newton's Method and I came upon this:

    f=: 13 :'(A=:1 + ] - *:)N^:y]1'
   f
3 : '(A=:1 + ] - *:)N^:y]1'
   
   f 4
1597r987
   A 4
_11
   
   _11 N^:4]1
|nonce error: N
|   -u%    u d.1

It has been such a long time since I have seen a nonce error that I thought
it was worth sharing!

Linda

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Nimp O
Sent: Monday, February 24, 2014 8:08 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] A Tale Without End

Another nice way to get a lot of digits from the golden ratio is using
Newton's Method.

In : http://www.jsoftware.com/jwiki/Essays/Newton%27s%20Method
N=: 1 : '- u % u d. 1'

correct50 =: '1.61803398874989484820458683436563811772030917980576'
   0j50 ": (1 + ] - *:) N^:7 ] 1
1.61803398874989484820458683436563811772030917980576
   correct50 -: 0j50 ": (1 + ] - *:) N^:7 ] 1
1


   # correct1000 =:
'1.6180339887498948482045868343656381177203091798057628621354486227...'
1002

   correct1000 -: 0j1000 ": (1 + ] - *:) N^:12 ] 1
1
You can get 50 correct digits in 7 iterations and 1000 digits in 12!





> Here are the first 100 digits using this J function:
>    
>    0j101 ":B 
>
1.61803398874989484820458683436563811772030917980576286213544862270526046281
> 890244970720720418939113748
>  
> Linda

                                          
----------------------------------------------------------------------
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