Re: How to solve the given problem?
On Fri, 4 Mar 2022 10:02:30 -0800 (PST), NArshad declaimed the following: >You have made everything too complicated. Just adjust the units left in the >second feed into the third and fourth feed because the fish is special and >that's it. The next day the second feed will be 100 units the way it used to >be. > My solution is generalized for 1) any number of periods in the day, 2) mis-feed discovered at any point during the day, 3) works with any shape of feeding schedule. >What's wrong with the solution which I have written? Nothing IF you can justify that it meets the documented requirements. >From your original post: """ Implement some methods to distribute the remaining 40 unit in the rest of the day and propose the new patterns. Try to keep the distribution similar to the current feeding pattern. """ Rephrased some, with emphasis, into what I see as the two major requirements to be met: * distribute the remaining 40 unit IN THE REST OF THE DAY * TRY TO KEEP THE DISTRIBUTION SIMILAR TO THE CURRENT FEEDING PATTERN "Remaining 40 unit" is really a noise clause resulting only from the /example/ input schedule and feedings. Any programmatic solution should not know, ahead of time, what the schedule was, nor what the feedings actually were. There is no sense to writing a program in which all the input data is hard-coded -- you might as well hard-code the output too, while you are at it. I consider "..some methods" to also be noise clause -- the alternative interpretation is that you are supposed to create multiple programs doing different types of solutions to the one problem. Assume, for example, that a fish#2 has a feeding schedule that looks like: 150 100 20 20 20 20 20 20 100 150 (A big feed at start of day, an almost as large in second hour, six hours at a constant 20, and then a large feed near the end, followed by a really big feed to keep it happy overnight -- it seems to make more sense than slowly starving the fish during the afternoon ). That planned distribution could be called a bathtub curve -- high start and ends with a flat middle. (as a sideways histogram) *** ** ** ** ** ** ** ** ** *** Again, assume error in first two feeds as: 150 60 HOW DOES DUMPING THE 40 UNITS INTO HOUR 3 AND 4 SATISFY EITHER OF THE REQUIREMENTS? (... rest of day, and similar distribution). -=-=-=- C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>rexx feedme.rex Enter planned feeding schedule (feed units for each time period, space separated) 150 100 20 20 20 20 20 20 100 150 Enter actual feeding schedule up to current feed period 150 60 PLAN: 10 time periods 620 total feed units ACTUAL :2 time periods 210 total feed units dispensed MIS-FEED: 40 underfed SCHEDULE: 150 60 |> 23 22 22 22 22 22 111166 C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX> -=-=-=- (I modified the script to put |> at the point where the modified feedings begin) The result, as a histogram *** ** **- **. **. **. **. **. ***. + (Not very visible as each * is 10 units, and using . for 2.5, - for 5, + for 7.5) -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
On Thu, 17 Feb 2022 02:20:53 -0800 (PST), NArshad declaimed the following: >I have completed the homework or what so ever it used to be its only I am >telling the solution which looks to me as better as compared to what others >have given like the one that Christian has given. At the risk of irritating the other regulars... If you've completed it, why not show us your Python code so we may review it? I presume you did do it in Python. I'm not going to show my code -- mainly as I just spent today writing a solution in REXX. But I will show the results of running said code. My solution is GENERAL in that it handles 1 variable number of periods in the plan 2 variable number of periods in the actual (partial day) 3 the case where the mis-feed is not the last item in actual 4 the case where the actual matches the plan (no mis-feed) 5 the case where the mis-feed is a shortage (underfed) 6 the case where the mis-feed is an overage (overfed) 7 the case where multiple mis-feeds cancel out (not shown below) -=-=- Your example schedule and feed amounts C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>rexx feedme.rex Enter planned feeding schedule (feed units for each time period, space separated) 150 100 30 30 30 20 20 10 5 5 Enter actual feeding schedule up to current feed period 150 60 PLAN: 10 time periods 400 total feed units ACTUAL : 2 time periods 210 total feed units dispensed MIS-FEED: 40 underfed SCHEDULE: 150 60 39 38 38 25 25 13 6 6 -=-=- Same, but the mis-feed was not discovered until after the 3rd period C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>rexx feedme.rex Enter planned feeding schedule (feed units for each time period, space separated) 150 100 30 30 30 20 20 10 5 5 Enter actual feeding schedule up to current feed period 150 60 30 PLAN: 10 time periods 400 total feed units ACTUAL : 3 time periods 240 total feed units dispensed MIS-FEED: 40 underfed SCHEDULE: 150 60 30 40 40 27 27 13 7 6 -=-=- An example were the mis-feed was in the other direction C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>rexx feedme.rex Enter planned feeding schedule (feed units for each time period, space separated) 150 100 30 30 30 20 20 10 5 5 Enter actual feeding schedule up to current feed period 150 120 PLAN: 10 time periods 400 total feed units ACTUAL : 2 time periods 270 total feed units dispensed MIS-FEED: 20 overfed SCHEDULE: 150 120 27 26 26 17 17 9 4 4 -=-=- Finally, an example where there was no mis-feed C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX>rexx feedme.rex Enter planned feeding schedule (feed units for each time period, space separated) 150 100 30 30 30 20 20 10 5 5 Enter actual feeding schedule up to current feed period 150 100 PLAN: 10 time periods 400 total feed units ACTUAL : 2 time periods 250 total feed units dispensed MIS-FEED: 0 on schedule C:\Users\Wulfraed\Documents\_Hg-Repositories\REXX> -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
On Sat, 26 Feb 2022 02:49:15 -0800 (PST), NArshad declaimed the following: >Its better to adjust the feed in the coming next two feeds that is the third >and fourth one. Thirty or thirty one units in the third feed and the remaining >units which are nine or ten in the fourth feed. Is there a question in that? It's your assignment -- you will have to justify your design to whoever gave you that assignment. So far all you have is a statement with no justification. And you really do need to justify the part where you seem to ignore "distribute the remaining 40 unit in the rest of the day" and "Try to keep the distribution similar to the current feeding pattern." If you really wanted to provide a /generalized/ solution then "40 units" will never appear IN THE CODE. A generalized solution would accept two lines of input: the original/planned schedule (for the whole day) and, the implemented schedule up to when the mistake was detected. It would then generate a new schedule for the rest of the day taking into account what had already been done. (PLANNED and ACTUAL are input, ADJUSTED is output) PLANNED:15010030303020201055 ACTUAL: 15060 ADJUSTED: Note that a generalized solution would handle PLANNED:15010030303020201055 ACTUAL: 15060 30 ADJUSTED: where the mistake was on the second feed, but not discovered until after the third feed. -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
On Thu, 17 Feb 2022 02:20:53 -0800 (PST), NArshad declaimed the following: >I have completed the homework or what so ever it used to be its only I am >telling the solution which looks to me as better as compared to what others >have given like the one that Christian has given. This statement should probably have been how you introduced the prior post instead of presenting something that read like a request for someone to implement something based on your new description. Your immediately prior post: >The feed remaining of the second hour will be distributed and adjusted in the >next third and fourth hour not the next day because the fish must be hungry. >This can be done by both taking the average or the percentage left. What I >think is taking the average and then distributing in the third and fourth feed >is better. If the feed is given in the next day there is a chance that the >fish will not survive because the fish is special. "If the feed is given in the next day..." is a non-issue, as the original problem description (shown here)... >Assume that there is a pattern of feeding for a special fish in a day (10 >hours a day) as below: > 150 100 30 30 30 20 20 10 > 5 5 >Today, the fish is fed in the second hour 60 unit instead of 100 unit >Accidently. Implement some methods to distribute the remaining 40 unit in the >rest of the day and propose the new patterns. Try to keep the distribution >similar to the current feeding pattern. >Note: pay attention that the total feeding amounts should be fix in a day. ... explicitly states that the total amount must be provided within a single day. Since you didn't provide your implementation (or even just the resultant feeding pattern), I can not determine exactly what you are doing with regards to your "average" -- however, it seems to me that your "average" distribution "in the third and fourth feed" fails both the "rest of the day" and "try to keep the distribution similar..." requirements. It is a given that you have to account for the 40 units that were not provided in the second hour. It sounds very much like you are dumping them at 20&20 on the 3rd&4th hours, so your pattern (with the "error" feed now looks like 150 60 50 50 30 20 20 10 5 5 A proportional solution would result in the full pattern looking (ignoring round-off errors) 150 60 38 38 38 25 25 13 6 6 (round-off means you have to account for 1 more unit -- I'd probably put it on the first 38 hour, but that's only because I hand worked the proportions on a calculator. A "proper" algorithm should probably be tracking the error amounts [difference between integer units and real proportion] to apply the round-off at the nearest correct location). Taking error term into account units calcerror 150 60 38 8.0 0.0 38 8.0 0.0 38 8.0 0.0 25 5.333 .333v 25 5.333 .666v 13 2.666 1.333^ .333 6 1.333 .666v 7 1.333 .999^ (I'm only showing 3 decimal places) Of course, one could compute the data in the other direction and get 6 1.333 .333v 6 1.333 .666v 13 2.666 1.333^ .333 25 5.333 .666v 26 5.333 .999^ (again, 3 decimal places) 0.0 38 8.0 0.0 38 8.0 0.0 38 8.0 0.0 60 150 (v = round down, ^ round up -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
On Tue, 15 Feb 2022 23:53:15 -0800 (PST), NArshad declaimed the following: > >The feed remaining of the second hour will be distributed and adjusted in the >next third and fourth hour not the next day because the fish must be hungry. >This can be done by both taking the average or the percentage left. What I >think is taking the average and then distributing in the third and fourth feed >is better. If the feed is given in the next day there is a chance that the >fish will not survive because the fish is special. You are now defining new requirements that were not in your original description of the assignment (the original description had no mention of "next day" -- only to redistribute the excess over the remainder of the feeding schedule). It is your assignment -- code a solution based upon your understanding of the problem, and submit it for grading (unless proven otherwise, these have the appearance of homework assignments and, to reiterate, we do not provide solutions to homework). OR ask the person who gave you the assignment if your understanding is correct. -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
Anyone think someone keeps asking homework questions? This seems absolutely unrelated to earlier discussions from this person. Jobs often tend to remain focused. I opt out after frustration with earlier exchanges with NArshad about library books and EXCEL ... -Original Message- From: NArshad To: python-list@python.org Sent: Thu, Feb 10, 2022 1:40 am Subject: How to solve the given problem? Assume that there is a pattern of feeding for a special fish in a day (10 hours a day) as below: 150 100 30 30 30 20 20 10 5 5 Today, the fish is fed in the second hour 60 unit instead of 100 unit Accidently. Implement some methods to distribute the remaining 40 unit in the rest of the day and propose the new patterns. Try to keep the distribution similar to the current feeding pattern. Note: pay attention that the total feeding amounts should be fix in a day. -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
Narshad, I propose you post your questions to StackOverflow. I'm sure they will be very happy. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
On Wed, 9 Feb 2022 22:40:48 -0800 (PST), NArshad declaimed the following: > >Assume that there is a pattern of feeding for a special fish in a day (10 >hours a day) as below: > 150100303030202010 > 55 >Today, the fish is fed in the second hour 60 unit instead of 100 unit >Accidently. Implement some methods to distribute the remaining 40 unit in the >rest of the day and propose the new patterns. Try to keep the distribution >similar to the current feeding pattern. >Note: pay attention that the total feeding amounts should be fix in a day. This is very obviously phrased as a homework problem. WE DO NOT DO HOMEWORK! Write some Python code, present the code, your input data, and the output it produced along with an example of the output you expected, and we may be able to point out what parts of Python you made a mistake with. If we get ambitious we might even correct an algorithm, not just explain errors in the usage of Python. I'm going a tad too far but... HINT: You need to compute the percentage of remaining scheduled units each takes, then apply those percentages to the left-over from the mis-feed. NONE of this has anything to do with Python itself -- it is purely algorithm development that applies with any programming language -- or even none. -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
Am 10.02.22 um 11:26 schrieb NArshad: -ChrisA: You don't reply if you have problems. When I don't find any solution elsewhere then only I place in this group -Christian: One problem of different type requires the same elaboration. No it doesn't Q. What technique of statistics or numerical computation or general mathematics to use to solve this problem. Can you tell one example Find the values of 푥subscript(푖) for i from 1 to n (n =100). WTF? Go study maths yourself instead of asking here (Offf-topic as well) Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
On Fri, 11 Feb 2022 at 02:15, NArshad wrote: > > -ChrisA: > You don't reply if you have problems. > When I don't find any solution elsewhere then only I place in this group > You're a help vampire. Stop it. https://slash7.com/2006/12/22/vampires/ Go do some actual research instead of asking people to do your homework. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
-ChrisA: You don't reply if you have problems. When I don't find any solution elsewhere then only I place in this group -Christian: One problem of different type requires the same elaboration. Q. What technique of statistics or numerical computation or general mathematics to use to solve this problem. Can you tell one example. Find the values of 푥subscript(푖) for i from 1 to n (n =100). 푥subscript(1) + 푥subscript(2) = 3, 푥subscript(푖+1) − 푥subscript(푖+2) = 1, 푓표푟 푖 = 1, … , 푛 − 2 푥subscript(n-1) + 푥subscript(n) = 3 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
On Thu, 10 Feb 2022 at 18:41, NArshad wrote: > > > Assume that there is a pattern of feeding for a special fish in a day (10 > hours a day) as below: >150100303030202010 >55 > Today, the fish is fed in the second hour 60 unit instead of 100 unit > Accidently. Implement some methods to distribute the remaining 40 unit in the > rest of the day and propose the new patterns. Try to keep the distribution > similar to the current feeding pattern. > Note: pay attention that the total feeding amounts should be fix in a day. Once again, you're bringing your homework to a mailing list and expecting us to do it for you. Start by putting in some actual work yourself, and stop trying to cheat your way to a good grade. Please, can people not assist this person until there's some demonstration of actual work being done? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: How to solve the given problem?
Am 10.02.22 um 07:40 schrieb NArshad: Assume that there is a pattern of feeding for a special fish in a day (10 hours a day) as below: 150100303030202010 55 Today, the fish is fed in the second hour 60 unit instead of 100 unit Accidently. Implement some methods to distribute the remaining 40 unit in the rest of the day and propose the new patterns. Try to keep the distribution similar to the current feeding pattern. Note: pay attention that the total feeding amounts should be fix in a day. This is not a Python problem, it's a math problem and most probably a homework problem. Actually the question already tells you how to solve it. There are 40 units of fish-food left and you should distribute them proportionally to the rest of the day. Sum up the numbers from 3rd to last, add 40, and then distribute this to proportionally to each day. You'll end up with fractinoal numbers in the general case, so you'll have to find a method to fairly distribute the units, if you wan to stick with integers. You can also check out the various algorithms for distributing seats in a parliament, it is almost the same problem. Christian -- https://mail.python.org/mailman/listinfo/python-list
How to solve the given problem?
Assume that there is a pattern of feeding for a special fish in a day (10 hours a day) as below: 150100303030202010 55 Today, the fish is fed in the second hour 60 unit instead of 100 unit Accidently. Implement some methods to distribute the remaining 40 unit in the rest of the day and propose the new patterns. Try to keep the distribution similar to the current feeding pattern. Note: pay attention that the total feeding amounts should be fix in a day. -- https://mail.python.org/mailman/listinfo/python-list