I am a little bit confused regarding functions. For example, I want to visualize profit-advertisement budget change rates for a particular company. In case I am not given a function in an array form or the function itself (i.e. f(x) = x^3) that represents the profits related to the amount of the budget. How can I generate that function to help me represent/visualize that relationship and calculate the change rates? or what techniques are used to do so?

Thank you for helping me out. Once I have visualized the two variables in the chart. Which sub-libraries, within Numpy or SciPy, should I use to find the equation (how can I get the equation based on the plot, i.e. f(x)=x^2 + 3?

Hm. I’m not fully understanding your question.
To define that function f(x)=x^2 +3 you used a combination of NumPy and the Math library. Or, are you asking what math or NumPy function would you use?

Perhaps @tgrtim would be more able to assist here…

You mean determining the formula based on raw data rather than the inverse?

I suppose there’s a few ways to do that but fitting is quite a big topic, I’d suggest some background reading. For the basics tools like np.diff and np.polyfit would be able to get your a fair way along.