Re: Defining functions in mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg85597] Re: Defining functions in mathematica*From*: dh <dh at metrohm.ch>*Date*: Thu, 14 Feb 2008 06:29:18 -0500 (EST)*References*: <fp0lhr$5ls$1@smc.vnet.net>

Hi, try NMaximize. I think Maximize expects a symbolic expression in some variable. hope this helps, Daniel lederer at ssb.rochester.edu wrote: > I am trying to maximize an interpolated function without success > > Here is what I have tried: first I defined the interpolated function > > f= FunctionInterpolation[profit1[p1,p2,ab],{p1,0,2},{p2,0,2},{ab,0,2}] > > To test this definition I try and see that f[.1,.3,.4] is evaluated > properly. It is properly evaluated as a real number. > > Then I try to find the x that Maximizes f > > > Maximize[{ f[x, .2, .1], 0=98x=982] }, x] > > > but what comes out is > > Maximize[{InterpolatingFunction[{{0,2}{0,2},{0,2), etc. > > Further when I try > > x/.Last [ Maximize[{ f[x, .2, .1], 0=98x=982] }, x] ] > > what comes out is > > x/.x > > What am I doing wrong? > > Also, I eventually want to define a function G[p2,ab] that takes on > the value of the maximizing x for these values. > that is > > G[p2_,ab_]=x/.Last [ Maximize[{ f[x, .2, .1], 0=98x=982] }, x] ] > > How can I do this? > > > Thanks, > > Phil > > > >