I have an equation which I try to plot and work with in Mathematica which is of the form
f(x,y) = (x^2 - a^2)^2 + x^2 y^2
Here x and y are independent variables and a is a constant. What is the standard way of defining a function such as this: should the constants/parameters be present in the list of arguments or should this list just contain the independent variables? Alternatively, should the parameters be present in the argument list but as optional arguments (with default values)?
All of those options are possible, and each is reasonable in some circumstance.
Present in the list of arguments:
Or:
Only the independent variables:
Globally defined
avalueAs optional argument
You’ll need to be more specific regarding your use if I am to provide a more specific answer. The globally defined
avalue should be used with caution, but it is certainly not without its place.