Greatest Integer Function Problem

  • Context: High School 
  • Thread starter Thread starter Lobdell
  • Start date Start date
  • Tags Tags
    Function Integer
Click For Summary
SUMMARY

The discussion centers on creating a formula for calculating phone charges based on time spent talking, specifically addressing the Greatest Integer Function. The user seeks a solution that accurately rounds up the time to the nearest whole minute, regardless of whether the input time (x) is an integer or not. The proposed solution involves using the ceiling function in conjunction with the floor function, leading to the formula: total cost = a + b * ceil(x - 1), where 'a' is the cost for the first minute and 'b' is the cost for each additional minute.

PREREQUISITES
  • Understanding of the Greatest Integer Function and its properties
  • Familiarity with mathematical functions such as ceil and floor
  • Basic knowledge of algebraic expressions and equations
  • Experience with programming concepts for implementing the formula
NEXT STEPS
  • Research the implementation of the ceil function in programming languages like Python or JavaScript
  • Explore mathematical modeling for billing systems in telecommunications
  • Learn about the differences between rounding functions: ceil vs floor
  • Investigate case studies on pricing algorithms used by phone companies
USEFUL FOR

Mathematicians, software developers, and telecommunications analysts looking to implement or understand billing algorithms based on time usage.

Lobdell
Messages
4
Reaction score
0
I just need a push in the right direction for this one.
The problem is: A phone company charges this amount for the first minute and that amount for each additional minute. If someone talks for 3.1 minutes, they are charged for 4 minutes. Make a formula, blah blah blah...
Anyway I'm having trouble with making the equation work for both of these situations: when x is an integer, and when x is not an integer.
I already thought about int(x-.1) but then x could be .01, and it wouldn't be correct.

Any help is appreciated.
 
Mathematics news on Phys.org
You're trying to make a "round up" function. Since you're allowed to use the floor ("round down") function, consider this:

int(x)=-int(-x), x is an integer
int(x)=1-int(-x), otherwise
 
All you need is a + b ceil(x-1), where a is the cost for the first minute and b is the cost of each additional minute.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
1K
Replies
7
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
9
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 30 ·
2
Replies
30
Views
11K
Replies
22
Views
4K