Re: FindMaximum/NMaximize vs. Excel Solver
- To: mathgroup at smc.vnet.net
- Subject: [mg106748] Re: FindMaximum/NMaximize vs. Excel Solver
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Fri, 22 Jan 2010 05:40:38 -0500 (EST)
On 1/21/10 at 4:57 AM, jhurley13 at gmail.com (John) wrote:
>I am looking at a simple model that calculates the best wagers to
>place on a set of 20 horses, where the goal is to maximize reward
>vs. risk. Since the bets need to be constrained, I can't use
>NMaximize.
NMaximize allows constraints. For example consider the function
x + 5 Sin[x] which has no global maximum and an infinite number
of local maxima. To obtain a maximum for x between say 5 and 10
In[4]:= NMaximize[{x + 5 Sin[x], 5 < x < 10}, x]
Out[4]= {12.9543,{x->8.05534}}
Or for x between 20 and 25
In[5]:= NMaximize[{x + 5 Sin[x], 20 < x < 25}, x]
Out[5]= {25.5207,{x->20.6217}}
No constraints on x results in the following
In[7]:= NMaximize[x + 5 Sin[x], x]
Out[7]= {6.67113,{x->1.77215}}