Mathematica newbie here, just used it today for the first time.
So I've successfully "imported" a function from a dll I've built (in C++ with VS), using .NET/LINK and DefineDLLFunction and I've assigned it the name MyFunction. The function evaluates just fine when I call it directly (i.e. passing a double as an argument). But when I try to find a local minimum using say
FindMinimum[{MyFunction[x], 1 < x < 2}, {x, 1.5}]
I get
NET::methodargs : Improper arguments supplied for method named...
Am I trying something that cannot be done, or am I doing it wrong? Can functions imported like that be used by FindMinimum?
FindMinimum[{f[x], 1 < x < 2}, {x, 1.5}]wheref[x_?NumericQ]:=MyFunction[x]? – Kuba Feb 27 '17 at 21:46:>) or immediate (->) rule forEvaluationMonitor? If the latter, change it to the delayed rule. – Alexey Popkov Feb 28 '17 at 12:01