[ADMB Users] mfexp looks wrong
    dave fournier 
    davef at otter-rsch.com
       
    Wed Feb 27 09:35:54 PST 2013
    
    
  
a complete twice differentiable version with different upper and lower
bounds b and  -c
double mfexp2(const double& x,double b,double c)
{
   if (x<=b && x>=-c)
   {
     return exp(x);
   }
   else if (x>b)
   {
     double y=x-b;
     double y2=square(y);
     return exp(b)*(1.+y/(1.+y) +1.5*y2/(1.+y2));
   }
   else
   {
     double y=-x-c;
     double y2=square(y);
     return 1.0/(exp(c)*(1.+y/(1.+y) +1.5*y2/(1.+y2)));
   }
}
    
    
More information about the Users
mailing list