« first day (2277 days earlier)      last day (370 days later) » 

6:04 AM
Hm. Phase 1:8 in the competition appears to be incorrect. It mentions that critical days happen when a biorhythm crosses the axis in either direction - the usual definition – but the numbers it gives for the periods only take into account upward crosses.
Since the physical and intellectual cycles are odd, their downward cross is between days anyway; it either doesn't create a critical day or creates two of them, depending on interpretation. So ignoring those is probably fine. But the emotional cycle is even and crosses the axis every 14 days instead of every 28, so the periods given that involve it are all too long by a factor of two.
 
6:21 AM
@MarkReed so u saying the 644, 924, and 21252 should be divided by 2?
maybe when they said periodicity of 28 days they meant to say that it intersects the x-axis every 28 days??
if thats the intended interpretation, as opposed to the regular mathematical interpretation of period, then the values are correct as is
but regardless, im pretty sure they dont want to change it cuz the competition has been live for a while now
 
@AidenChow We could add a note to that effect.
 
@Adám true, it would prevent any further confusion regarding period, cuz usually a periodic wave centered around x-axis would intersect the x-axis twice within a period
 
A note would be good. It's just odd that they explicitly say that a critical day happens when it crosses in either direction, and then derive numbers that only find the ones where it crosses in one specific direction.
 
The good thing is that the automatic validation prevents anyone from submitting an answer according to the mathematical understanding.
 
@MarkReed most likely cuz the periodicity they are referring to in the question doesnt exactly match the period in the traditional mathematics sense, they mean to say it cross the x-axis every 28 days, so in effect the period (in traditional math sense) is 28*2=56 days
 
6:36 AM
""Critical days" are days when a cycle crosses the x-axis in either direction and are purported to be accompanied by unstable conditions in the corresponding area. A "double critical day" occurs when two of the three cycles cross the x-axis on the same day. The periodicity of double critical days is the least common multiple of periodicities of the two involved cycles"
it says "in either direction" right there in the task description.
 
@MarkReed its probably better to discard the notion of the period in traditional math for this problem.... the periodicity they are talking about is the # of days between each intersection, no matter what direction
 
No. They say that's what they're talking about, but the numbers they give miss half the crossings.
the issue is the opposite of what you're describing
Your earlier statement is accurate - the 644, 924, and 21252 numbers should be halved
 
ok so u have a graph intersect the x-axis every 28 days, and another intersecting every 33 days, do you not take the lcm of 28 and 33 to get when the two graphs intersect the x-axis together?
@MarkReed yeah ok so i think i understand ur viewpoint, but i think the issue stems from the fact that u r looking at the period in the traditional math sense
the graph doesnt have a period of 28 days; instead it intersects the x-axis every 28 days
if u look at it this way, then the first down cross would be 28 days after ur birthdate, then the first up cross would be 28 days after the first down cross, and so forth. no issues here
both directions are accounted for
but if the periodicity mentioned in the problem is the period in the traditional maths sense, then i would agree with u; u would be absolutely correct here
 
6:55 AM
The emotional biorhythm cycle is a 28-day cycle. That's the whole sine curve in the math sense, and has been since the things were invented. it starts at 0, peaks at 7, crosses the axis at 14 ,bottoms out at 21, and comes back to the start at 28.
 
@MarkReed in that case u should really think as if the graph has a period of 28*2=56 days, cuz as mentioned earlier, the intended interpretation is that the graph crosses the x-axis every 28 days
 
it's not something invented for this task. they were very big in the 70s, rivaling astrology for a while as the in-vogue pseudoscience :) Finding your biorhythms was a popular task in Things to Do With Your Calculator books and introductory BASIC programming problems.
 
well im just saying what the question most likely intended
ofc if in the real world its actually a period of 28 days with intersections at every 14 days then the problem should add a note clarifiying that i suppose
 
I haven't gotten my solution to a submittable form yet. I'm curious to see which way the tests go...
 
@MarkReed obviously the test cases were created with the 644 924 and 21252, ik becuz ive already completed 1:8 using those values
huh wait so i just looked on wikipedia and it said that the equation for the emotional cycle is y=sin(2pi*x/28), suggesting that the period is 28 days
 
7:04 AM
Yes. The period is 28 days.
 
that actually does mean the problem is wrong
 
During which it crosses the x axis twice
 
interesting
 
That's what I've been saying. :)
 
@MarkReed i think the problem in the competition intended otherwise but it doesnt match the real biorhythm
 
7:05 AM
Using the values in the problem my next double critical day is not until Dec 31, but it's actually November 19th: ```Physical day 10: Up but falling; next downward transition: 1969-01-02
Emotional day 16: Down and falling; next valley: 1969-01-05
Mental day 9: Up but falling; next downward transition: 1969-01-08```
 
so it looks like u would be correct
 
oh, whups, wrong year. :)
I'm quite sure they did not intend some alternate-universe version of biorhythms.
It's a simple derivation error
 
probably ask @adam about this, it might be too late to change the problem now...
 
Assuming a 28-day periodicity means critical days happen every 28 days.
I'm sure it's too late to change the problem. But it might be worth a note on the page.
Physical day 0: Critical Upward Transition
Emotional day 14: Critical Downward Transition
Mental day 24: Down and falling; next valley: 2023-11-20
 
well if on the offchance they did decide to change it, all u really need to do is change 644 to 322, 924 to 462, and 21252 to 10626, shouldnt really be too big of a deal
 
7:08 AM
yup.
 
im honestly surprised an issue like this wasnt caught sooner, ig no one here except for u is familiar with what biorhythm is
ok wait up, the wiki is saying that the triple critical days appear every 21252 days, which is what the competition problem put: "the triple combination of 23-, 28-, and 33-day cycles repeats every 21,252 days (or 58.18+ years)."
so that one does not need to be divided by 2 i think
wait wait: "Basic arithmetic shows that the combination of the simpler 23- and 28-day cycles repeats every 644 days"
 
Yes, 644 days is a whole number of 23-day and 28-day cycles
but every 28-day cycle contains two critical days, not one
because, as it says in the problem statement, a critical day happens when it crosses the x axis in either direction
 
so what needs to be divided by 2 then?
 
all three values that include the 28-day cycle
because the problem isn't "when do two cycles both go back to day 0"
it's "when do two cycles both cross the x axis"
based on the definition of critical day at the top of the problem page
which, again, is the usual definition as well
After 644 days, you're back to day.0 on both the physical and emotional cycles. That's where that number comes from, and likewise for the other pairs and the triple. But after just 322 days you're on day 0 of the physical and day 14 of the emotional, which is also a double-critical day for those two cycles.
 
so the 759 is correct but the rest are wrong?
 
7:23 AM
yeah, because it's lcm(23,33), the combination of odd cycles. Which matters because they cross the axis going downward in between days, so you get two almost-critical days on either side of the crossing rather than one critical day on it like you get with the emotional cycle's even period.
 
we need @adam to read all of this, see how he wants to deal with this. i suspect that the problem wont change at all, but a note in the problem statement will be added instead
 
I've posted it to our internal competition chat, but most people aren't working yet (UK and NY time zones).
 
Thanks for passing it along!
 
@Adám ok good to know, yall most likely will leave the problem as is right
 
I'm in the NY time zone myself, but got hit with a bit of insomnia tonight.
 
7:28 AM
isnt it like 3 am in NY
 
3:30!
A note like "to simplify the problem we only consider critical days to occur on upward crossings" would be plenty.
and wouldn't require any code changes.
 
"to simplify the problem" ≈ because we made a mistake ;-)
 
i mean ya gotta do what ya gotta do on "damage control", XD, make it seem like intentional seems the best way to go!
 
tomayto, tomahto
 
i mean honestly i dont think many would care about this note, the people who already did the problem might not even notice and they wont have to change their code, and any newcomers would read the note and not suspect anything (not unless they read the transcript of our conversation, ofc)
win-win situation for all :P
 
7:35 AM
@MarkReed Shouldn't we also change all the places where it says "cross[es] the x-axis"?
 
maybe add in the note that the crossings mentioned in the problem all refer to up crossings
so u dont have to change much
 
 
5 hours later…
12:20 PM
@Adám You could change the definition of "double critical" day to read "A "double critical day" occurs when two of the three cycles cross the x-axis on the same day in the same direction"
that leaves the definition of "critical day" unchanged from the general understanding while still having "double critical" defined to match the code/examples.
 
12:41 PM
@MarkReed But it isn't just the same direction, is it? It'd have to be upwards, if I understand right.
 
12:59 PM
Announcement: Following extensive discussions, there is now a formal proposal for APL Array Notation. Dyalog would appreciate your feedback before proceeding with implementation.
 
@Adám well, the thing is, when considering biorhythms at the granularity of whole days, only the emotional cycle ever crosses downward on any day. The other two cycles only cross downward between days, and thus never contribute to a critical day when crossing in that direction. So the only critical days excluded by the original problem code are thet ones with the emotional cycle crossing downward at the same time as one of the other cycles is crossing upward.
 
clever
 
1:43 PM
@AidenChow that interpretation is only for sinusoids, think about abs(sin(x)), it has the half period of sin(x)
Oh to be honest I never read the graph part so it didn’t trap me.
 
1:58 PM
@Adám what would be the effect of empty line inside [ ] matrix notation?
 
No effect.
 
2:53 PM
On page 4, why is (X⋄) equivalent to ⊂X?
 
@rabbitgrowth It isn't. (X⋄) ≡ ,⊂X but the components of a square-bracket construct have minimum rank 1.
Welcome to APL Quest 2019-4! Today's quest is Knight Moves:
> Consider a chess board as an 8×8 matrix with square (1 1) in the upper left corner and square (8 8) in the lower right corner. Given a 2-element vector representing the current square for a knight, return a vector of 2-element vectors representing (in any order) all the squares that the knight can move to.
 
I expect something better:
{k/⍨×/¨(∘.≥∘1∧∘.≤∘8)k←(¯2 ¯1)(¯2 1)(¯1 ¯2)(¯1 2)(1 ¯2)(1 2)(2 ¯1)(2 1)+⊂⍵}
 
I had (,⍳,⍨8)∩((⊢⊢⍤/⍨3=+/⍤|¨),∘.,⍨3-⍨⍳5)+⊂
 
@Richard At least it is quite clear.
@rabbitgrowth That is… involved. Can you explain a bit?
 
@rabbitgrowth ? :)
 
3:03 PM
What is the relationship between the origin and anywhere the knight can move?
 
I had a hard time wrapping my head around this one, so I might have overcomplicated things
 
@Richard Instead of filtering, you can use
 
(⊢⊢⍤/⍨3=+/⍤|¨),∘.,⍨3-⍨⍳5 is just (¯2 ¯1)(¯2 1)(¯1 ¯2)(¯1 2)(1 ¯2)(1 2)(2 ¯1)(2 1). It's all points of Manhattan distance 3 from the origin
 
Sure, but 3 steps in a straight line is also MD=3.
How about just checking that the (∆y,∆x) is either (1,2) or (2,1)?
 
Manhattan distance of 5?
 
3:06 PM
But I'm limiting it to a 5×5 matrix. Yeah I'm not exactly proud of this one...
 
@LdBeth Typo.
 
oh I definitely did not know how to count Manhattan distance on checkerboard. and of course should exclude straight line.
 
like (1 3)(0 5)(4 9) ∩ ⍳8
that does not work I asume
 
{(⍳8 8)∩(¯2 ¯1)(¯2 1)(¯1 ¯2)(¯1 2)(1 ¯2)(1 2)(2 ¯1)(2 1)+⊂⍵}
 
@Adám ok!
@Adám (,⍳8 8)
 
3:13 PM
Sorry, yes.
 
@Adám (3=+/⍤|){(⍳2)≡{⍵[⍋⍵]}|⍵} ?
 
Sure, that'll work too, but you could use (1 2)(2 1)∊⍨ instead of (⍳2)≡{⍵[⍋⍵]}
 
Ah yes that's nicer, thanks!
 
What is the outer product hint in the problem?
I have been thinking about that a long time
Probably to generate all the possible moves
 
Probably. Not sure.
I have {⍸(1 2)(2 1)∊⍨|⍵-⍥⊆⍳8 8}
-⍥⊆ should be ⊂⍛- but we'll have to wait for 20.0
 
3:16 PM
!
wow
yeah that's much, much better :)
 
Can youexplain that one?
 
|⍵-⍥⊆⍳8 8 computes the absolute (∆y,∆x)'s from the argument to each position. It has to be either (1,2) or (2,1) for it to be a knight move.
 
ah yes!
 
Btw, I really appreciate all the hints about . It's really helped me understand the what and why of it.
 
Here's another one: {⍸5=+/¨×⍨⍵-⍥⊆⍳8 8}
Flat version: {⍸8 8⍴5=+⌿×⍨1-⍵-⍤¯1⊢8 8⊤¯1+⍳64}
 
3:26 PM
ha :) how do you think of something like that :)
 
dunno
It follows from (∆y,∆x)∊(1,2)(2,1) that |(∆y,∆x)|=√5
 
And using 8 8 ⊤. very nice.
 
that's idiomatic for a counter.
we can do the 8 8⍴ using number bases too, but this gets ugly with ⎕io←1: {,⌿1+8 8⊤¯1+⍸5=+⌿×⍨1-⍵-⍤¯1⊢8 8⊤¯1+⍳64}
The completely flat ⎕io←0 version is just {8 8⊤⍸5=+⌿×⍨⍵-⍤¯1⊢8 8⊤⍳64}
Morten wrote this to me, but says it needs ⎕io←0 too, and I don't get it: {⍉8 8⊤(⍳64)∩(8⊥⍵)(+,-)+\6 4 5 2}
OK, I get it now.
But I don't get the right result.
Anyway, enough for today?
 
3:43 PM
I don't even understand the 6 4 5 2
 
supposed to be the distances on a flattened board to the possible destinations in one direction.
 
ah I see
 
See you next week for 2019-5!
 
ok!
 
oh man i just missed it i assume
 
3:53 PM
Yes, but did you find something nice?
 
no not really
 
Adam had a nice one. Mine is not
 
Btw, if I have a bunch of .aplf files in a folder, how should I go about adding tests for them? Just add another Test.aplf function?
 
4:11 PM
also idk if yall follow the pldi proposal here but it has reached 200 committers recently, and is going to enter private beta phase soon
 
@rabbitgrowth Sure, or even a namespace with multiple tests.
 
Gotcha. And is there a way to make an .aplf function "private"? For example, I might have a helper function that does not need to be imported for the end user.
 
They still need it present to run, no?
 
You can expose an API namespace with function references to the functions you want to expose.
 
4:24 PM
Is there somewhere I can read up on that? or an example project that uses this structure?
 
Tatin does, but I can also help you set it up, just not right now. Can you try to catch me next week?
 
That would be fabulous, thank you so much. Maybe before or after next week's Quest?
 
Before, if so. But during the week is fine too.
(Though I'll be at APL Germany's event)
 
4:44 PM
There's no hurry, it's just for a tiny hobby project about the steno strokes I mentioned earlier
I'll try to catch you when I have the details ironed out. Thanks again!
 
 
3 hours later…
7:39 PM
Regarding Problem 8 (https://contest.dyalog.com/?goto=P18) in Phase 1 of the APL Problem Solving Competition... We have updated the problem page with a more correct description, plus an explanatory note. We've also amended the "Updates" section on the home page.

You do not need to amend a previous solution that was considered correct under the original description - we will still count it as being correct.

Finally, thank you to the APL Orchard participants who brought this to our attention!
 

« first day (2277 days earlier)      last day (370 days later) »