Re: MaxValue
- To: mathgroup at smc.vnet.net
- Subject: [mg99099] Re: MaxValue
- From: BG <galt32 at gmail.com>
- Date: Mon, 27 Apr 2009 01:15:09 -0400 (EDT)
- References: <gt0s37$edh$1@smc.vnet.net>
On Apr 26, 8:39 am, BG <gal... at gmail.com> wrote:
> Suppose I want to find supremum of {(-1)^n: n is natural}, MaxValue
> just returns the question itself.
> [..]
But something with NMinimize is not clicking for me:
In[70]:= f[n_] := (-1)^n + (n + 1)/n;
In[71]:= NMinimize[{f[n], Element[n, Integers] && n > 0}, n]
Out[71]= {0.333333, {n -> 3}}
In[72]:= f[999]
Out[72]= 1/999
I tried playing with NMinimzie parameters, namely Method and
MaxIterations(default is 100) and the various Precision's with no
success; going the MaxValue way:
In[81]:= MaxValue[Cos[Pi*n] + n + 1/n, n]
Out[81]= MaxValue[1/n + n + Cos[n \[Pi]], n]
I am new to Mathematica, what is the preferred way to get sup/inf of f
(N), (where f is the func above )?