MathGroup Archive 2011

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

Search the Archive

Re: problem with LessEqual::nord:

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115858] Re: problem with LessEqual::nord:
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Sun, 23 Jan 2011 05:34:50 -0500 (EST)

----- Original Message -----
> From: "tarun dutta" <tarunduttaz at gmail.com>
> To: mathgroup at smc.vnet.net
> Sent: Saturday, January 22, 2011 2:22:59 AM
> Subject: [mg115840] Re: problem with LessEqual::nord:
> On Jan 21, 2:34 pm, tarun dutta <tarundut... at gmail.com> wrote:
> > I am using "NMINIMIZE" to get the result of a function which
> > contains
> > complex term.after executing the program it is showing the following
> > error--
> > LessEqual::nord: Invalid comparison with 155.698+0. I attempted. >>
> >
> > can you explain the reason and how will I be free from this kind of
> > error?
> > thanks in advance.
> > regards,
> > tarun
> 
> n = 5;
> p = 86/1000;
> q = 1;
> Print["P= ", p, ";Q=", q];
> d[n + 1] = 0;
> d[i_] = re[i] + I*im[i];
> conj[a_] := ComplexExpand[Conjugate[a]]; f =
> Together[Sum[
> 4*p*(Sqrt[i + 1]*d[i]*
> conj[d[i + 1]]*(Sum[
> Sqrt[i + 1]*conj[d[i]]*d[i + 1], {i, 0, n}]) +
> Sqrt[i + 1]*conj[d[i]]*
> d[i + 1]*(Sum[
> Sqrt[i + 1]*d[i]*conj[d[i + 1]], {i, 0, n}])) + (-q*i +
> i (i - 1))* d[i]*conj[d[i]], {i, 0, n}]];
> c = Expand@ComplexExpand[Sum[Abs[d[i]]^2, {i, 0, n}]] == 1;
> v = Join[Array[re, n + 1, 0], Array[im, n + 1, 0]];
> Do[Print[Timing[
> NMinimize[{f, c}, v,
> Method -> {"NelderMead", "RandomSeed" -> k}]]], {k, 5}]
> 
> P= 43/500;Q=1
> 
> LessEqual::nord: Invalid comparison with 20.5897+0. I attempted. >>
> 
> LessEqual::nord: Invalid comparison with 20.5897+0. I attempted. >>
> 
> LessEqual::nord: Invalid comparison with 20.5897+0. I attempted. >>
> 
> General::stop: Further output of LessEqual::nord will be suppressed
> during this calculation. >>
> 
> {2.469,{-1.,{re[0]->-2.01718*10^-6,re[1]->-0.963829,re[2]-
> >-1.33701*10^-6,re[3]->-7.56933*10^-7,re[4]->-3.36415*10^-7,re[5]-
> >-1.89233*10^-7,im[0]->-3.66679*10^-6,im[1]->0.26652,im[2]-
> >-2.98698*10^-6,im[3]->-7.56931*10^-7,im[4]->-3.36414*10^-7,im[5]-
> >-1.89233*10^-7}}}
> 
> {2.516,{-1.,{re[0]->-3.09199*10^-6,re[1]->-0.092363,re[2]-
> >-2.28463*10^-6,re[3]->-7.55648*10^-7,re[4]->-3.36414*10^-7,re[5]-
> >-1.89234*10^-7,im[0]->-1.25918*10^-6,im[1]->-0.995725,im[2]-
> >-6.86278*10^-7,im[3]->-7.57104*10^-7,im[4]->-3.36441*10^-7,im[5]-
> >-1.89234*10^-7}}}
> 
> {2.437,{-1.00005,{re[0]->1.20634*10^-6,re[1]->-0.846064,re[2]-
> >4.78779*10^-6,re[3]->-1.02147*10^-7,re[4]->-5.79804*10^-7,re[5]-
> >-1.7838*10^-7,im[0]->-1.05706*10^-7,im[1]->-0.533133,im[2]-
> >-7.18143*10^-6,im[3]->1.57857*10^-6,im[4]->-3.34666*10^-7,im[5]-
> >-2.11685*10^-7}}}
> 
> {2.485,{-1.00007,{re[0]->-0.0000336605,re[1]->-0.188855,re[2]-
> >-0.0000164104,re[3]->-4.78099*10^-7,re[4]->-3.15951*10^-7,re[5]-
> >-1.89289*10^-7,im[0]->-6.18177*10^-6,im[1]->0.982039,im[2]-
> >-8.11101*10^-6,im[3]->4.74931*10^-7,im[4]->-3.68041*10^-7,im[5]-
> >-1.89235*10^-7}}}
> 
> {2.5,{-1.00013,{re[0]->0.0000155339,re[1]->0.804234,re[2]-
> >-0.0000101697,re[3]->-1.34501*10^-6,re[4]->-3.42677*10^-7,re[5]-
> >-1.879*10^-7,im[0]->-7.57032*10^-6,im[1]->-0.59442,im[2]-
> >0.0000144539,im[3]->-1.59861*10^-6,im[4]->-2.90219*10^-7,im[5]-
> >-1.90016*10^-7}}}
> 
> this is the whole program.

This looks to be a small bug in NMinimize. I suspect the results are fine but the messages should not be there. Below is one run.

During evaluation of In[267]:= LessEqual::nord: Invalid comparison with 2.793241931820334\[VeryThinSpace]+0. I
 attempted. >>

During evaluation of In[267]:= LessEqual::nord: Invalid comparison with 2.793241931820334\[VeryThinSpace]+0. I
 attempted. >>

During evaluation of In[267]:= LessEqual::nord: Invalid comparison with 2.793241931820334\[VeryThinSpace]+0. I
 attempted. >>

During evaluation of In[267]:= General::stop: Further output of LessEqual::nord will be suppressed during this calculation. >>

Out[267]= {-1.000000006965238, {re[0] -> 2.664607856502294*10^-10, 
  re[1] -> -0.8689574640017302, re[2] -> -4.295310766845472*10^-9, 
  re[3] -> -8.206746831508002*10^-9, 
  re[4] -> -7.561491449553593*10^-9, 
  re[5] -> -7.503860108956494*10^-9, im[0] -> -1.12627912345242*10^-8,
   im[1] -> -0.4948867877817337, im[2] -> -1.012766394289477*10^-8, 
  im[3] -> -8.188992868927224*10^-9, im[4] -> -7.72300095489266*10^-9,
   im[5] -> -7.447790587744008*10^-9}}

FindMinimum gives a similar result, sans noise.

In[164]:= FindMinimum[{f, c}, v]

Out[164]= {-1.000000000282148, {re[0] -> 2.606617881126602*10^-6, 
  re[1] -> 0.7074582745725894, re[2] -> 9.462130868209268*10^-7, 
  re[3] -> -1.363933592492301*10^-6, 
  re[4] -> -4.936557347944009*10^-7, 
  re[5] -> -2.155507383965994*10^-7, im[0] -> 2.586998141001575*10^-6,
   im[1] -> 0.7067551132174548, im[2] -> 9.885810972711476*10^-7, 
  im[3] -> -1.363675517503984*10^-6, 
  im[4] -> -4.946155411841407*10^-7, 
  im[5] -> -2.157404390732076*10^-7}}

We will look into those messages.

Daniel Lichtblau
Wolfram Research


  • Prev by Date: Re: Simple n-tuple problem - with no simple solution
  • Next by Date: Re: Compilation options question
  • Previous by thread: Re: problem with LessEqual::nord:
  • Next by thread: Re: problem with LessEqual::nord: