MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: FindMaximum - f is a MathLink function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114161] Re: FindMaximum - f is a MathLink function
  • From: Oliver Ruebenkoenig <ruebenko at wolfram.com>
  • Date: Thu, 25 Nov 2010 07:04:15 -0500 (EST)
  • References: <201011251057.FAA21903@smc.vnet.net>

On Thu, 25 Nov 2010, Klemen Dovrtel wrote:

> Hello everybody,
>
> I wrote a custom function that writes the arguments of function into a .txt file, and  than runs some external simulation program, using MathLink, that takes this argument as input. The results of that simulation program are written into a .txt file which is than read back by Mathematica. (print screen: In[387])
>
> If i run this custom function for arbitrary arguments, everything works fine. (print screen: In[388])
>
> What i would like to do is to find the maximum of my custom function. So i used the Mathematica FindMaximum algorithm on my custom function (print screen: In[391]). But this doesn't work as i thought it will. It stops right away (after one simulation). And the result is not correct - it seems like it read the results in .txt file before the simulation was finished (the result of simulation is the same as one calculated "manually" in one line above). The FindMaximum also did not start at values set as starting point.
>
> Any idea what could be wrong?
>
> print screen of mathematica .nb file: http://i51.tinypic.com/ogjjit.jpg
>
> Best Regards
> Klemen
>
>
>
>
>


Hi,

i wild guess, try to use _?NumericQ in the pattern of your function.

Oliver


  • Prev by Date: Re: Efficient search for bounding list elements
  • Next by Date: Re: MathLink - Linux - Calling the Kernel from External Program - undefined reference to `shm_open'
  • Previous by thread: How to add a LegendLabel to a Chartlegends in BarChart
  • Next by thread: Re: FindMaximum - f is a MathLink function