The APL Orchard

apl.chat ― Learn, teach, ask, code, golf, & discuss usage. See ...
Apr 28, 2023 21:24
Ah, cool. I was wondering about envars in general. Why is return value output suppressed on `2⎕NQ '.' 'GetEnvironment' 'whatever'?
Apr 28, 2023 20:57
Is there a way to query the WS size from inside Dyalog?
Apr 27, 2023 20:17
Thanks, @Adám. Didn't know about ATO; nice to see some updates to the tio.run idea. Though the APL versions at TIO are honestly new enough for anything I've tried there so far, and it has no problems with i/o from a dfn. I mainly fired up tryapl.org because it groks the Dyalog key sequences, so I can build short snippets right in the browser instead of copying and pasting from RIDE.
Apr 27, 2023 18:31
How come you can't do ⎕← inside a dfn on tryapl.org? It says "NOT PERMITTED: Illegal token". Does it not present the browser as an I/O stream? I can't read from quad even outside an fn, though writing to it does work there.
Apr 23, 2023 19:50
It's biorhythms. They operate at the level of whole days. Any attempt to generalize to sub-day resolution will require providing time of birth (with time zone, or preconverted to UTC), and no matter how you approach it, you have a different and more complicated problem. Lacking such data, the only way you can be sure if two day counts are on the same day is if they are in fact the same number.
Apr 23, 2023 13:30
At least, that's what I got when I added the 379.5 to my list of moduli. The details of the rounding don't matter, just the fact that you still only count criticals on exact multiples of the co-period, even when that includes a fraction.
Apr 23, 2023 13:27
So there's no double critical on day 182 because 181.5 ≠ 182. But since both cycles meet at exactly 379.5, there is a double critical on day 380.
Apr 23, 2023 13:24
@AidenChow No, you still only count a double critical day when both cycles hit exactly the same number – even if that number is something .5 instead of a whole number. The rounding only kicks in when reporting the date of the crossover: if it's halfway between days, you count it as the later day.
Apr 22, 2023 16:01
I think it works, though. If you just use the numbers as given the result is that you are assumed to have downward critical days on the day after the between-day crossing in the odd cycles. So day 115 isn't a double because the intellectual critical on 115.5 rounds to 116, but day 380 is a double because both cycles cross at 379.5.
Apr 22, 2023 15:48
@AidenChow You're not crazy... at least this doesn't indicate so, if you are. :) I think the 379.5 is there because they tried to keep the calculation of the pairwise periods relatively straightforward, but introducing the fraction does rather muddle up the whole problem statement.
Apr 21, 2023 13:03
@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.
Apr 21, 2023 12:21
that leaves the definition of "critical day" unchanged from the general understanding while still having "double critical" defined to match the code/examples.
Apr 21, 2023 12:20
@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"
Apr 21, 2023 07:32
tomayto, tomahto
Apr 21, 2023 07:29
and wouldn't require any code changes.
Apr 21, 2023 07:29
A note like "to simplify the problem we only consider critical days to occur on upward crossings" would be plenty.
Apr 21, 2023 07:28
3:30!
Apr 21, 2023 07:27
I'm in the NY time zone myself, but got hit with a bit of insomnia tonight.
Apr 21, 2023 07:26
Thanks for passing it along!
Apr 21, 2023 07:23
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.
Apr 21, 2023 07:16
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.
Apr 21, 2023 07:14
which, again, is the usual definition as well
Apr 21, 2023 07:14
based on the definition of critical day at the top of the problem page
Apr 21, 2023 07:14
it's "when do two cycles both cross the x axis"
Apr 21, 2023 07:14
because the problem isn't "when do two cycles both go back to day 0"
Apr 21, 2023 07:13
all three values that include the 28-day cycle
Apr 21, 2023 07:13
because, as it says in the problem statement, a critical day happens when it crosses the x axis in either direction
Apr 21, 2023 07:13
but every 28-day cycle contains two critical days, not one
Apr 21, 2023 07:12
Yes, 644 days is a whole number of 23-day and 28-day cycles
Apr 21, 2023 07:08
yup.
Apr 21, 2023 07:07
Physical day 0: Critical Upward Transition
Emotional day 14: Critical Downward Transition
Mental day 24: Down and falling; next valley: 2023-11-20
Apr 21, 2023 07:07
I'm sure it's too late to change the problem. But it might be worth a note on the page.
Apr 21, 2023 07:06
Assuming a 28-day periodicity means critical days happen every 28 days.
Apr 21, 2023 07:06
It's a simple derivation error
Apr 21, 2023 07:06
I'm quite sure they did not intend some alternate-universe version of biorhythms.
Apr 21, 2023 07:05
oh, whups, wrong year. :)
Apr 21, 2023 07:05
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```
Apr 21, 2023 07:04
That's what I've been saying. :)
Apr 21, 2023 07:04
During which it crosses the x axis twice
Apr 21, 2023 07:04
Yes. The period is 28 days.
Apr 21, 2023 07:00
I haven't gotten my solution to a submittable form yet. I'm curious to see which way the tests go...
Apr 21, 2023 06:57
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.
Apr 21, 2023 06:55
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.
Apr 21, 2023 06:38
Your earlier statement is accurate - the 644, 924, and 21252 numbers should be halved
Apr 21, 2023 06:38
the issue is the opposite of what you're describing
Apr 21, 2023 06:38
No. They say that's what they're talking about, but the numbers they give miss half the crossings.
Apr 21, 2023 06:36
it says "in either direction" right there in the task description.
Apr 21, 2023 06:36
""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"
Apr 21, 2023 06:33
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.
Apr 21, 2023 06:05
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.