0
$\begingroup$

This question already has an answer here:

I have this pretty straight-forward function

GetMinimum[function_, xmin_] := First[FindMinimum[{function, x>xmin}, x]]

that works perfectly within a Mathematica command line session. However after moving that code into a package and calling it like

GetMinimum[x^2, -20]

I get the following output:

{y=x^2, UniversalPlot`Private`x$515 > -20}

where UniversalPlot is the name of the package. I cannot figure out how to make the function work when defining it in the package. Any ideas?

$\endgroup$

marked as duplicate by Kuba May 29 '17 at 14:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ I think it is a duplicate of mathematica.stackexchange.com/q/114769/5478 let me know if you disagree with closing. Or if there are any doubts. $\endgroup$ – Kuba May 29 '17 at 13:53
  • $\begingroup$ Actually I don't understand how to apply the answer to the linked question to solve my problem. $\endgroup$ – user3075898 May 29 '17 at 15:17
  • $\begingroup$ e.g GetMinimum[function_, {x_, xmin_}] := First[FindMinimum[{function, x>xmin}, x]]? $\endgroup$ – Kuba May 29 '17 at 15:18
  • $\begingroup$ Thanks, but is there a way for the caller to not pass an additional variable from the outside? $\endgroup$ – user3075898 May 29 '17 at 15:39
  • $\begingroup$ I've outlined 4 ways in the linked topic. But passing them explicitly seems to be a standard $\endgroup$ – Kuba May 29 '17 at 15:44