Re: calling maximize recursively
- To: mathgroup at smc.vnet.net
- Subject: [mg67644] Re: calling maximize recursively
- From: dh <dh at metrohm.ch>
- Date: Mon, 3 Jul 2006 06:38:03 -0400 (EDT)
- References: <e82nm1$r2i$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Ho Garrio, 1) you must work with an numerical routine, as you can analytically compute the derivatives of function2. E.g.: NMaximize[function2[bestbound], {bestbound}] 2) your problem does not have a unique Maximum, every number >=0.5 fullfills you conditions. 3) ensure that your function is only called with numerical arguments, e.g.: function2[bound_ /; NumberQ[bound]] := ... 4) If you know an approximate value of bestbound, you can help Mathematica by e.g.specifying this value: FindMaximum[function2[bestbound], {bestbound, 0.3}] Daniel garriott at gmail.com wrote: > Hello all. > > I am trying to call an instance of Maximize[] within Maximize[]. > > Essentially I'm trying to perform a traditional Bellman's equation > optimization, where you maximize value[now] + value[later], and > value[later] is itself another maximization, and so on. > > Here is a very simplified example of a recursive Maximize[] call. If > you can figure out a way to get this to work without deleting one of > the two Mazimize[]s then you'll save the day for me! (I am aware this > particular problem could be done far easier, but it's the setup here > that matters, not the particular problem.) > > > > function1[x_] := x - x^2; > > function2[bound_] := Maximize[ {function1[x], x<bound} , x ]; > > Maximize [ function2[bestbound] , bestbound ] > > > > (if you import this in to mathematica it gives an error, because it > tries to pass bestbound as a pure variable to function2, rather than a > candidate value of bestbound to function2) > > Please help, > Garrio >