How do you make a function composition that has a built in function like Maximize inside? For a simple example say with Minimize, let
f[x_]:=x^2
min[x_]:=Minimize[f[x]]
Something of this idea (obviously not syntax correct, I cant find a way to make it work), how would I go about doing this? Such that I can reference to the Minimized function later in the file and change it by changing the f(x) function.
I wonder if you mean something like this:
min[f_] := Minimize[f[x], x];
f[x_] := x^2;
g[x_] := x^4 - x^2;
min[f]
min[g]
Yes! Thats what I meant, thanks a lot; Now the follow up question is how can I swap the variables to minimize, for instance in your snippet if you do /.x->a it would change x to a everywhere, but what if I have a multivariable function to minimize and I want to add or take variables away (not just change them) so for instance:
min[f_] := Minimize[f[x,y,z], x,y,z];
what if id want to, for instance change x to a and not use the other 2, so Id want to get:
min[f_] := Minimize[f[a], a];
out of calling the previous function, because otherwise I have to redefine everything in the minimize function again since it will complain that it cant find the other variables.