I have a function which takes multiple inputs. The prototype is as follows:
func = function(x,y,z)
I have to maximise the function with respect to z. x and y are needed to run the function. Can I use optim or optimise for this? If yes, how?
Edit 1: Here is an example.
func = function(x,y,z)
{
L=x^2*z+y*z;
return (L);
}
Now, I want to find the maximum value of func(3,2,z) where z \in [-1,1]. Can I use optim/optimise here?