Re: Defining functions in mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg85592] Re: Defining functions in mathematica
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 14 Feb 2008 06:26:44 -0500 (EST)
- Organization: Uni Leipzig
- References: <fp0lhr$5ls$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi, since I have no profit, and also no profit1 I make f instead of profit f = FunctionInterpolation[(x - 1/4)^2 + y^2, {x, -2, 2}, {y, -2, 2}]; NMinimize[f[x, y], {x, y}] and got the result. Regards Jens 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 > > > >