Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

I tried with different combinations of the Nelder-Mead options with no improvements. The default value of the MaxIterations is 100, and I also tried by increasing the number of iterations by using the package of Nelder-Mead from the excellent post Shaving the last 50 ms off NMinimizeShaving the last 50 ms off NMinimize by Oleksandr R.Oleksandr R., but again did not get any improvement. Can anyone help me with what I am missing?

I tried with different combinations of the Nelder-Mead options with no improvements. The default value of the MaxIterations is 100, and I also tried by increasing the number of iterations by using the package of Nelder-Mead from the excellent post Shaving the last 50 ms off NMinimize by Oleksandr R., but again did not get any improvement. Can anyone help me with what I am missing?

I tried with different combinations of the Nelder-Mead options with no improvements. The default value of the MaxIterations is 100, and I also tried by increasing the number of iterations by using the package of Nelder-Mead from the excellent post Shaving the last 50 ms off NMinimize by Oleksandr R., but again did not get any improvement. Can anyone help me with what I am missing?

Tweeted twitter.com/#!/StackMma/status/351341851430760448
deleted 122 characters in body
Source Link
Oleksandr R.
  • 23.1k
  • 4
  • 87
  • 126

Finding a global minimum for thethis problem (non-linear optimization by the downhill simplex method by Nelder-Mead downhill simplex method) may not be possible, but by finding local minimum, I am expecting the value of the function at the minimum is around 1 or (far) less than 1 (the lower the value, the better is the answer).

"Nelder-Mead""Nelder-Mead" method is available for "NMinimize"NMinimize in MathematicaMathematica. The problem I am facing is, even though I am changing the method options available for Nelder-Mead, as for (for example "ShrinkRatio", "ShrinkRatio", "ContractRatio" "ContractRatio", "ReflectRatio" or"ReflectRatio", and so on) and also initializing the calculation for different initial values which(which is chosen by the "RandomSeed" "RandomSeed"), I am getting minima which are way greater than 1 (where as I am looking for minima which is/are way less than 1). Anyone can help me with what I am missing ?

I found people deal these kindakind of problems by writing codes either in C++ or Fortran and the results are too good, but I know neither of them so I am trying to do it with Mathematica byMathematica using the built-in functions.

A = ({{a11, 0},{0, a22}});
B = ({{b11, b13},{b13, b22}});
M1 = A + Exp[I phi] B;
M2 = a A + b Exp[I theta] B;
M3 = a A - 3 b Exp[I theta] B;
m1 = Abs[Eigenvalues[M1]];
m2 = Abs[Eigenvalues[M2]];
m3 = Abs[Eigenvalues[M3]];


t1 = T1[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[1]];
t2 = T2[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[2]];

t3 = T3[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[1]];
t4 = T4[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[2]];

t5 = T5[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[1]];
t6 = T6[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[2]];

O2 = 0.235; O1 = 72;
E2 = 0.031; E1 = 0.87;

O4 = 0.0222196; O3 = 0.958157;
E4 = 0.006198; E3 = 0.018862;

O6 = 0.0941698; O5 = 1.60087;
E6 = 3.6079*^-7; E5 = 0.00026;

function[a11, a22, b11, b22, b13, a, b, phi,theta] = 
  ((t1 - O1)/E1)^2 + ((t2 - O2)/E2)^2 + ((t3 - O3)/E3)^2 + ((t4 - O4)/E4)^2 +
  ((t5 - O5)/E5)^2 + ((t6 - O6)/E6)^2;

Do[Print[NMinimize[
function[a11, a22, b11, b22, b13, a, b, phi, theta], 
{a11, a22,b11, b22, b13, a, b, phi, theta},
Method -> {"NelderMead", "ShrinkRatio" -> 0.5,"ContractRatio" -> 0.7,
"ReflectRatio" -> 1, "ExpandRatio" -> 2,"RandomSeed" -> j}]], {j, 5}]

Five random iterations (with different initial conditions chosen randomly) find different minima but all are notmuch greater than the expected result. Here are they are:

I tried with the different combinations of the NeilderNelder-Mead options (such as "ShrinkRatio" , "ContractRatio" , "ReflectRatio") with no improvements. The default value of the Max Iteration of Nelder-MeadMaxIterations is 100, and I also tried by increasing the number of Max Iteration iterations by using the package of Nelder-Mead from the excellent post Shaving the last 50 ms off NMinimize by http://mathematica.stackexchangeOleksandr R.com/users/312/oleksandr-r  , but again did not get any improvement. What amCan anyone help me with what I am missing  ?

Finding global minimum for the problem (non-linear optimization by the downhill simplex method by Nelder-Mead) may not be possible, but by finding local minimum, I am expecting the value of the function at the minimum is around 1 or (far) less than 1 (the lower the value, the better is the answer).

"Nelder-Mead" method is available for "NMinimize" in Mathematica. The problem I am facing is, even though I am changing the options available for Nelder-Mead, as for example "ShrinkRatio" , "ContractRatio" , "ReflectRatio" or so on and also initializing the calculation for different initial values which is chosen by the "RandomSeed" , I am getting minima which are way greater than 1 (where as I am looking for minima which is/are way less than 1). Anyone can help me with what I am missing ?

I found people deal these kinda problems by writing codes either in C++ or Fortran and the results are too good, but I know neither of them so trying to do with Mathematica by using the built-in functions.

A = ({{a11, 0},{0, a22}});
B = ({{b11, b13},{b13, b22}});
M1 = A + Exp[I phi] B;
M2 = a A + b Exp[I theta] B;
M3 = a A - 3 b Exp[I theta] B;
m1 = Abs[Eigenvalues[M1]];
m2 = Abs[Eigenvalues[M2]];
m3 = Abs[Eigenvalues[M3]];


t1 = T1[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[1]];
t2 = T2[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[2]];

t3 = T3[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[1]];
t4 = T4[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[2]];

t5 = T5[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[1]];
t6 = T6[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[2]];

O2 = 0.235; O1 = 72;
E2 = 0.031; E1 = 0.87;

O4 = 0.0222196; O3 = 0.958157;
E4 = 0.006198; E3 = 0.018862;

O6 = 0.0941698; O5 = 1.60087;
E6 = 3.6079*^-7; E5 = 0.00026;

function[a11, a22, b11, b22, b13, a, b, phi,theta] = 
  ((t1 - O1)/E1)^2 + ((t2 - O2)/E2)^2 + ((t3 - O3)/E3)^2 + ((t4 - O4)/E4)^2 +
  ((t5 - O5)/E5)^2 + ((t6 - O6)/E6)^2;

Do[Print[NMinimize[
function[a11, a22, b11, b22, b13, a, b, phi, theta], 
{a11, a22,b11, b22, b13, a, b, phi, theta},
Method -> {"NelderMead", "ShrinkRatio" -> 0.5,"ContractRatio" -> 0.7,
"ReflectRatio" -> 1, "ExpandRatio" -> 2,"RandomSeed" -> j}]], {j, 5}]

Five random iterations (with different initial conditions chosen randomly) find different minima but all are not expected result. Here are they:

I tried with the different combinations of the Neilder-Mead options (such as "ShrinkRatio" , "ContractRatio" , "ReflectRatio") with no improvements. The default value of the Max Iteration of Nelder-Mead is 100, I also tried by increasing the number of Max Iteration by using the package of Nelder-Mead from the excellent post Shaving the last 50 ms off NMinimize by http://mathematica.stackexchange.com/users/312/oleksandr-r  , but again did not get any improvement. What am I missing  ?

Finding a global minimum for this problem (non-linear optimization by the Nelder-Mead downhill simplex method) may not be possible, but by finding local minimum, I am expecting the value of the function at the minimum is around 1 or (far) less than 1 (the lower the value, the better is the answer).

"Nelder-Mead" method is available for NMinimize in Mathematica. The problem I am facing is, even though I am changing the method options for Nelder-Mead (for example, "ShrinkRatio", "ContractRatio", "ReflectRatio", and so on) and also initializing the calculation for different initial values (which is chosen by the "RandomSeed"), I am getting minima which are way greater than 1.

I found people deal these kind of problems by writing codes either in C++ or Fortran and the results are good, but I know neither of them so I am trying to do it with Mathematica using the built-in functions.

A = ({{a11, 0},{0, a22}});
B = ({{b11, b13},{b13, b22}});
M1 = A + Exp[I phi] B;
M2 = a A + b Exp[I theta] B;
M3 = a A - 3 b Exp[I theta] B;
m1 = Abs[Eigenvalues[M1]];
m2 = Abs[Eigenvalues[M2]];
m3 = Abs[Eigenvalues[M3]];


t1 = T1[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[1]];
t2 = T2[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[2]];

t3 = T3[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[1]];
t4 = T4[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[2]];

t5 = T5[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[1]];
t6 = T6[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[2]];

O2 = 0.235; O1 = 72;
E2 = 0.031; E1 = 0.87;

O4 = 0.0222196; O3 = 0.958157;
E4 = 0.006198; E3 = 0.018862;

O6 = 0.0941698; O5 = 1.60087;
E6 = 3.6079*^-7; E5 = 0.00026;

function[a11, a22, b11, b22, b13, a, b, phi,theta] = 
((t1 - O1)/E1)^2 + ((t2 - O2)/E2)^2 + ((t3 - O3)/E3)^2 + ((t4 - O4)/E4)^2 +
((t5 - O5)/E5)^2 + ((t6 - O6)/E6)^2;

Do[Print[NMinimize[
function[a11, a22, b11, b22, b13, a, b, phi, theta], 
{a11, a22,b11, b22, b13, a, b, phi, theta},
Method -> {"NelderMead", "ShrinkRatio" -> 0.5,"ContractRatio" -> 0.7,
"ReflectRatio" -> 1, "ExpandRatio" -> 2,"RandomSeed" -> j}]], {j, 5}]

Five random iterations (with different initial conditions chosen randomly) find different minima but all are much greater than the expected result. Here they are:

I tried with different combinations of the Nelder-Mead options with no improvements. The default value of the MaxIterations is 100, and I also tried by increasing the number of iterations by using the package of Nelder-Mead from the excellent post Shaving the last 50 ms off NMinimize by Oleksandr R., but again did not get any improvement. Can anyone help me with what I am missing?

Fixed code (formatting)
Source Link
Michael E2
  • 244.7k
  • 18
  • 351
  • 774
A = ({{a11, 0},{0, a22}});
B = ({{b11, b13},{b13, b22}});
M1 = A + Exp[I phi] B;
M2 = a A + b Exp[I theta] B;
M3 = a A - 3 b Exp[I theta] B;
m1 = Abs[Eigenvalues[M1]];
m2 = Abs[Eigenvalues[M2]];
m3 = Abs[Eigenvalues[M3]];


t1 = T1[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[1]];
t2 = T2[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[2]];

t3 = T3[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[1]];
t4 = T4[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[2]];

t5 = T5[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[1]];
t6 = T6[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[2]];

O2 = 0.235; O1 = 72;
E2 = 0.031; E1 = 0.87;

O4 = 0.0222196; O3 = 0.958157;
E4 = 0.006198; E3 = 0.018862;

O6 = 0.0941698; O5 = 1.60087;
E6 = 3.6079*^-7; E5 = 0.00026;

function[a11, a22, b11, b22, b13, a, b, phi,theta] = 
  ((t1 - O1)/E1)^2 + ((t2 - O2)/E2)^2 + ((t3 - O3)/E3)^2 + ((t4 - O4)/E4)^2 
 +
  ((t5 - O5)/E5)^2 + ((t6 - O6)/E6)^2;

Do[Print[NMinimize[
function[a11, a22, b11, b22, b13, a, b, phi, theta], 
{a11, a22,b11, b22, b13, a, b, phi, theta},
Method -> {"NelderMead", "ShrinkRatio" -> 0.5,"ContractRatio" -> 0.7,
"ReflectRatio" -> 1, "ExpandRatio" -> 2,"RandomSeed" -> j}]], {j, 5}]
A = ({{a11, 0},{0, a22}});
B = ({{b11, b13},{b13, b22}});
M1 = A + Exp[I phi] B;
M2 = a A + b Exp[I theta] B;
M3 = a A - 3 b Exp[I theta] B;
m1 = Abs[Eigenvalues[M1]];
m2 = Abs[Eigenvalues[M2]];
m3 = Abs[Eigenvalues[M3]];


t1 = T1[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[1]];
t2 = T2[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[2]];

t3 = T3[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[1]];
t4 = T4[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[2]];

t5 = T5[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[1]];
t6 = T6[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[2]];

O2 = 0.235; O1 = 72;
E2 = 0.031; E1 = 0.87;

O4 = 0.0222196; O3 = 0.958157;
E4 = 0.006198; E3 = 0.018862;

O6 = 0.0941698; O5 = 1.60087;
E6 = 3.6079*^-7; E5 = 0.00026;

function[a11, a22, b11, b22, b13, a, b, phi,theta] = 
((t1 - O1)/E1)^2 + ((t2 - O2)/E2)^2 + ((t3 - O3)/E3)^2 + ((t4 - O4)/E4)^2 
 + ((t5 - O5)/E5)^2 + ((t6 - O6)/E6)^2;

Do[Print[NMinimize[
function[a11, a22, b11, b22, b13, a, b, phi, theta], 
{a11, a22,b11, b22, b13, a, b, phi, theta},
Method -> {"NelderMead", "ShrinkRatio" -> 0.5,"ContractRatio" -> 0.7,
"ReflectRatio" -> 1, "ExpandRatio" -> 2,"RandomSeed" -> j}]], {j, 5}]
A = ({{a11, 0},{0, a22}});
B = ({{b11, b13},{b13, b22}});
M1 = A + Exp[I phi] B;
M2 = a A + b Exp[I theta] B;
M3 = a A - 3 b Exp[I theta] B;
m1 = Abs[Eigenvalues[M1]];
m2 = Abs[Eigenvalues[M2]];
m3 = Abs[Eigenvalues[M3]];


t1 = T1[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[1]];
t2 = T2[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, phi_?NumberQ] = m1[[2]];

t3 = T3[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[1]];
t4 = T4[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m2[[2]];

t5 = T5[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[1]];
t6 = T6[a11_?NumberQ, a22_?NumberQ, b11_?NumberQ, b22_?NumberQ, 
b13_?NumberQ, theta_?NumberQ, a_?NumberQ, b_?NumberQ] = m3[[2]];

O2 = 0.235; O1 = 72;
E2 = 0.031; E1 = 0.87;

O4 = 0.0222196; O3 = 0.958157;
E4 = 0.006198; E3 = 0.018862;

O6 = 0.0941698; O5 = 1.60087;
E6 = 3.6079*^-7; E5 = 0.00026;

function[a11, a22, b11, b22, b13, a, b, phi,theta] = 
  ((t1 - O1)/E1)^2 + ((t2 - O2)/E2)^2 + ((t3 - O3)/E3)^2 + ((t4 - O4)/E4)^2 +
  ((t5 - O5)/E5)^2 + ((t6 - O6)/E6)^2;

Do[Print[NMinimize[
function[a11, a22, b11, b22, b13, a, b, phi, theta], 
{a11, a22,b11, b22, b13, a, b, phi, theta},
Method -> {"NelderMead", "ShrinkRatio" -> 0.5,"ContractRatio" -> 0.7,
"ReflectRatio" -> 1, "ExpandRatio" -> 2,"RandomSeed" -> j}]], {j, 5}]
deleted 1 characters in body
Source Link
SAS
  • 195
  • 1
  • 8
Loading
added 546 characters in body
Source Link
SAS
  • 195
  • 1
  • 8
Loading
Source Link
SAS
  • 195
  • 1
  • 8
Loading