]> www.ginac.de Git - cln.git/blob - src/complex/transcendental/cl_C_asin.cc
Initial revision
[cln.git] / src / complex / transcendental / cl_C_asin.cc
1 // asin().
2
3 // General includes.
4 #include "cl_sysdep.h"
5
6 // Specification.
7 #include "cl_complex.h"
8
9
10 // Implementation.
11
12 #include "cl_C.h"
13 #include "cl_real.h"
14
15 // Methode:
16 // Wert und Branch Cuts nach der Formel CLTL2, S. 311:
17 //   arcsin(z) = log(iz+sqrt(1-z^2))/i
18 // Sei z=x+iy, errechne u+iv = arsinh(-y+ix) wie oben, Ergebnis v-iu.
19 // Real- und Imaginärteil des Ergebnisses sind Floats, außer wenn z reell oder
20 // rein imaginär ist.
21
22 inline const cl_C_R _asin (const cl_N& z)
23 {
24         if (realp(z)) {
25                 DeclareType(cl_R,z);
26                 return asinh(0,z);
27         } else {
28                 DeclareType(cl_C,z);
29                 return asinh(-imagpart(z),realpart(z));
30         }
31 }
32
33 const cl_N asin (const cl_N& z)
34 {
35         var cl_C_R u_v = _asin(z);
36         var cl_R& u = u_v.realpart;
37         var cl_R& v = u_v.imagpart;
38         return complex(v,-u); // v-iu
39 }