Re: NMINIMIZATION WITH COMPLEX CONJUGATE
- To: mathgroup at smc.vnet.net
- Subject: [mg112864] Re: NMINIMIZATION WITH COMPLEX CONJUGATE
- From: ADL <alberto.dilullo at tiscali.it>
- Date: Mon, 4 Oct 2010 06:05:18 -0400 (EDT)
- References: <i86uvd$hp3$1@smc.vnet.net>
On 2 Ott, 11:45, tarun dutta <tarundut... at gmail.com> wrote: > I want to nminimize a function which contain a variable like x[i] and > also its conjugate i.e.x[i]* where ''i'' can vary from 0 to a > fixed number n the constraint is [sum[abs[x[i]^2=1], > so here I want to find out the value of x[i] for which we will get the > minimized value of the function... > > p = 0.05; > q = 1 > n = 5; > x[6] = 0; > f = Sum[Sqrt[i + 1] p x[i] > \!\(\*SuperscriptBox[ > RowBox[{"(", > RowBox[{"x", "[", > RowBox[{"i", "+", "1"}], "]"}], ")"}], "*"]\) + > \!\(\*SuperscriptBox["p", "*"]\) x[ > i + 1] (x[i])\[Conjugate] + (q*i + i (i - 1)) x[i] > \!\(\*SuperscriptBox[ > RowBox[{"(", > RowBox[{"x", "[", "i", "]"}], ")"}], "*"]\), {i, 0, n}]; > c = [\!\( > \*UnderoverscriptBox[\(\[Sum]\), \(i = 0\), \(n\)] > \*SuperscriptBox[\(Abs\ [x[i]]\), \(2\)]\) == 1, {i, n}]; > v = Array[x, n]; Timing[ > NMinimize[{f, c}, v, > Method -> {"RandomSearch", Method -> "InteriorPoint"}]] > > This is my written program from which I can not get the expected > value.please give a solution...if myproblem is not clear to you people > then just inform me through mailing... I tried to solve your problem by splitting real and complex parts: p = 1/20; q = 1 ; n = 5; x[0] = 0; (* HOW DO YOU DEAL WITH X[0] ?*) x[6] = 0; f = Sum[ Conjugate[p]*x[i + 1]*Conjugate[x[i]] + Sqrt[i + 1]*p*x[i]*Conjugate[x[i + 1]] + (i*q + (i - 1)*i)*x[i]*Conjugate[x[i]], {i, 0, n} ]; vr = Array[xr, n]; vi = Array[xi, n]; vv = Join[vr, vi]; ff = ExpandAll@ComplexExpand@ExpandAll@(f /. x[i_] :> xr[i] + I xi[i]) c = Sum[Abs[x[i]]^2, {i, n}]; cc = FullSimplify[ExpandAll[c /. x[i_] :> xr[i] + I xi[i]], vv \[Element] Reals] NMinimize[{Abs[ff], cc == 1}, vv, Method -> {"RandomSearch", Method -> "InteriorPoint"} ] {0.998786000742084,{ xr[1]->0.639564303676262, xr[2]->-0.012868312708188, xr[3]->0.000106478076504024, xr[4]->-3.7447230021614*10^-6, xr[5]->-3.14110125055689*10^-6, xi[1]->0.768474352348592, xi[2]->-0.0154612373020706, xi[3]->0.000128613261347542, xi[4]->-3.8553915016355*10^-6, xi[5]->-3.14072792856528*10^-6 }} Could this help? ADL