You are getting the error "only length-1 arrays can be converted to Python scalars" is because when the function expects a single value instead of that you have passed an array.
Once you will look at the call signature of np.int, you'll see that it accepts a single value, not an array.
Normally, if you want to apply a function that accepts a single element to every element in an array, you can use np.vectorize see the code below:-
import numpy as np
import matplotlib.pyplot as plt
f2 = np.vectorize(f)
x = np.arange(1, 15.1, 0.1)
If you want to learn python, visit this python tutorial and python course