December 2005
Beginner to intermediate
618 pages
20h 19m
English
cproj
Calculates the projection of a complex number on the Riemann sphere
#include <complex.h> double complexcproj( double complexz); float complexcprojf( float complexz); long double complexcprojl( long double complexz);
The Riemann sphere is a surface that represents the entire
complex plane and one point for infinity. The cproj() function yields the representation
of a complex number on the Riemann sphere. The value of cproj(z) is equal to
z, except in cases where the real or
complex part of z is infinite. In all
such cases, the real part of the result is infinity, and the
imaginary part is zero with the sign of the imaginary part of the
argument z.
double complex z = -INFINITY − 2.7 * I;
double complex c =cproj(z);
printf("%.2f %+.2f * I is projected to %.2f %+.2f * I.\n",
creal(z), cimag(z), creal(c), cimag(c));This code produces the following output:
-inf -2.70 * I is projected to inf -0.00 * I.
Read now
Unlock full access