0
$\begingroup$

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$
5
  • $\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, 2017 at 13:53
  • $\begingroup$ Actually I don't understand how to apply the answer to the linked question to solve my problem. $\endgroup$ May 29, 2017 at 15:17
  • $\begingroup$ e.g GetMinimum[function_, {x_, xmin_}] := First[FindMinimum[{function, x>xmin}, x]]? $\endgroup$
    – Kuba
    May 29, 2017 at 15:18
  • $\begingroup$ Thanks, but is there a way for the caller to not pass an additional variable from the outside? $\endgroup$ May 29, 2017 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, 2017 at 15:44

0