Re: NMINIMIZATION WITH COMPLEX CONJUGATE
- To: mathgroup at smc.vnet.net
- Subject: [mg112871] Re: NMINIMIZATION WITH COMPLEX CONJUGATE
- From: pratip <pratip.chakraborty at gmail.com>
- Date: Mon, 4 Oct 2010 06:06:37 -0400 (EDT)
- References: <i86uvd$hp3$1@smc.vnet.net>
Dear Tarun, Here is the list of parameters that you mentioned. p = 0.05; q = 1 n = 5; All the variables are separated in real and complex part. Here x[i]=CompNum[i]=a[i]+I b[i] and the conjugates are coded like this (x^*)[i]=TCompNum[i]=a[i]-I b[i] CompNum[i_] := a[i] + I b[i]; TCompNum[i_] := a[i] - I b[i]; Here is your function to be minimized. f = Sum[Sqrt[i + 1] p CompNum[i] TCompNum[i + 1] + p CompNum[i + 1] TCompNum[i] + (q*i + i (i - 1)) CompNum[i] TCompNum[ i], {i, 0, n}]; Here is the equality constraint c = \!\( \*UnderoverscriptBox[\(\[Sum]\), \(i = 0\), \(n\)] \*SuperscriptBox[\(Abs\ [CompNum[i]]\), \(2\)]\) == 1; c // TraditionalForm You mentioned that x[6]=0. Hence I set the last variable to be equal to zero be setting the real part and imaginary part to be equal to zero. dp = {a[n + 1] -> 0, b[n + 1] -> 0}; Here are the variables to be optimized. var = Table[CompNum[i], {i, 0, n}] /. a_ + I b_ -> {a, b} // Flatten; prob = Join[ComplexExpand[f] /. a_ + I b_ -> {a^2 + b^2} /. dp, {c}]; {val, res} = FindMinimum[prob, var, AccuracyGoal -> 15, MaxIterations -> 10000] {1.6269*10^-9, {a[0] -> 0.707063, b[0] -> 0.70707, a[1] -> -0.00465305, b[1] -> -0.00466767, a[2] -> 0.00500541, b[2] -> 0.0050008, a[3] -> 0.0000544725, b[3] -> 0.0000995694, a[4] -> -0.00175304, b[4] -> -0.00175306, a[5] -> -0.00268813, b[5] -> -0.00268786}} You can check how good the constraints are satisfied. You can see the left hand side of the constraint is equal to 1 if we insert the optimization result from above. c /. al_ == bl_ -> (al) /. res 1. However the problem is very simple just you have to code it properly so that Mathematica can solve it. Pratip