FindMinimum in specified range if gradient cannot be found symbolically
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg387] FindMinimum in specified range if gradient cannot be found symbolically
- From: Simon Chandler <simonc at hpcpbla.bri.hp.com>
- Date: Wed, 4 Jan 1995 11:23:12 GMT
4/1/95
Dear MathGroupers,
Here's an answer from Wolfram Research's technical support
(specifically Alan DeGuzman) to my question:
"How can one find the minimum of a function in a specified range when
the gradient cannot be found symbolically?".
I expected FindMinimum in the form
FindMinimum[ foo[x], {x, xstart, xmin, xmax} ]
to work (where each argument is a single number) since it gives the
range to search AND contains a starting point - but it didn't.
The problem was one of syntax. Instead of passing a single value to
xstart, you must pass a list of two starting values. This will allow
you to use an minimum and maximum search range.
--------------------------------------------
In[1]:= xstart = {2,3};
In[2]:= xmin = 1;
In[3]:= xmax = 6;
In[4]:= FindMinimum[-Abs[Sin[x/2]], {x,xstart,xmin,xmax} ]
Out[4]= {-1., {x -> 3.14159}}
--------------------------------------------
This use of FindMinimum is not clearly documented so I thought I'd
share it with you all. Alan tells me that a more thorough example of
FindMinimum[] should be included in the next version of the
Mathematica book.
Happy New Year
Simon
-----=----==---=-=--====-=---===--=--=-==-===-==--==-=-=-======--=-==--=
Dr Simon Chandler
Hewlett-Packard Ltd Tel: 0272 228109
Computer Peripherals Bristol Fax: 0272 236091
Filton Road, Stoke Gifford
Bristol, BS12 6QZ email: simonc at bri.hp.com
United Kingdom
---==----=-=---====--=---=-==--===-=-=--=====-=----===---=--=--==-==-=-=