My Math Forum  

Go Back   My Math Forum > Math Forums > Math

Math General Math Forum - For general math related discussion and news


Reply
 
LinkBack Thread Tools Display Modes
April 28th, 2018, 01:36 PM   #1
Member
 
Joined: Sep 2014
From: Sweden

Posts: 76
Thanks: 0

Question How to describe a programming array mathematically?

Hi! This post is mostly out of curiosity. I have a program that you give a text file with hours and minutes you have worked. Like this:

workedHours.txt
09.30-14.00
09.30-15.00
09.30-14.00
08.30-18.00

And the program automatically calculates the hours and minutes worked. It does that by putting the hours into one array and minutes into an array. So how do you describe these arrays mathematically?

Here is a picture to make it clearer:
http://www.mediafire.com/view/oue81l...428_232906.jpg

Last edited by greg1313; April 28th, 2018 at 04:00 PM.
DecoratorFawn82 is offline  
 
May 3rd, 2018, 03:33 AM   #2
Math Team
 
Joined: Jan 2015
From: Alabama

Posts: 3,163
Thanks: 867

Does "09.30-14.00" mean that a person worked form 9:30 am to 2:00 pm? That is 4 hours and 30 minutes. I "rounded" 9.30 up to 10.00 to get 14.00- 10.00= 4 hours.

Similarly "9.30- 15.00" is 15- 10= 5 hours and 30 minutes, "9.30-14.00" is again 14- 10= 4 hours and 30 minutes, and "8.30- 18.00" is 18- 9= 9 hours and 30 minutes. You array of hours will be "4, 5, 4, 9" and your array of minutes will be "30, 30, 30, 30".
Country Boy is offline  
May 3rd, 2018, 04:38 AM   #3
Global Moderator
 
Joined: Dec 2006

Posts: 18,961
Thanks: 1605

Quote:
Originally Posted by DecoratorFawn82 View Post
So how do you describe these arrays mathematically?
Your arrays are lists of integers. Use a letter to name each list and, if necessary, another letter to specify the length of the lists. Your lists should be equally long (because for each number of hours there is an associated number of minutes), so one letter will suffice to specify their length.

Your program may need to decide what to do if an odd number of times is found for some day. For example, this could be treated as an error in the data. This type of program typically calculates the totals in hours and minutes, so as to avoid the possibility of rounding errors.
skipjack is offline  
Reply

  My Math Forum > Math Forums > Math

Tags
array, describe, mathematically, programming



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Probability of one array containing all numbers of another array. LordLoki Probability and Statistics 2 May 12th, 2016 06:31 AM
Question regarding python programming, specifically Object Oriented Programming mitch08 Computer Science 2 November 28th, 2015 05:51 AM
How to phrase a debt equation mathematically philblakeman Economics 0 October 20th, 2015 04:02 AM
how to support this step mathematically turtlejohn Complex Analysis 0 January 20th, 2010 08:49 PM
mathematically related essay topic gaussrelatz New Users 1 December 31st, 1969 04:00 PM





Copyright © 2018 My Math Forum. All rights reserved.