« first day (756 days earlier)      last day (1906 days later) » 

11:45 AM
I have a challenge I've been puzzling over related to convergents. You can calculate the successive convergents from a continued fraction [a0; a1, a2, ...] by calculating the product of 2 2⍴(a0 1 1 0) and 2 2⍴(a1 1 1 0) and 2 2⍴(a2 1 1 0) and so on
My question is if I had a list representing a continue fraction, could I feed them into one APL function that would calculate the convergent (matrix multiplication and all) in one go?
 
ngn
⎕←+∘÷\2 1 2 1 1 4 1 1 6 1 1 8
 
@ngn
2 3 2.666666667 2.75 2.714285714 2.71875 2.717948718 2.718309859 2.71827957 2.718283582 2.718281718 2.718281835
 
I'm not sure how to do it since my idea is, one dfn does 2 2⍴(an 1 1 0), that's called on each number and then the matrices are multiplied together with (+.×)/
oh
 
ngn
@Sherlock9 ^ something like this?
 
Yeah, I that would be one way. I was trying to take that particular approach to learn more about operating on lists, but that would have been my next question
Oh and I wanted to calculate the numerators and denominators, and not necessarily the decimal form
 
ngn
11:53 AM
⎕←+.×\{2 2⍴⍵,1 1 0}¨2 1 2 1 1 4 1 1 6 1 1 8
 
@ngn
┌───┬───┬───┬────┬─────┬─────┬──────┬───────┬────────┬─────────┬─────────┬──────────┐
│2 1│3 2│8 3│11 8│19 11│87 19│106 87│193 106│1264 193│1457 1264│2721 1457│23225 2721│
│1 0│1 1│3 1│ 4 3│ 7  4│32  7│ 39 32│ 71  39│ 465  71│ 536  465│1001  536│ 8544 1001│
└───┴───┴───┴────┴─────┴─────┴──────┴───────┴────────┴─────────┴─────────┴──────────┘
 
ngn
@Sherlock9 ^
 
Ooh yes I was just getting to that but with the dfn separated out and without the ,
Thanks a bunch
⎕←(+.×){2 2⍴⍵ 1 1 0}¨1 2 2 2 2 2 2
 
@Sherlock9
┌───┬───┬───┬────┬─────┬─────┬──────┐
│1 1│3 1│7 3│17 7│41 17│99 41│239 99│
│1 0│2 1│5 2│12 5│29 12│70 29│169 70│
└───┴───┴───┴────┴─────┴─────┴──────┘
 
Convergents of the square root of 2. Excellent :D
 
ngn
11:58 AM
huh... how did that even work without a backslash
 
@ngn There was a backslash, but it is invisible due to markdown. The bot looks at raw text before rendering.
 
Oh heck it's formatting
 
ngn
@Adám mine was visible though
 
@ngn You monospaced your code with four leading spaces.
 
⎕←+.×\{2 2⍴⍵ 1 1 0}¨1 2 2 2 2 2 2
 
12:00 PM
@Sherlock9
┌───┬───┬───┬────┬─────┬─────┬──────┐
│1 1│3 1│7 3│17 7│41 17│99 41│239 99│
│1 0│2 1│5 2│12 5│29 12│70 29│169 70│
└───┴───┴───┴────┴─────┴─────┴──────┘
 
Huh. Very strange
 
@Sherlock9 What is strange?
Hehe:
⍞←2 \1
 
@Adám 1 1
 
Oh :-(
 
This time I monospaced it by adding four spaces at the beginning but ngn's code doesn't seem to have the same big border
 
12:02 PM
⍞←(2)(1)
 
@Adám 1 1
 
@DyalogAPL !
@Sherlock9 Ah, you put the backslash inside the paren, no?
 
Oh
I am completely out of practice with SE's markdown
 
@Sherlock9 So the escape for some reason works on round parens, but not on curly braces.
@Sherlock9 It is pretty insane in chat.
 
Oh, is there an easy way to populate a list with copies of one number? Phi's convergents are [1; 1 1 1 1 1 1 1 1 1 1 1]
@Adám Ah there is a misunderstanding. My first attempt was not escaped, my second attempt was. I think that was the problem and not the parens
 
ngn
12:05 PM
⎕←(11)1
 
@ngn
SYNTAX ERROR
 
⎕←11⍴1
 
@Sherlock9
1 1 1 1 1 1 1 1 1 1 1
 
I should have guessed
 
ngn
@Sherlock9 or 11\ 1. a backslash solves everything :)
 
12:07 PM
oh that is weird
Not unexpected
But definitely funky
 
ngn
just kidding. is the usual way to do it. backslash in this case is "expand"
 
Ohh. I thought it was a thing scan did
 
⍞←11(1)
 
@Adám 1 1 1 1 1 1 1 1 1 1 1
 
@DyalogAPL !
@ngn @Sherlock9 Another reason to use is that it won't bite you later if you make it into a train.
 
12:14 PM
or if you've got markdown in your shell for some reason :P
 
@Sherlock9 You're kidding, right?
 
@Adám I am, but also what is this Dyalog bot in this chat if not an interactive shell with markdown?
 
@Sherlock9 Right, but "proper" usage of the bot would be with at least four leading space (hey, even a regular APL session has six leading spaces).
 
I genuinely hadn't considered that (I've seen the 6 leading spaces, but not observed them)
 
@Sherlock9 So if you try to use _snake_case_names_ in your shell, it makes the text italic?
 
12:20 PM
It could. I genuinely hadn't thought that far ahead
Although
Discord has also has the annoying tendency to turn 2*3*4 into 2 3 4
 
@Sherlock9 tbf, I've contemplated having code comments render as markdown.
 
Which wouldn't be bad with a competent IDE
But that also depends on the IDE remaining competent
 
⍞←*3*.2
 
@Adám 3.475474233
 
⍞← 3.2
@DyalogAPL C'mon!
⍞← 3.1
 
12:23 PM
@Adám 3.052995299
 
@DyalogAPL Pretty close!
⍞←1 1 1*1 1 1
 
@Adám 2.718281828 2.718281828 2.718281828
 
@DyalogAPL !
⍞←~\1 1 1
 
@Adám 1 0 0
 
⍞←~(1 1 1)
@DyalogAPL Hello
⍞←~(1 1 1)
 
12:27 PM
@Adám 0 0 0
 
@DyalogAPL OK, what about:
⍞←~(1 1 1)
 
@Adám 1 0 0
 
@DyalogAPL Inconsistently off-by-one
 
1:22 PM
Hah, is the bot working in Malbolge today?
 
@J.Sallé No, the bot is behaving normally. But the intersection of Markdown and APL is interesting. URI's intersection with APL is also fun: Try it online!
 
@Adám lol that's interesting
 
@J.Sallé So basically, the idea is that any character which plays a role in markdown (parens are used in links) causes a preceding backslash to be invisible to humans but visible to the bot, so the challenge is to come up with a plausible APL expression where the backslash can be removed and the expression still would work (but obviously would give a different result).
 
1:38 PM
I see
I'll try to come up with something interesting later if I can hahahah
sounds fun
 
The only real candidates are \ * ( ) [ ]
 
 
5 hours later…
6:22 PM
@nathanrogers Just saw this on github, might interest you: github.com/jayfoad/DyalogOpenGL
 
7:04 PM
@H.PWiz Jay already sent that to me a little bit ago. Thanks for the heads up! I've been playing with it, and APL basically directly translates from C
@H.PWiz it only includes GLUT, and so doesn't use the modern Vertex Array method, and uses the old fixed function pipeline method. but it is usable for my purposes
 

« first day (756 days earlier)      last day (1906 days later) »