!wypKDDiZJdzZRWebIG:matrix.org

J

774 Members
9 Servers

Load older messages


SenderMessageTime
15 Mar 2025
@crumbtoo:matrix.org@crumbtoo:matrix.org left the room.04:24:57
@ngn:matrix.orgngn removed their profile picture.16:57:20
16 Mar 2025
@_discord_1344350362790006854:t2bot.iocoats_revolve_43096 joined the room.17:03:35
17 Mar 2025
@_discord_543169197828603914:t2bot.iodklyons81 Hi. I have a problem. I have a schedulable entity (an observation) which has a certain earliest start time, latest stop time, and duration. it can start anytime between start and end, but will only ever last exactly the length of the duration. I want to think about the probability of the observation being under way during any particular hour. An array of 24 bins, one for each hour, I call "time bins" and is the solution I'm seeking. I believe this forms a probability density function. I have previously analyzed this as forming a kind of trapezoid, the important points being 0, start, start + duration, end - duration, end, and 24. You can make a piecewise function for this trapezoid (although it's grosser when you handle wrapping over midnight). My previous solution worked by treating each bin as an integration over a little bit of this piecewise function, which winds up using the trapezoid rule since the function pieces are so simple.

I'm trying to figure out how to approach this in J. My gut feeling is that following the above implementation strategy will be difficult and it may be easier to say "the resolution of my answer is seconds", and then implement the piecewise function using @. and I., execute it for every second in a day, and then use _3600\ to sum up each hour bin. I'm not sure I'd lose anything from this but I thought I'd ask if there is an easier way to do it the other way, or if there is a better approach than the one I'm describing here, or if there are performance considerations with any of these approaches.
22:36:39
@_discord_870115701279584326:t2bot.iodiscodoug This sounds very familiar.. https://discord.com/channels/821509511977762827/821511195629715466/1217197619617726606 23:19:33
18 Mar 2025
@_discord_543169197828603914:t2bot.iodklyons81 yes, I did ask about this last year 14:45:38
@_discord_543169197828603914:t2bot.iodklyons81 thanks! I wasn't sure where to find the previous discussion, but I am again thinking about how to solve problems in J 14:45:58
@_discord_543169197828603914:t2bot.iodklyons81 one thing raulmiller said before which I'm curious about now is, suppose I want to calculate start+duration and end-duration. I'm curious if it would be possible to make a verb or adverb or something v so that we have something like start (duration ??? v) end. Something where start and end could each be arrays and the duration is passed in separately 14:52:14
@_discord_543169197828603914:t2bot.iodklyons81 also twobular turned out to be right, they don't care about the resolution below a second (even below a minute is pretty debatable) 15:58:09
@_discord_201716976924622849:t2bot.iotwobular if you want to pass in duration as a separate argument to start and end, then you could make an adverb which you'd use like start (duration adverb) end. however, unless the duration never really changes, i recommend writing a verb that takes as argument a list of the things you need, such as the monadic verb start,end,duration or maybe the dyadic duration verb start,end 16:10:42
@_discord_543169197828603914:t2bot.iodklyons81 I'm still learning the basics of J, how would you write that as an adverb? 16:11:45
@_discord_543169197828603914:t2bot.iodklyons81 I am realizing I'm a little too impatient with trying to learn J, and while I wasn't quite mature enough to understand the help before, I'm probably even further from it now, but I need to become comfortable with this taking a long time 16:12:28
@_discord_201716976924622849:t2bot.iotwobular probably something like
myadverb =: {{
   duration =. m
   start =. x
   end =. y
   your calculation here
}}
16:13:35
@_discord_543169197828603914:t2bot.iodklyons81 I think taking three arguments as an array makes sense, I would probably use 'start duration end' =. y and then proceed to write the arithmetic. not sure what the right way to do that tacitly would be 16:13:50
@_discord_201716976924622849:t2bot.iotwobular don't worry about tacit to start off with 16:14:07
@_discord_543169197828603914:t2bot.iodklyons81 OK 16:14:14
@_discord_201716976924622849:t2bot.iotwobular just get code that works and eventually you can translate it partially or wholly to tacit. but it will make reading and writing tougher until you have enough practice 16:16:34
@_discord_543169197828603914:t2bot.iodklyons81 Is this {{ syntax new? I thought you had to define things like := verb define ... )? This seems much nicer 16:16:38
@_discord_201716976924622849:t2bot.iotwobular yeah it's new. the old thing still works 16:17:09
@_discord_201716976924622849:t2bot.iotwobular the old version would be
myadverb =: adverb define
...
)
which is a more readable synonym for
myadverb =: 1 : 0
...
)
16:19:03
@_discord_543169197828603914:t2bot.iodklyons81 I found the dangling close parens pretty unaesthetic 16:19:20
@_discord_543169197828603914:t2bot.iodklyons81 per my query above, does using @. with I. seem like the right way to handle a piecewise function? 16:20:24
@_discord_116306741058207744:t2bot.iovendethiel j verb definitions look awful 16:21:30
@_discord_543169197828603914:t2bot.iodklyons81 I don't see what's wrong with verb =. {{ ... }} 16:22:30
@_discord_201716976924622849:t2bot.iotwobular you could use those tools but since you are writing explicit you can also use control words like if. a do. b else. c end. 16:23:07
@_discord_201716976924622849:t2bot.iotwobular to use @. effectively you'll want a bit of tacit 16:25:00
@_discord_870115701279584326:t2bot.iodiscodoug Who are “they”? 16:25:11
@_discord_543169197828603914:t2bot.iodklyons81 they are my users, who don't consider this tool to be doing anything so rigorous that it matters whether it is accurate much below a minute 16:25:42
@_discord_543169197828603914:t2bot.iodklyons81 which suggests to me that doing the work the way I was trying might be harder than another approach where I just evaluate a function for every minute or every second of the day and sum it up, which seems to me like it might be easier and maybe even perform better 16:26:46
@_discord_201716976924622849:t2bot.iotwobular there are less than 1e5 seconds in a day so worth a shot i guess. probably it would be more efficient to process the whole list of jobs once and get your statistics for the day instead of sifting through it thousands of times, but it's still not totally clear to me what precise variant of a histogram you're trying to implement so i'm just guessing 16:35:33

There are no newer messages yet.


Back to Room ListRoom Version: 6