help

• To: mathgroup at smc.vnet.net
• Subject: [mg3146] help
• From: "NAME \"Olivier Glaizot\"" <OGLAIZOT at ac.dal.ca>
• Date: Tue, 6 Feb 1996 22:51:24 -0500
• Sender: owner-wri-mathgroup at wolfram.com

```I have a problem and maybe some of you can help me with it: I use a recursive
function, let say f[x_]:=f[x]=g[f[x-1],y];
with f[0]=0 as a terminal function.
Now within the function g, there is a maximum to be found, something like
Max[f[x-1],{y,0,ysup}] y being a discrete parameter (y=0,1,...ysup)
It is very time consuming, but I know that the discrete function to be
maximized has always a maximum, usually for small values of y.
Then, my idea was instead of building the whole Table {g[f[x-1],[y1],...
g[f[x-1],ysup], to stop as soon as g decrease again, with a function of the
type While[g[yi]>g[yi-1],i++,temp=g[yi]], so the computation stops as soon as
the function g decreases.
Now the problem is that as it is a recursive function, the While[] is called in
a nested way, and the initial values of i reset each time, at least I think it
is what happens, and the results are of course wrong. Does anyone has a good
idea? Or is it not clear (I'm afraid so...)
thanks,
Olivier
____________________________________________________________________________
| OLIVIER GLAIZOT	  	****NEW ADDRESS FROM THE FIRST MAY 1996**** |
| Biology Department             Institute of Zoology and Animal Ecology    |
| Dalhousie University           Biology Building, University of Lausanne   |
| Halifax, N.S.                  CH-1015 DORIGNY                            |
| B3H 4J1 CANADA        	 SWITZERLAND                                |
| e-mail: oglaizot at ac.dal.ca     	olivier.glaizot at izea.unil.ch        |
|_________________________________________________________________________  |
| 1523 Chesnut Street                             			    |
| Halifax B3H 3S9                                                           |