[ADMB Users] recursive code

John Sibert sibert at hawaii.edu
Mon Jan 31 11:20:53 PST 2011


Seems that a simple recursive function might not be an issue provided it 
terminates itself after a fixed number of calls. It might produce a 
derivative error of the termination condition depends on the computation 
somehow as in a Newton-Raphson?

On 01/27/2011 02:34 PM, dave fournier wrote:
>
> I do now!
>
>
> DATA_SECTION
> PARAMETER_SECTION
>   init_number x
>   objective_function_value f
> PROCEDURE_SECTION
>   dvariable u=myrec(x);
>   f=square(u-.6);
> GLOBALS_SECTION
>
>   #include <admodel.h>
>   int count=0;
>
>   dvariable myrec(const prevariable& v)
>   {
>     if (count++>10)
>       return sin(v);
>     else
>       return sin(myrec(v));
>   }
>
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
>

-- 
John Sibert
Emeritus Researcher, SOEST
University of Hawaii at Manoa

Visit the ADMB project http://admb-project.org/




More information about the Users mailing list