0
$\begingroup$

I have a FindMinimum task that I described in an earlier post. One of the suggestions to make the minimization algorithm work was to try to scale the input variables so they are closer. One of the options I have is to use a Log10 function to change distances into magnitudes. However, the combination of the two input variables leads to many values that are imaginary. The function

FindMinimum[{chiSquared[t1, a0]]}, {{t1, 1*^16}, {a0, 1*^-14}}]

fails with the message

The function value {7.98991 (8.29281 -2.17147 Log[-1.61233*10^-20 (-3005.38+Times[<<2>>])]),6.6395 (8.40948 -2.17147 Log[-1.61233*10^-20 (-3005.38+Times[<<2>>])]),6.93242 (8.47922 -2.17147 Log[-1.61153*10^-20 (-3306.73+Times[<<2>>])]),6.96657 (8.57934 -2.17147 Log[-1.61153*10^-20 (-3306.73+Times[<<2>>])]),<<44>>,7.28976 (10.1836 -2.17147 Log[-1.60197*10^-20 (-6934.41+Times[<<2>>])]),7.52241 (10.2498 -2.17147 Log[-1.60197*10^-20 (-6934.41+Times[<<2>>])]),<<426>>} is not a list of real numbers with dimensions {476} at {Subscript[t, 1],Subscript[a, [Placeholder]]} = {1.,1.}. >> >>

Is there a way to tell the FindMinimum function to ignore results that are imaginary?

$\endgroup$
7
  • $\begingroup$ Can't you just wrap the function in Re[]? $\endgroup$
    – Feyre
    Aug 11, 2016 at 11:35
  • $\begingroup$ Apparently not. I get the same message above, but with the 'Re[<previous message>]'. Oddly, if I just take the 'chiSquared' function at the coordinates quoted in the error message (e.g. 1, 1), I get a real number. $\endgroup$
    – Quarkly
    Aug 11, 2016 at 11:42
  • $\begingroup$ Are you using the same definitions and values as in the post you linked to? This does not produce any error on my side. $\endgroup$
    – user31159
    Aug 11, 2016 at 11:56
  • $\begingroup$ I'm still working on it, but there seems to be a bug when using the subscript notation. You are correct, the notation I supplied seems to work. In my original notebook, the same values when subscripted (e.g. $t_1, a_0$) fail with the above message. $\endgroup$
    – Quarkly
    Aug 11, 2016 at 12:05
  • $\begingroup$ @DRAirey1 Giving FindMinimum[{chiSquared[Subscript[t, 1], Subscript[a, 0]]}, {{Subscript[t, 1], 1*^16}, {Subscript[a, 0], 1*^-14}}] works fine and produces the same result as FindMinimum[{chiSquared[t1, a0]}, {{t1, 1*^16}, {a0, 1*^-14}}] for me. $\endgroup$
    – user31159
    Aug 11, 2016 at 12:14

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.