(Note that the mathematics in this question is hypothetical and illustrative.)
Suppose that I am writing a function "foo" to minimize any given objective function "fun", and "fun" is passed to "foo" by a function handle. Assume that, in "foo", some how, I decide that exp(fun(x)) is easier to minimize, so I do something like this:
y = function foo(fun, ...) fun = @(x) exp(fun(x)); y = minimize(fun, ...);end
where "minimize" is a hypothetical function that performs minimization, and "…" represents some other inputs. Assume that function "minimize" does not call function "foo" in any way.
Note that the definition fun = @(x) exp(fun(x)) seems recursive. I know that I can use a name other than "fun" for @(x) exp(fun(x)). However, suppose that I do need to use the same name, would this cause any problem?
Thank you very much!
Best Answer