Tania.cin

From Citizendium
Jump to navigation Jump to search

// Tania.cin is description of evaluation of the Tania function in C++

z_type ArcTania(z_type z) {return z + log(z) - 1. ;}
z_type ArcTaniap(z_type z) {return 1. + 1./z ;}
z_type TaniaTay(z_type z) { int n; z_type s;
s=1.+z*(.5+z*(1./16.+z*(-1./192.+z*(-1./3072.+z*(1.3/6144.+z*(-4.7/147456.
//+z*(7.3/4128768.) //some reserve term
)))))); DO(n,3) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
z_type TaniaNega(z_type z){int n;z_type s=exp(z-exp(z)+1.);  
DO(n,4) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
z_type TaniaBig(z_type z){int n;z_type s=z; s=z-log(s)+1.; 
DO(n,3) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
z_type TaniaS(z_type z){int n; z_type s,t=z+z_type(2.,-M_PI);t*=2./9.; t=I*sqrt(t);
s=-1.+t*(3.+t*(-3.+t*(.75+t*(.3+t*(.9/16.+t*(-.3/7.+t*(-12.51/224. //+t*(-.9/28.)
)))))));
DO(n,3) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
z_type Tania(z_type z){ z_type t;
if( fabs(Im(z))< M_PI && Re(z)<-2.51) return TaniaNega(z);
if( abs(z)>7. || Re(z)>3.8 ) return TaniaBig(z);
if( Im(z) > .7 ) return TaniaS(z);
if( Im(z) < -.7) return conj(TaniaS(conj(z)));
return TaniaTay(z);
}

// //