ADMB Documentation  11.1.2491
 All Classes Files Functions Variables Typedefs Friends Defines
cumd_cau.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: cumd_cau.cpp 1112 2013-07-12 21:41:41Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <fvar.hpp>
00012 
00017 double cumd_cauchy(const double& x)
00018 {
00019   double t=0.0;
00020   const double r2=sqrt(2.0);
00021   t=atan(x/r2);
00022   return (0.5 + t/PI);
00023 }
00024 
00029 double density_cauchy(const double& x)
00030 {
00031   const double r2=PI*sqrt(2.0);
00032   return 1./(r2*(1+0.5*x*x));
00033 }
00034 
00039 double log_density_cauchy(const double& x)
00040 {
00041   const double r2=PI*sqrt(2.0);
00042   return -log(r2*(1+0.5*x*x));
00043 }
00044 
00049 double inv_cumd_cauchy(const double& x)
00050 {
00051   const double r2=sqrt(2.0);
00052   return (r2*tan(PI*(x-0.5)));
00053 }