MathGroup Archive 1996

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

Search the Archive


  • To: mathgroup at
  • Subject: [mg3146] help
  • From: "NAME \"Olivier Glaizot\"" <OGLAIZOT at>
  • Date: Tue, 6 Feb 1996 22:51:24 -0500
  • Sender: owner-wri-mathgroup at

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...)
| 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     	olivier.glaizot at        |
|_________________________________________________________________________  |
| Home address:								    |
| 1523 Chesnut Street                             			    |
| Halifax B3H 3S9                                                           |
| CANADA                                                                    |
| Tel/Fax: (1-902) 423-9397				    		    |


  • Prev by Date: Re: MathLink in C++
  • Next by Date: help
  • Previous by thread: Notebo0k==>>>TeX
  • Next by thread: help