Counting occurrences of an intermittent event depending on start, end and frequency
$begingroup$
I am sorry if this is a trivial question (I am really bad at math ;-)), but I cannot manage to find a convincing mathematical solution for it.
So, let's suppose events that occur intermittently along the days:
Event A occurs every 2 days, starts on day 1
Event B occurs every 2 days, starts on day 2
Event C occurs every 3 days, starts on day 3
etc.
Visually presented:
days 1 2 3 4 5 6 7 8 ...
A * * * *
B * * * *
C * *
Now, I want to compute how many events of each observer will see, depending on the day they arrive and the day they leave.
Thus, I have the following variables:
event
frequency: 1/2, 1/3...
startingDay: 1, 2, 3...
observer
firstDay: 1, 2, 3...
lastDay: 6, 7, 8...
totalDays = lastDay - firstDay + 1
Is there a formula that could easily compute for each observer how many events of each type he will see? I tried combining rounding (flooring totalDays*frequency) + some modulo, but I cannot seem to find the hang of it.
algebra-precalculus
$endgroup$
add a comment |
$begingroup$
I am sorry if this is a trivial question (I am really bad at math ;-)), but I cannot manage to find a convincing mathematical solution for it.
So, let's suppose events that occur intermittently along the days:
Event A occurs every 2 days, starts on day 1
Event B occurs every 2 days, starts on day 2
Event C occurs every 3 days, starts on day 3
etc.
Visually presented:
days 1 2 3 4 5 6 7 8 ...
A * * * *
B * * * *
C * *
Now, I want to compute how many events of each observer will see, depending on the day they arrive and the day they leave.
Thus, I have the following variables:
event
frequency: 1/2, 1/3...
startingDay: 1, 2, 3...
observer
firstDay: 1, 2, 3...
lastDay: 6, 7, 8...
totalDays = lastDay - firstDay + 1
Is there a formula that could easily compute for each observer how many events of each type he will see? I tried combining rounding (flooring totalDays*frequency) + some modulo, but I cannot seem to find the hang of it.
algebra-precalculus
$endgroup$
add a comment |
$begingroup$
I am sorry if this is a trivial question (I am really bad at math ;-)), but I cannot manage to find a convincing mathematical solution for it.
So, let's suppose events that occur intermittently along the days:
Event A occurs every 2 days, starts on day 1
Event B occurs every 2 days, starts on day 2
Event C occurs every 3 days, starts on day 3
etc.
Visually presented:
days 1 2 3 4 5 6 7 8 ...
A * * * *
B * * * *
C * *
Now, I want to compute how many events of each observer will see, depending on the day they arrive and the day they leave.
Thus, I have the following variables:
event
frequency: 1/2, 1/3...
startingDay: 1, 2, 3...
observer
firstDay: 1, 2, 3...
lastDay: 6, 7, 8...
totalDays = lastDay - firstDay + 1
Is there a formula that could easily compute for each observer how many events of each type he will see? I tried combining rounding (flooring totalDays*frequency) + some modulo, but I cannot seem to find the hang of it.
algebra-precalculus
$endgroup$
I am sorry if this is a trivial question (I am really bad at math ;-)), but I cannot manage to find a convincing mathematical solution for it.
So, let's suppose events that occur intermittently along the days:
Event A occurs every 2 days, starts on day 1
Event B occurs every 2 days, starts on day 2
Event C occurs every 3 days, starts on day 3
etc.
Visually presented:
days 1 2 3 4 5 6 7 8 ...
A * * * *
B * * * *
C * *
Now, I want to compute how many events of each observer will see, depending on the day they arrive and the day they leave.
Thus, I have the following variables:
event
frequency: 1/2, 1/3...
startingDay: 1, 2, 3...
observer
firstDay: 1, 2, 3...
lastDay: 6, 7, 8...
totalDays = lastDay - firstDay + 1
Is there a formula that could easily compute for each observer how many events of each type he will see? I tried combining rounding (flooring totalDays*frequency) + some modulo, but I cannot seem to find the hang of it.
algebra-precalculus
algebra-precalculus
edited Dec 7 '18 at 15:44
Serge B.
asked Dec 7 '18 at 15:32
Serge B.Serge B.
1013
1013
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
After decomposing the problem and trying every possible combination for a few days, I think I found the solution. At least, it seems to work for every possible case I can think of. It might be possible to reduce it, but at least, it works.
numberOfEventsSeen = ceil( (totalDaysOfObservation - ( (eventFrequency - (
(dayOfArrival - 1 - eventStartingDay - 1) % eventFrequency) )
% eventFrequency) ) / eventFrequency )
where
ceil() = ROUNDUP in Excel for instance
totalDaysOfObservation = dayOfDeparture - dayOfArrival - 1
eventFrequency = 2 (if event happens every 2 days), 3, etc.
(Note: sorry if this is by no means a normal mathematical notation ;-))
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3030016%2fcounting-occurrences-of-an-intermittent-event-depending-on-start-end-and-freque%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
After decomposing the problem and trying every possible combination for a few days, I think I found the solution. At least, it seems to work for every possible case I can think of. It might be possible to reduce it, but at least, it works.
numberOfEventsSeen = ceil( (totalDaysOfObservation - ( (eventFrequency - (
(dayOfArrival - 1 - eventStartingDay - 1) % eventFrequency) )
% eventFrequency) ) / eventFrequency )
where
ceil() = ROUNDUP in Excel for instance
totalDaysOfObservation = dayOfDeparture - dayOfArrival - 1
eventFrequency = 2 (if event happens every 2 days), 3, etc.
(Note: sorry if this is by no means a normal mathematical notation ;-))
$endgroup$
add a comment |
$begingroup$
After decomposing the problem and trying every possible combination for a few days, I think I found the solution. At least, it seems to work for every possible case I can think of. It might be possible to reduce it, but at least, it works.
numberOfEventsSeen = ceil( (totalDaysOfObservation - ( (eventFrequency - (
(dayOfArrival - 1 - eventStartingDay - 1) % eventFrequency) )
% eventFrequency) ) / eventFrequency )
where
ceil() = ROUNDUP in Excel for instance
totalDaysOfObservation = dayOfDeparture - dayOfArrival - 1
eventFrequency = 2 (if event happens every 2 days), 3, etc.
(Note: sorry if this is by no means a normal mathematical notation ;-))
$endgroup$
add a comment |
$begingroup$
After decomposing the problem and trying every possible combination for a few days, I think I found the solution. At least, it seems to work for every possible case I can think of. It might be possible to reduce it, but at least, it works.
numberOfEventsSeen = ceil( (totalDaysOfObservation - ( (eventFrequency - (
(dayOfArrival - 1 - eventStartingDay - 1) % eventFrequency) )
% eventFrequency) ) / eventFrequency )
where
ceil() = ROUNDUP in Excel for instance
totalDaysOfObservation = dayOfDeparture - dayOfArrival - 1
eventFrequency = 2 (if event happens every 2 days), 3, etc.
(Note: sorry if this is by no means a normal mathematical notation ;-))
$endgroup$
After decomposing the problem and trying every possible combination for a few days, I think I found the solution. At least, it seems to work for every possible case I can think of. It might be possible to reduce it, but at least, it works.
numberOfEventsSeen = ceil( (totalDaysOfObservation - ( (eventFrequency - (
(dayOfArrival - 1 - eventStartingDay - 1) % eventFrequency) )
% eventFrequency) ) / eventFrequency )
where
ceil() = ROUNDUP in Excel for instance
totalDaysOfObservation = dayOfDeparture - dayOfArrival - 1
eventFrequency = 2 (if event happens every 2 days), 3, etc.
(Note: sorry if this is by no means a normal mathematical notation ;-))
answered Dec 12 '18 at 10:07
Serge B.Serge B.
1013
1013
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3030016%2fcounting-occurrences-of-an-intermittent-event-depending-on-start-end-and-freque%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown