This should work, except that you're not providing any initial values for x. Is 
your problem one-dimensional or multi-dimensional?

 -- John

On Jul 8, 2014, at 11:44 AM, Mathieu Taschereau-Dumouchel <[email protected]> 
wrote:

> I am trying to optimize a simple function that takes a parameter as an 
> argument. Something like:
> 
> a=2
> f(x)=-(x-a)^2
> optimize(f)
> 
> Is there any way to do this? I have played quite a bit with optimize without 
> success.
> 
> Thanks a lot
> Mathieu

Reply via email to