Greatest Integer Function Problem

So, in summary, the formula for calculating the cost for talking x minutes on a phone call, where a is the cost for the first minute and b is the cost of each additional minute, is: a + b ceil(x-1). This formula works for both integer and non-integer values of x.
  • #1
Lobdell
4
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
  • #2
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
 
  • #3
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.
 

Related to Greatest Integer Function Problem

1. What is the greatest integer function?

The greatest integer function, also known as the floor function, takes a real number as input and returns the greatest integer less than or equal to that number. It is denoted by the symbol ⌊x⌋.

2. How is the greatest integer function different from the ceiling function?

The greatest integer function rounds down to the nearest integer, while the ceiling function rounds up to the nearest integer. For example, ⌊3.5⌋ = 3 and ⌈3.5⌉ = 4.

3. What is the purpose of the greatest integer function?

The greatest integer function is commonly used in mathematics and computer science to define the floor of a number or to truncate decimals. It can also be used to solve problems involving inequalities and to calculate limits in calculus.

4. Can the greatest integer function be applied to negative numbers?

Yes, the greatest integer function can be applied to both positive and negative numbers. For example, ⌊-2.5⌋ = -3 and ⌊-1⌋ = -1.

5. Are there any special properties of the greatest integer function?

Yes, the greatest integer function has several properties that make it useful in mathematical proofs and applications. These include the fact that it is a piecewise constant function, that it is continuous from the right, and that it is not differentiable at integer values.

Similar threads

Replies
4
Views
819
  • Precalculus Mathematics Homework Help
Replies
4
Views
4K
Replies
9
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
948
  • Precalculus Mathematics Homework Help
Replies
3
Views
2K
Replies
1
Views
3K
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top