9
I am reading a specific portion of the Bible per week based on programming published on the website Jw.org.
I made a javascript script that takes the paragraphs and verses of each chapter and shows the sum of the verses.
So I have this entry: (The passages are divided into paragraphs, and the number in parentheses is the number of verses)
1:1 (1)
1:2-6 (5)
1:7-10 (4)
1:11-12 (2)
1:13-17 (5)
2:1-10 (10)
2:11-16 (6)
2:17-18 (2)
3:1-7 (7)
3:8-9 (2)
3:10-13 (4)
3:14 (1)
3:15-17 (3)
4:1 (1)
4:2-5 (4)
4:6 (1)
4:7 (1)
4:8 (1)
4:9-10 (2)
4:11-18 (8)
4:19-22 (4)
5:1-3 (3)
5:4-10 (7)
5:11-14 (4)
As I will read in 7 days I need to not only distribute the 74 verses for 7 days, but find the best stop between paragraphs.
How to decide the best stop between paragraphs? We should take the average of verses a day. For example 14.6. So each day we will try to get as close to 14.6. If in one day the nearest is 13, in the next we will try to get as close to the 15.6. And so consecutively. However... doing this on paper you will realize that sometimes it is necessary to decide between reading less one day and more in another forward to have a more balanced average.
I’m currently doing this manually because I couldn’t devise an algorithm to do this.
But I’ll use python to process the input and I’m thinking about doing a brute force algorithm that will take all the possibilities of distributing the number of paragraphs in 7 sections, for example, (3, 2, 3, 5, 5, 2, 3 ) which is what I found in my hand.
After I had these numbers I could pass a function that would see what the best alternative was. But I don’t know what algorithm to use to do this. Maybe the algorithm of median? To average it is not because it will always give the same number.
I found this site: Purple Math that talks about "Mean, Median, Mode, and Range" (in English). I’m thinking about using all but the average to find the best value.
Does anyone have any tips?
In this case it doesn’t make much sense to use the average and the fashion (or this one crease, I don’t remember what it means), I suggest you stick to the same average, which is what seems most logical to me. If the average is 14.6, then you expect to have read 14.6 on day 1, 29.2 on day 2, 43.8 on day 3 and so on. It is these values that you need to approach.
– mgibsonbr
There is something wrong there... First, the sum of the verses was 75, not 74 (as in its final summary). Second, (3, 2, 3, 5, 5, 2, 3 ) has more groups than shown (23, when there are only 21 paragraphs).
– mgibsonbr
Yes mgibsonbr, my script has some bugs at the moment that are missing fix. Thanks for the remark
– Filipe Teixeira