help
- Subject: [mg3146] help
- From: OGLAIZOT at ac.dal.ca ("NAME \"Olivier Glaizot\"")
- Date: 7 Feb 1996 05:01:22 -0600
- Approved: usenet@wri.com
- Distribution: local
- Newsgroups: wri.mathgroup
- Organization: Wolfram Research, Inc.
- Sender: daemon at wri.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 |
|_________________________________________________________________________ |
| Home address: |
| 1523 Chesnut Street |
| Halifax B3H 3S9 |
| CANADA |
| Tel/Fax: (1-902) 423-9397 |
|___________________________________________________________________________|