Re: problem with LessEqual::nord:

• To: mathgroup at smc.vnet.net
• Subject: [mg115840] Re: problem with LessEqual::nord:
• From: tarun dutta <tarunduttaz at gmail.com>
• Date: Sat, 22 Jan 2011 03:22:59 -0500 (EST)
• References: <ihbjvn\$dl3\$1@smc.vnet.net>

```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?
> 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.

```

• Prev by Date: Re: Do I need MathLink to run finite-difference fast enough for
• Next by Date: Re: Problems Exporting to PDF
• Previous by thread: Re: problem with LessEqual::nord:
• Next by thread: Re: problem with LessEqual::nord: