« first day (991 days earlier)      last day (39 days later) » 

10:25 AM
0
Q: Repeated function application in APL

August KarlstromGiven the integers p, q and n I would like to generate a vector of length n with the elements (⌊p ÷ q) (⌊(⌊p ÷ q) ÷ q) ... In other words I want to construct a vector where the i:th element is {⌊⍵ ÷ q} applied n times on p. How can I do that in APL?

 
 
7 hours later…
5:44 PM
Okay I have yet another interesting project: Generating a big matrix of 0s and 1s that represents the Ulam spiral
First thing is I have to generate a rectangular spiral, I suppose
Ooh there's J code for generating integer volutes, with involutes (starts in a corner) and evolutes (starts in the center; what I'm looking for) jsoftware.com/papers/play132.htm
 
6:08 PM
@Sherlock9 here's an APL port from a while back
 
6:53 PM
@dzaima Ooh thanks
Hm, this makes me wonder if the ]plot command can do multi-dimensional input
 
@Sherlock9 ]plot -type=Scatter (?100⍴100)(?100⍴100)
 
@dzaima :D Thanks again! I shall go find the documentation
 
@Sherlock9 ]plot -???
the crosses seem to not scale down though, making the result pretty much intelligible
 
7:18 PM
Ah well, there is always room for improvement
 
 
1 hour later…
ngn
8:32 PM
@ngn another -40% by inlining r:
h←{⎕io←0⋄a⊣{d←1+2×⍵⋄a[¯1+d×1+⍳⌈¯1+d÷⍨1+n;⍵+d×⍳⌈d÷⍨n-⍵]←0}¨1+⍳⌊⍵÷2⊣a←1⍴⍨2⍴n←⍵}
g←{⎕io←0⋄⊃¨(|-/s)(2××/d)(+/s←×⍨d←(⊂,h⍵)/¨(⍵/t)((⍵×⍵)⍴¯1+t←2×1+⍳⍵))}
actually the % depends very much on the argument, i was testing with 200 this time. with 1000 it's more like 14%
 

« first day (991 days earlier)      last day (39 days later) »