MathGroup Archive 2011

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

Search the Archive

Re: problem with LessEqual::nord:

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115884] Re: problem with LessEqual::nord:
  • From: Peter Pein <petsie at dordos.net>
  • Date: Mon, 24 Jan 2011 05:22:38 -0500 (EST)
  • References: <ihbjvn$dl3$1@smc.vnet.net> <ihe451$q9r$1@smc.vnet.net> <ihiaai$m2r$1@smc.vnet.net>

On 23.01.2011 23:32, Peter Pein wrote:
...

>
> Hi,
>
> the value of f depends only on the radii of d[i]:
nonsense
>
> In[23]:= fpolar =
>    Collect[f /. {re ->  (r[#] Cos[#]&), im ->  (r[#] Sin[#]&)},
>     r /@ Range[0, n],
>     FullSimplify[#,
>       cpolar =
>        And @@ Flatten[{Sum[r[k]^2, {k, 0, n}] == 1,
>           Table[0<= r[k]<= 1&&  -Pi<= t[k]<= Pi, {k, 0, n}]}]]&]
...

>
> In[24]:= Clear@target;
> target[rr : {__?NumericQ}] :=
>    fpolar /. Thread[(r /@ Range[0, n]) ->  rr]
>
> In[26]:= sol =
>    NMinimize[{target[r /@ Range[0, n]],
>      DeleteCases[cpolar, _t, \[Infinity]]}, r /@ Range[0, n]]
>
> Out[26]= {-1., {r[0] ->  0., r[1] ->  1., r[2] ->  0., r[3] ->  0.,
>     r[4] ->  0., r[5] ->  0.}}

please replace In[23]..In[26] by:

fpolar=Collect[f/.{re->(r[#]Cos[t@#]&),im->(r[#]Sin[t@#]&)},r/@Range[0,n],FullSimplify[#,cpolar=And@@Flatten[{Sum[r[k]^2,{k,0,n}]==1,Table[0<=r[k]<=1&&-Pi<=t[k]<=Pi,{k,0,n}]}]]&];

use interval arithmetic to get an upper bound for the functionvalue

fintval=fpolar/._Cos|_Sin->Interval[{-1,1}]//ExpandAll//Simplify;

Clear@target;
target[rr:{__?NumericQ}]:=(fintval/.Thread[(r/@Range[0,n])->rr])[[1,2]]

now you'll get

sol=NMinimize[{target[r/@Range[0,n]],DeleteCases[cpolar,_t,
     \[Infinity]]},r/@Range[0,n]]

{-1.,{r[0]->0.,r[1]->1.,r[2]->0.,r[3]->0.,r[4]->0.,r[5]->0.}}

and the same outcome when using the lower bound of fintval in the 
definition of target[].

Sorry for the mistake(s),
Peter


  • Prev by Date: Re: Mathematica 20x slower than Java at arithmetic/special functions, is
  • Next by Date: Re: Mathematica 20x slower than Java at arithmetic/special functions, is
  • Previous by thread: Re: problem with LessEqual::nord:
  • Next by thread: unexpected Timing results