I need to get a minimum of function F[ang] which is defined as a function of angle:
F[ang_] := -KFe*(Cos[ang])^2 - NSm*kB*T*Log[Zf[ang]];
Zf[ang_] := Sum[Exp[-Enf[ang][[j]]/(kB*T)], {j, 1, 6}];
Where Enf[ang] are the eigenvalues of Hamiltonian (vector 6x1) which also depend on angle, all the others are just constants. I have checked all the matrices and other output - analiticaly they look correct.
Trying all the functions like Minimize,FindMin, etc I always get the same mistake - the program gives me the maximum instead of the minimum. Moreover, it gives me actually the wrong value.
So, the minimum given by programm is
Minimize[{F[theta], 0 < theta < Pi/2}, theta]
{-5.43002*10^7, {theta -> 0.}}
While in fact it is clear from the graph that F[theta=0]=-4.6*10^7
I have some ideas why this could happen. First of all, my function is kind of sum of analytical part and the sum of series(which is Enf). Futhermore, those Enf are not good-looking really, as follows:
{Root[(-7.46805*10^-45 -
2.21485*10^-44 Cos[2 theta]) #1^3 + (-3.65541*10^-29 +
1.4013*10^-45 Cos[theta] + 2.8026*10^-45 Cos[2 theta]) #1^4 +
1. #1^6 &, 1],
Root[(-7.46805*10^-45 -
2.21485*10^-44 Cos[2 theta]) #1^3 + (-3.65541*10^-29 +
1.4013*10^-45 Cos[theta] + 2.8026*10^-45 Cos[2 theta]) #1^4 +
1. #1^6 &, 2],
Root[(-7.46805*10^-45 -
2.21485*10^-44 Cos[2 theta]) #1^3 + (-3.65541*10^-29 +
1.4013*10^-45 Cos[theta] + 2.8026*10^-45 Cos[2 theta]) #1^4 +
1. #1^6 &, 3],
Root[(-7.46805*10^-45 -
2.21485*10^-44 Cos[2 theta]) #1^3 + (-3.65541*10^-29 +
1.4013*10^-45 Cos[theta] + 2.8026*10^-45 Cos[2 theta]) #1^4 +
1. #1^6 &, 4],
Root[(-7.46805*10^-45 -
2.21485*10^-44 Cos[2 theta]) #1^3 + (-3.65541*10^-29 +
1.4013*10^-45 Cos[theta] + 2.8026*10^-45 Cos[2 theta]) #1^4 +
1. #1^6 &, 5],
Root[(-7.46805*10^-45 -
2.21485*10^-44 Cos[2 theta]) #1^3 + (-3.65541*10^-29 +
1.4013*10^-45 Cos[theta] + 2.8026*10^-45 Cos[2 theta]) #1^4 +
1. #1^6 &, 6]}
Well, this looks terrible but is not wrong. It is just that initial Hamiltonian is not too simple.
Anyway, I can not solve this problem with finding the minimum of F[angle]. Any help would be greatly appreciated!
Thanks, Kathy
enf[theta_]=the expression you gave and plot it, I always get the right minimum (comparing to a plot) – acl Dec 19 '12 at 16:00-3.65541*10^-29 + 1.4013*10^-45 Cos[theta]...: at machine-level precision, the first term swamps essentially all the precision in the remaining terms. A multiplicative change in units would not fix this. Calculation to about 25+ decimal digits is needed here in order to do anything reasonable. – whuber Dec 19 '12 at 17:49