Sometimes it happens that I want to define a function
f(x,y) that have two arguments (
x ,y in this case ) to use it further in gradient computation or some similar application that requires a clear explicit definition of the function arguments (independent variables). However, this function
f may also need some other inputs that are not arguments, they are needed just to complete some calculations inside the function
f. My question is: how to pass these inputs without affecting the function call? I used to do it in a naïve inefficient way by simply make the other inputs global, so I can use them from inside, but I know that this is not the best thing to do.