Re: Re: Global max for a nonlinear function
- To: mathgroup at smc.vnet.net
- Subject: [mg15212] Re: [mg15125] Re: Global max for a nonlinear function
- From: "Nicolas B.E. Sawyer" <nbes at eee.nott.ac.uk>
- Date: Tue, 22 Dec 1998 04:01:42 -0500
- Organization: University of Nottingham
- References: <74o11e$49e@smc.vnet.net> <199812160811.DAA24442@smc.vnet.net.> <367AD056.E37FFDCB@suu.edu>
- Sender: owner-wri-mathgroup at wolfram.com
I agree I should be using FindMinimum[] within my functions, but your missing the main point. Without using FindMinimum[] I can tell you that there are also maxima in Sin[x] at 9Pi/2, 13Pi/2, 17Pi/2 ... nicely spaced at intervals of 2Pi. However, where are ALL the maxima for Sin[x^2] between 0 and 2Pi? findMaxima[Sin[x^2], {x, 0, 2 Pi}] Out[40]= {{1.25331, 1.}, {2.8025, 1.}, {3.75994, 1.}, {4.51889, 1.}, {5.16755, 1.}, {5.74341, 1.}, {6.26657, 1.}} Suppose I throw in a Bessel function or two for good measure. What would be your initial estimates then? How would you know whether you'd missed a result here or there? I'm manipulating experimental data and want to find the maxima and minima, with their positions, in interpolations and equation fits to results. I could do this by plotting my results and reading off the points I'm interested in. My functions effectively automate this process. Finally, to Wolfram, it would be nice if FindMaximum[] existed. We aren't expected to do Cos[x-Pi/2] to get Sin[x] so why do we have to do FindMinimum[-f[x],...] and reverse the sign of the result to get a maximum? Des Penny wrote: > > Hi Nicolas: > The FindMinimum command already does what is needed, i.e. it can be used to > find the max of a given function. Thus, to find the max of Sin[x], just > find the min of -Sin[x]: > > In[1]:= > FindMinimum[-Sin[x],{x,0}] > Out[1]= > {-1.,{x\[Rule]1.5708}} > In[2]:= > FindMinimum[-Sin[x],{x,3 Pi}] > Out[2]= > {-1.,{x\[Rule]7.85398}} > > Cheers, > > Des Penny > Physical Science Dept > Southern Utah University > Cedar City, Utah 84720 > > Voice: (435) 586-7708 > FAX: (435) 865-8051 > Email: penny at suu.edu > > Nicolas B.E. Sawyer wrote: > > > mukul chawla wrote: > > > > > > I am trying to compute the global maxima for a nonlinear function > > > subject to a set of constraints, is there a way to do that using > > > mathematica ?? If so, how ?? > > > > > > Thanks, > > > Mukul > > > > I've written some code for finding the maxima and minima of a function > > by looking for zeros in the first differential. It extracts candidate > > points (using FullGraphics[]) from the data generated by Plot[] and > > returns a list of the maxima or minima found within a plotted range > > > > e.g. > > > > findMaxima[Sin[x], {x, 0, 4 Pi}] > > > > gives > > > > Out[1]= > > {{1.5708, 1.}, {7.85398, 1.}} > > > > I'd like to submit the code to MathSource but think it needs testing and > > possibly tidying up first. I don't consider myself to be an expert in > > Mathematica programming, so would like a hand with this. If you would > > like to help, please get in touch. > > > > -- > > Nicolas B.E. Sawyer > > > > Department of Electrical and Electronic Engineering, University of > > Nottingham, > > University Park, > > Nottingham, > > NG7 2RD. > > > > Tel: +44 115 9515151 ext 12028 > > Fax: +44 115 9515616 > > > > E-mail: nbes at eee.nottingham.ac.uk -- Nicolas B.E. Sawyer Department of Electrical and Electronic Engineering, University of Nottingham, University Park, Nottingham, NG7 2RD. Tel: +44 115 9515151 ext 12028 Fax: +44 115 9515616 E-mail: nbes at eee.nottingham.ac.uk
- References:
- Re: Global max for a nonlinear function
- From: "Nicolas B.E. Sawyer" <nbes@eee.nott.ac.uk>
- Re: Global max for a nonlinear function