MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Help with NMaximize

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101235] Help with NMaximize
  • From: K Zhang <kezhao.zhang at gmail.com>
  • Date: Sat, 27 Jun 2009 06:05:30 -0400 (EDT)

I was trying to minimize a function with one variable. I used
NMaximize with various methods but none gave the correct answer.  I
can plot the objective function in In[3] and the maximum is located at
around x=8.6. It appears that the variable  x in  the objective
function is not evaluated in the function Count during the numerical
optimization.


In[1]:=SeedRandom[1]
In[2]:=z = RandomReal[{5, 20}, 10]
Out[2]:={17.2608, 6.67129, 16.8429, 7.81705, 8.62041, 5.98608,
13.1337, \
8.46732, 10.9401, 15.5071}
In[3]:=NMaximize[Count[z, _?(# < x &)]/x + Count[z, _?(# >= x &)]/Max
[z], x,
 Method -> "SimulatedAnnealing"]
Out[3]:={0., {x -> 2.71773}}

I would appreciate any help to find the maximum point.

Thanks.

K. Zhang


  • Prev by Date: Re: Ansatz?
  • Next by Date: Re: ListLinePlot Marker Location
  • Previous by thread: Removing unused nodes in GraphPlot
  • Next by thread: publicon