This Python program evaluates the function f(x) = 5x³ - 3x + 4 for a range of integer and decimal values of x.
The results are displayed with two decimal places of precision.
def f(x: float) -> float:
return 5 * x**3 - 3 * x + 4
print("f(x) values for integer x from 1 to 10:")
for x in range(1, 11):
print(f"f({x}) = {f(x):.2f}")
print("\nf(x) values for decimal x from 1.5 to 5.5:")
for x in [1.5, 2.5, 3.5, 4.5, 5.5]:
print(f"f({x}) = {f(x):.2f}")
f(1) = 6.00
f(2) = 38.00
f(3) = 130.00
...
f(1.5) = 20.88
f(2.5) = 78.13
...