ADMB Documentation  11.2.2828
 All Classes Files Functions Variables Typedefs Friends Defines
dfinvcumdt.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: dfinvcumdt.cpp 1919 2014-04-22 22:02:01Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <df1b2fun.h>
00012 
00017 df1b2variable inv_cumd_t(const df1b2variable& n,const df1b2variable&  u,
00018   double eps)
00019 {
00020   double sgn;
00021   df1b2variable v;
00022   if (value(u)<0.5)
00023   {
00024     v=2.0*u;
00025     sgn=-1.0;
00026   }
00027   else
00028   {
00029     v=2.0*(1.0-u);
00030     sgn=1.0;
00031   }
00032   df1b2variable pfive=0.5;
00033   df1b2variable w=inv_cumd_beta_stable(0.5*n,pfive,v,eps);
00034   return sgn*sqrt(n*(1.0/w-1.0));
00035 }