Answers:
- f(1.9) = 5
- f(2.9) = 8
- f(-2.1) = -7
==============================================================
Step-by-step explanation:
The int function is the nearest integer function, and it's also called the floor function. It rounds things down to the nearest integer. The term 'down' is important.
So for example,
- A number like 1.9 rounds down to 1. It doesn't matter how much closer 1.9 is to 2, we always round down. The number could be 1.9999999 and we still round down to 1.
- The number 2.9 rounds down to 2. The same idea applies. For positive numbers, we can just drop the decimal portion and we have our answer.
- The number -2.1 rounds down to -3. This is a bit strange and it helps to draw a vertical number line as I've done below (see the attached image). Think of each integer as floors of a building. The positive integers are floors above the ground, while negative integers are basement levels. If we're at -2.1 on this vertical number line, then moving down will have us arrive at -3 as the next integer floor.
- As another example with a negative value, we can say int(-7.2) = -8; use the vertical number line diagram if needed.
The reason why it's called the floor function is because we round down to the nearest floor.
In contrast, the ceiling function will have us always rounding up. Using the ceiling function on a number like 2.00007 will round up to 3 even though it's much closer to 2.
I recommend you practice a bit with this floor function to get a better grasp on it if you're still stuck. Feel free to ask any questions about it.
--------------------------------
With those examples out of the way, we can now determine the output of the function int(3x)
It's a similar idea, but we'll be multiplying each input x value by 3 first, then applying the int function.
If x = 1.9, then 3x = 3*1.9 = 5.7
Then note how int(3x) = int(5.7) = 5
Therefore, f(1.9) = 5
This is how the steps could look like
f(x) = int(3x)
f(1.9) = int(3*1.9)
f(1.9) = int(5.7)
f(1.9) = 5
--------------------------------
Repeat those steps but now using x = 2.9
f(x) = int(3x)
f(2.9) = int(3*2.9)
f(2.9) = int(8.7)
f(2.9) = 8
-------------------------------
And finally, we need to plug in x = -2.1
f(x) = int(3x)
f(-2.1) = int(3*(-2.1))
f(-2.1) = int(-6.3)
f(-2.1) = -7
Be careful not to round down to -6 as this is incorrect. Use the vertical number line if needed.