This is the code that failed:
g[x_] := x + a
Manipulate[Plot[g[x], {x, -10, 10}], {a, -10, 10}]
and this is the one that worked:
g[x_, a_] := x + a
Manipulate[Plot[g[x, a], {x, -10, 10}], {a, -10, 10}]
I'm planning on using codes like this to manipulate fit parameters to find good initial guesses for LinearModelFit or NoneLinearModelFit and it seems very excessive to me to have to define all of them as variables every time. Some functions have a lot of them...
LocalizeVariablesoption – Lukas Lang Sep 04 '22 at 21:02Manipulatemust be made aware of the explicit dependence ofgon the parameters you are trying to manipulate. In other words, those parameters must appear explicitly in the expression to be manipulated. – MarcoB Sep 04 '22 at 21:03