Re: [Jprogramming] Goodstein Sequences and Hereditary base-n notation

2018-04-11 Thread Louis de Forcrand
I’ll change my hbi to hbi=: ([ (] +/ . * >:@[ ^ ($: i.@-@#)) #.^:_1)^:(*@])"0 gs=: , >:@# <:@hbi {: I think using power ^: is prettier than using agenda @., and I replaced a fork with a hook. Thanks, Louis > On 12 Apr 2018, at 02:20, 'Jon Hough' via Programming > wrote: > > Very nice solut

Re: [Jprogramming] Goodstein Sequences and Hereditary base-n notation

2018-04-11 Thread 'Jon Hough' via Programming
Very nice solution. This style of solution what I wanted to write. Just to compare: timespacex 'genSeq 2 4 20' 0.000741 13184 timespacex ' gs^:(0~:{:)^:20 ] 4x' 0.000892 49024 As an FYI, there is also a Haskell solutiuon here: https://oeis.org/A211378/a211378.hs.txt In that file there are

Re: [Jprogramming] Goodstein Sequences and Hereditary base-n notation... CRASH!

2018-04-11 Thread 'Jon Hough' via Programming
Must be due to x ^ y returning floating datatypes, and losing precision. depth=:0 S=: 1 :0 : y=.<.y NB. <- floor of y if. 0= y do. 0 else. 'q r'=. (0,m) #: y ( r *(1+m) ^ (0 (m S) x)) + (1+x) m S q NB. <-- ^ returns floating end. ) That will also fix it

Re: [Jprogramming] Goodstein Sequences and Hereditary base-n notation... CRASH!

2018-04-11 Thread Arie Groeneveld
I noticed it has to do with the 0=y testing in S. Instead of producing a zero at a certain point it gives a small value 4.4e_16 and then starts filling the  stack. Op 11-04-18 om 22:05 schreef Jose Mario Quintana: You might like to look also at Arie Groeneveld's message, [Jprogramming] Cr

Re: [Jprogramming] Goodstein Sequences and Hereditary base-n notation... CRASH!

2018-04-11 Thread Arie Groeneveld
Use this:    2x G"0 i.4 2 3 5 7 Op 11-04-18 om 22:05 schreef Jose Mario Quintana: You might like to look also at Arie Groeneveld's message, [Jprogramming] Crash calculating large hyper operations http://www.jsoftware.com/pipermail/programming/2015-November/043351.html Unfortunately, runnin

Re: [Jprogramming] Goodstein Sequences and Hereditary base-n notation... CRASH!

2018-04-11 Thread Henry Rich
What is the maximum recursion depth reached by this program? Henry Rich On 4/11/2018 4:05 PM, Jose Mario Quintana wrote: You might like to look also at Arie Groeneveld's message, [Jprogramming] Crash calculating large hyper operations http://www.jsoftware.com/pipermail/programming/2015-Novembe

Re: [Jprogramming] i. with fill

2018-04-11 Thread Joe Bogner
slick... virtually identical times and yours is more general and clear. thanks (6!:2) 'idotfill (>;:''SF SY PK ... '');(5e6#(>''SF'';''SY''))' 0.150771 (6!:2) '(>;:''SF SY PK ... '') chidot (5e6#(>''SF'';''SY''))' 0.158705 On Wed, Apr 11, 2018 at 4:44 PM, Raul Miller wrote: > Here's what

Re: [Jprogramming] i. with fill

2018-04-11 Thread Raul Miller
Here's what I'd start with: chidot=: #@[ ({. i. }.) , If that was too slow, I'd probably build an explicit work-alike, with intermediate variables for shapes. (>;:'SF SY PK ...') chidot (>;:'SF SY') 0 1 -- Raul On Wed, Apr 11, 2018 at 4:35 PM, Joe Bogner wrote: > I often get tripped up

[Jprogramming] i. with fill

2018-04-11 Thread Joe Bogner
I often get tripped up with different trailing shapes when using i. with char arrays. I must not be the only one[1] Does this look like a suitable utility to deal with it or is there a more common way? Y1=:0&{:: Y2=:1&{:: idotfill =. (( ( (_,]) {. Y1@[) i. ((_,]) {. Y2@[) ) {:@$@Y2 >. {:@$@Y1) f.

[Jprogramming] Goodstein Sequences and Hereditary base-n notation... CRASH!

2018-04-11 Thread Jose Mario Quintana
You might like to look also at Arie Groeneveld's message, [Jprogramming] Crash calculating large hyper operations http://www.jsoftware.com/pipermail/programming/2015-November/043351.html Unfortunately, running on the latest stable release, JVERSION Engine: j806/j64nonavx/windows Release: comm

Re: [Jprogramming] github-based addons

2018-04-11 Thread Raul Miller
This looks like a good idea. The one suggestion I would have is that this makes it easy to install broken stuff. Of course, we have already had breakages with system upgrades - interface changes or removed dependencies can show up as addons not working right. It might be nice to have a way of mark

[Jprogramming] github-based addons

2018-04-11 Thread chris burke
(This is cross posted to general and programming - please send any comments to general.) We plan to move the addons source from SVN to github, and at the same time support installs from personal github repos outside the main addons source. See code.jsoftware.com/wiki/Addons/GitHub . We have this

Re: [Jprogramming] Goodstein Sequences and Hereditary base-n notation

2018-04-11 Thread Louis de Forcrand
Hi, This is my tacit version. Not claiming speed (or anything in the way of code legibility for that matter). The important verb is hbi, hereditary base-x incrementation of y used in creating the Goodstein sequence. My gs verb uses a starting base of 2, and gss starts with base x: hbi=: ([ (] +

Re: [Jprogramming] Goodstein Sequences and Hereditary base-n notation

2018-04-11 Thread 'Jon Hough' via Programming
My first answer was actually comletely wrong, and only works for the simplest cases. This is a more robust and correct solution goodstein=: 4 : 0"0 0 if. y = x do. x+1 return. elseif. y = 0 do. 0 return. end. s=. I. x (|.@:((>:@:>.@:^. # [) #: ])) y d=. (x+1) ^ (x:x) goodstein x: s +/d ) G=:

[Jprogramming] Goodstein Sequences and Hereditary base-n notation

2018-04-11 Thread 'Jon Hough' via Programming
Goodstein's theorem: https://en.wikipedia.org/wiki/Goodstein%27s_theorem This states that every Goodstein sequence eventually terminates at 0. The wikipedia page defines Goodstein sequences in terms of Hereditary base-n notation one such sequence is 4,26,41,60... Copying verbatim from wikipedia: