Re: problem with LessEqual::nord:
- To: mathgroup at smc.vnet.net
- Subject: [mg115878] Re: problem with LessEqual::nord:
- From: Peter Pein <petsie at dordos.net>
- Date: Sun, 23 Jan 2011 17:32:47 -0500 (EST)
- References: <ihbjvn$dl3$1@smc.vnet.net> <ihe451$q9r$1@smc.vnet.net>
On 22.01.2011 09:22, tarun dutta wrote: > 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]]; ... Hi, the value of f depends only on the radii of d[i]: 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}]}]] &] Out[23]= 86/125 r[0]^2 r[1]^2 + r[1]^2 (-1 + (172 r[2]^2)/125) + 258/125 r[2]^2 r[3]^2 + r[3]^2 (3 + (344 r[4]^2)/125) + ( 344 r[3] r[4]^2 r[5])/(25 Sqrt[5]) + 15 r[5]^2 + r[2] (344/125 Sqrt[3] r[3]^2 r[4] + 172/25 Sqrt[3/5] r[3] r[4] r[5]) + r[4]^2 (8 + (86 r[5]^2)/25) + r[1] (172/125 Sqrt[6] r[2]^2 r[3] + r[2] (344/125 Sqrt[2] r[3] r[4] + 172/25 Sqrt[2/5] r[4] r[5])) + r[0] (172/125 Sqrt[2] r[1]^2 r[2] + r[1] (172/125 Sqrt[3] r[2] r[3] + 344/125 r[3] r[4] + ( 172 r[4] r[5])/(25 Sqrt[5]))) 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.}} so you are free to select any d[1] on the unit-circle. Cheers, Peter