Acosc.cin

// Acosc.cin is routine in [C++]] for evaluation of function ArcCosc with complex(double) precision. // ArcCosc is inverse function of Cosc; \(\text{cosc}(z) = \cos(z)/z\).

z_type cosc(z_type z) {return cos(z)/z;} z_type cosp(z_type z) {return (-sin(z) - cos(z)/z)/z ;} z_type cohc(z_type z) {return cosh(z)/z ;} z_type cohp(z_type z) {return (sinh(z)-cosh(z)/z)/z ;}

z_type acoscL(z_type z){ int n; z_type s,q; z*=-I; q=I*sqrt(1.50887956153832-z); s=q*1.1512978931181814 + 1.199678640257734; DO(n,6) s+= (z-cohc(s))/cohp(s); return -I*s; }

z_type acoscR(z_type z) {int n; z_type s= (1.-0.5/(z*z))/z; DO(n,5) s+=(z-cosc(s))/cosp(s); return s;}

z_type acoscB(z_type z){ z_type t=0.33650841691839534+z, u=sqrt(t), s; int n; s=   2.798386045783887 +u*(-2.437906425896532 +u*( 0.7079542331649882 +u*(-0.5009330133042798 +u*( 0.5714459932734446   )))); DO(n,6) s+=(z-cosc(s))/cosp(s); return s; }

z_type acosc(z_type z){ DB x1=-0.33650841691839534, x=Re(z), y=Im(z), yy=y*y, r=x-x1;r*=r;r+=yy; if(r < 1.8 )    return acoscB(z); r=x+2.;r*=r;r+=yy; if(r>8. && x>=0) return acoscR(z); if(y >= 0) return acoscL(z); return conj(acoscL(conj(z))); }

// Copyleft 2012 by Dmitrii Kouznetsov.

// //