liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
complex number
Collaboration diagram for complex number:

Data Structures

struct  a_complex
 instance structure for complex number More...
 

Macros

#define A_COMPLEX_PRI(RF, RC, IF, IC)
 
#define A_COMPLEX_C(R, I)
 
#define a_complex_c(r, i)
 

Typedefs

typedef struct a_complex a_complex
 instance structure for complex number
 

Functions

static void a_complex_rect (a_complex *ctx, double real, double imag)
 constructs a complex number from real and imaginary parts
 
void a_complex_polar (a_complex *ctx, double rho, double theta)
 constructs a complex number from polar form
 
unsigned int a_complex_parse (a_complex *ctx, char const *str)
 parse a string into a complex number
 
bool a_complex_eq (a_complex x, a_complex y)
 complex number x is equal to complex number y
 
bool a_complex_ne (a_complex x, a_complex y)
 complex number x is not equal to complex number y
 
double a_complex_logabs (a_complex z)
 computes the natural logarithm of magnitude of a complex number
 
double a_complex_abs2 (a_complex z)
 computes the squared magnitude of a complex number
 
double a_complex_abs (a_complex z)
 computes the magnitude of a complex number
 
double a_complex_arg (a_complex z)
 computes the phase angle of a complex number
 
void a_complex_proj (a_complex *ctx, a_complex z)
 computes the projection on Riemann sphere
 
void a_complex_proj_ (a_complex *ctx)
 
void a_complex_conj (a_complex *ctx, a_complex z)
 computes the complex conjugate
 
void a_complex_conj_ (a_complex *ctx)
 
void a_complex_neg (a_complex *ctx, a_complex z)
 computes the complex negative
 
void a_complex_neg_ (a_complex *ctx)
 
void a_complex_add (a_complex *ctx, a_complex x, a_complex y)
 addition of complex numbers
 
void a_complex_add_ (a_complex *ctx, a_complex z)
 
void a_complex_add_real (a_complex *ctx, a_complex x, double y)
 
void a_complex_add_real_ (a_complex *ctx, double x)
 
void a_complex_add_imag (a_complex *ctx, a_complex x, double y)
 
void a_complex_add_imag_ (a_complex *ctx, double x)
 
void a_complex_sub (a_complex *ctx, a_complex x, a_complex y)
 subtraction of complex numbers
 
void a_complex_sub_ (a_complex *ctx, a_complex z)
 
void a_complex_sub_real (a_complex *ctx, a_complex x, double y)
 
void a_complex_sub_real_ (a_complex *ctx, double x)
 
void a_complex_sub_imag (a_complex *ctx, a_complex x, double y)
 
void a_complex_sub_imag_ (a_complex *ctx, double x)
 
void a_complex_mul (a_complex *ctx, a_complex x, a_complex y)
 multiplication of complex numbers
 
void a_complex_mul_ (a_complex *ctx, a_complex z)
 
void a_complex_mul_real (a_complex *ctx, a_complex x, double y)
 
void a_complex_mul_real_ (a_complex *ctx, double x)
 
void a_complex_mul_imag (a_complex *ctx, a_complex x, double y)
 
void a_complex_mul_imag_ (a_complex *ctx, double x)
 
void a_complex_div (a_complex *ctx, a_complex x, a_complex y)
 division of complex numbers
 
void a_complex_div_ (a_complex *ctx, a_complex z)
 
void a_complex_div_real (a_complex *ctx, a_complex x, double y)
 
void a_complex_div_real_ (a_complex *ctx, double x)
 
void a_complex_div_imag (a_complex *ctx, a_complex x, double y)
 
void a_complex_div_imag_ (a_complex *ctx, double x)
 
void a_complex_inv (a_complex *ctx, a_complex z)
 inverse of a complex number
 
void a_complex_inv_ (a_complex *ctx)
 
void a_complex_sqrt (a_complex *ctx, a_complex z)
 computes the complex square root
 
void a_complex_sqrt_ (a_complex *ctx)
 
void a_complex_sqrt_real (a_complex *ctx, double x)
 
void a_complex_pow (a_complex *ctx, a_complex z, a_complex a)
 complex number z raised to complex power a
 
void a_complex_pow_ (a_complex *ctx, a_complex a)
 
void a_complex_pow_real (a_complex *ctx, a_complex z, double a)
 complex number z raised to real power a
 
void a_complex_pow_real_ (a_complex *ctx, double a)
 
void a_complex_exp (a_complex *ctx, a_complex z)
 computes the complex base-e exponential
 
void a_complex_exp_ (a_complex *ctx)
 
void a_complex_log (a_complex *ctx, a_complex z)
 computes the complex natural logarithm
 
void a_complex_log_ (a_complex *ctx)
 
void a_complex_log2 (a_complex *ctx, a_complex z)
 computes the complex base-2 logarithm
 
void a_complex_log2_ (a_complex *ctx)
 
void a_complex_log10 (a_complex *ctx, a_complex z)
 computes the complex base-10 logarithm
 
void a_complex_log10_ (a_complex *ctx)
 
void a_complex_logb (a_complex *ctx, a_complex z, a_complex b)
 computes the complex base-b logarithm
 
void a_complex_logb_ (a_complex *ctx, a_complex b)
 
void a_complex_sin (a_complex *ctx, a_complex z)
 computes the complex sine
 
void a_complex_sin_ (a_complex *ctx)
 
void a_complex_cos (a_complex *ctx, a_complex z)
 computes the complex cosine
 
void a_complex_cos_ (a_complex *ctx)
 
void a_complex_tan (a_complex *ctx, a_complex z)
 computes the complex tangent
 
void a_complex_tan_ (a_complex *ctx)
 
void a_complex_sec (a_complex *ctx, a_complex z)
 computes the complex secant
 
void a_complex_sec_ (a_complex *ctx)
 
void a_complex_csc (a_complex *ctx, a_complex z)
 computes the complex cosecant
 
void a_complex_csc_ (a_complex *ctx)
 
void a_complex_cot (a_complex *ctx, a_complex z)
 computes the complex cotangent
 
void a_complex_cot_ (a_complex *ctx)
 
void a_complex_asin (a_complex *ctx, a_complex z)
 computes the complex arc sine
 
void a_complex_asin_ (a_complex *ctx)
 
void a_complex_asin_real (a_complex *ctx, double x)
 
void a_complex_acos (a_complex *ctx, a_complex z)
 computes the complex arc cosine
 
void a_complex_acos_ (a_complex *ctx)
 
void a_complex_acos_real (a_complex *ctx, double x)
 
void a_complex_atan (a_complex *ctx, a_complex z)
 computes the complex arc tangent
 
void a_complex_atan_ (a_complex *ctx)
 
void a_complex_asec (a_complex *ctx, a_complex z)
 computes the complex arc secant
 
void a_complex_asec_ (a_complex *ctx)
 
void a_complex_asec_real (a_complex *ctx, double x)
 
void a_complex_acsc (a_complex *ctx, a_complex z)
 computes the complex arc cosecant
 
void a_complex_acsc_ (a_complex *ctx)
 
void a_complex_acsc_real (a_complex *ctx, double x)
 
void a_complex_acot (a_complex *ctx, a_complex z)
 computes the complex arc cotangent
 
void a_complex_acot_ (a_complex *ctx)
 
void a_complex_sinh (a_complex *ctx, a_complex z)
 computes the complex hyperbolic sine
 
void a_complex_sinh_ (a_complex *ctx)
 
void a_complex_cosh (a_complex *ctx, a_complex z)
 computes the complex hyperbolic cosine
 
void a_complex_cosh_ (a_complex *ctx)
 
void a_complex_tanh (a_complex *ctx, a_complex z)
 computes the complex hyperbolic tangent
 
void a_complex_tanh_ (a_complex *ctx)
 
void a_complex_sech (a_complex *ctx, a_complex z)
 computes the complex hyperbolic secant
 
void a_complex_sech_ (a_complex *ctx)
 
void a_complex_csch (a_complex *ctx, a_complex z)
 computes the complex hyperbolic cosecant
 
void a_complex_csch_ (a_complex *ctx)
 
void a_complex_coth (a_complex *ctx, a_complex z)
 computes the complex hyperbolic cotangent
 
void a_complex_coth_ (a_complex *ctx)
 
void a_complex_asinh (a_complex *ctx, a_complex z)
 computes the complex arc hyperbolic sine
 
void a_complex_asinh_ (a_complex *ctx)
 
void a_complex_acosh (a_complex *ctx, a_complex z)
 computes the complex arc hyperbolic cosine
 
void a_complex_acosh_ (a_complex *ctx)
 
void a_complex_acosh_real (a_complex *ctx, double x)
 
void a_complex_atanh (a_complex *ctx, a_complex z)
 computes the complex arc hyperbolic tangent
 
void a_complex_atanh_ (a_complex *ctx)
 
void a_complex_atanh_real (a_complex *ctx, double x)
 
void a_complex_asech (a_complex *ctx, a_complex z)
 computes the complex arc hyperbolic secant
 
void a_complex_asech_ (a_complex *ctx)
 
void a_complex_acsch (a_complex *ctx, a_complex z)
 computes the complex arc hyperbolic cosecant
 
void a_complex_acsch_ (a_complex *ctx)
 
void a_complex_acoth (a_complex *ctx, a_complex z)
 computes the complex arc hyperbolic cotangent
 
void a_complex_acoth_ (a_complex *ctx)
 

Detailed Description

Macro Definition Documentation

◆ A_COMPLEX_C

#define A_COMPLEX_C ( R,
I )
Value:
#define A_FLOAT_C(X)
Definition a.h:735

constructs a complex number constant from real and imaginary parts

◆ a_complex_c

#define a_complex_c ( r,
i )
Value:
#define a_float_c(x)
Definition a.h:782

constructs a complex number from real and imaginary parts

◆ A_COMPLEX_PRI

#define A_COMPLEX_PRI ( RF,
RC,
IF,
IC )
Value:
"(" A_FLOAT_PRI(RF, RC) "," A_FLOAT_PRI(IF, IC) ")"
#define A_FLOAT_PRI(F, C)
Definition a.h:742

format constants for the fprintf family of functions

Function Documentation

◆ a_complex_abs()

double a_complex_abs ( a_complex z)

computes the magnitude of a complex number

Parameters
za complex number
Returns
= \( \sqrt{a^2+b^2} \)

◆ a_complex_abs2()

double a_complex_abs2 ( a_complex z)

computes the squared magnitude of a complex number

Parameters
za complex number
Returns
= \( a^2+b^2 \)

◆ a_complex_acos()

void a_complex_acos ( a_complex * ctx,
a_complex z )

computes the complex arc cosine

Parameters
ctx= \( \arccos(z) \)
za complex number

◆ a_complex_acosh()

void a_complex_acosh ( a_complex * ctx,
a_complex z )

computes the complex arc hyperbolic cosine

\[ \mathrm{arccosh}(z)=\log(z-\sqrt{z^2-1}) \]

Parameters
ctx= \( \mathrm{arccosh}(z) \)
za complex number

◆ a_complex_acot()

void a_complex_acot ( a_complex * ctx,
a_complex z )

computes the complex arc cotangent

\[ \mathrm{arccot}(z)=\mathrm{arctan}(\frac{1}{z}) \]

Parameters
ctx= \( \mathrm{arccot}(z) \)
za complex number

◆ a_complex_acoth()

void a_complex_acoth ( a_complex * ctx,
a_complex z )

computes the complex arc hyperbolic cotangent

\[ \mathrm{arccoth}(z)=\mathrm{arctanh}(\frac{1}{z}) \]

Parameters
ctx= \( \mathrm{arccoth}(z) \)
za complex number

◆ a_complex_acsc()

void a_complex_acsc ( a_complex * ctx,
a_complex z )

computes the complex arc cosecant

\[ \mathrm{arccsc}(z)=\mathrm{arcsin}(\frac{1}{z}) \]

Parameters
ctx= \( \mathrm{arccsc}(z) \)
za complex number

◆ a_complex_acsch()

void a_complex_acsch ( a_complex * ctx,
a_complex z )

computes the complex arc hyperbolic cosecant

\[ \mathrm{arccsch}(z)=\mathrm{arcsinh}(\frac{1}{z}) \]

Parameters
ctx= \( \mathrm{arccsch}(z) \)
za complex number

◆ a_complex_add()

void a_complex_add ( a_complex * ctx,
a_complex x,
a_complex y )

addition of complex numbers

\[ (a+b i)+(c+d i)=(a+c)+(b+d)i \]

Parameters
ctx= \( x + y \)
xcomplex number on the left
ycomplex number on the right

◆ a_complex_arg()

double a_complex_arg ( a_complex z)

computes the phase angle of a complex number

Parameters
za complex number
Returns
= \( \arctan\frac{b}{a} \)

◆ a_complex_asec()

void a_complex_asec ( a_complex * ctx,
a_complex z )

computes the complex arc secant

\[ \mathrm{arcsec}(z)=\mathrm{arccos}(\frac{1}{z}) \]

Parameters
ctx= \( \mathrm{arcsec}(z) \)
za complex number

◆ a_complex_asech()

void a_complex_asech ( a_complex * ctx,
a_complex z )

computes the complex arc hyperbolic secant

\[ \mathrm{arcsech}(z)=\mathrm{arccosh}(\frac{1}{z}) \]

Parameters
ctx= \( \mathrm{arcsech}(z) \)
za complex number

◆ a_complex_asin()

void a_complex_asin ( a_complex * ctx,
a_complex z )

computes the complex arc sine

Parameters
ctx= \( \arcsin(z) \)
za complex number

◆ a_complex_asinh()

void a_complex_asinh ( a_complex * ctx,
a_complex z )

computes the complex arc hyperbolic sine

Parameters
ctx= \( \mathrm{arcsinh}(z) \)
za complex number

◆ a_complex_atan()

void a_complex_atan ( a_complex * ctx,
a_complex z )

computes the complex arc tangent

Parameters
ctx= \( \arctan(z) \)
za complex number

◆ a_complex_atanh()

void a_complex_atanh ( a_complex * ctx,
a_complex z )

computes the complex arc hyperbolic tangent

Parameters
ctx= \( \mathrm{arctanh}(z) \)
za complex number

◆ a_complex_conj()

void a_complex_conj ( a_complex * ctx,
a_complex z )

computes the complex conjugate

Parameters
ctx= \( (a,-b{i}) \)
za complex number

◆ a_complex_cos()

void a_complex_cos ( a_complex * ctx,
a_complex z )

computes the complex cosine

\[ \cos(z)=\frac{\exp(z{i})+\exp(-z{i})}{2} \]

Parameters
ctx= \( \cos(z) \)
za complex number

◆ a_complex_cosh()

void a_complex_cosh ( a_complex * ctx,
a_complex z )

computes the complex hyperbolic cosine

\[ \cosh(z)=\frac{\exp(z)+\exp(-z)}{2} \]

Parameters
ctx= \( \cosh(z) \)
za complex number

◆ a_complex_cot()

void a_complex_cot ( a_complex * ctx,
a_complex z )

computes the complex cotangent

\[ \cot(z)=\frac{1}{\tan(z)} \]

Parameters
ctx= \( \cot(z) \)
za complex number

◆ a_complex_coth()

void a_complex_coth ( a_complex * ctx,
a_complex z )

computes the complex hyperbolic cotangent

\[ \mathrm{coth}(z)=\frac{1}{\tanh(z)} \]

Parameters
ctx= \( \mathrm{coth}(z) \)
za complex number

◆ a_complex_csc()

void a_complex_csc ( a_complex * ctx,
a_complex z )

computes the complex cosecant

\[ \csc(z)=\frac{1}{\sin(z)} \]

Parameters
ctx= \( \csc(z) \)
za complex number

◆ a_complex_csch()

void a_complex_csch ( a_complex * ctx,
a_complex z )

computes the complex hyperbolic cosecant

\[ \mathrm{csch}(z)=\frac{1}{\sinh(z)} \]

Parameters
ctx= \( \mathrm{csch}(z) \)
za complex number

◆ a_complex_div()

void a_complex_div ( a_complex * ctx,
a_complex x,
a_complex y )

division of complex numbers

\[ \frac{(a+b i)}{(c+d i)}=\frac{(a+b i)(c-d i)}{(c+d i)(c-d i)}=\frac{a c+b c i-a d i-b d i^{2}}{c^{2}-(d i)^{2}}=\frac{(a c+b d)+(b c-a d) i}{c^{2}+d^{2}}=\left(\frac{a c+b d}{c^{2}+d^{2}}\right)+\left(\frac{b c-a d}{c^{2}+d^{2}}\right) i \]

Parameters
ctx= \( x \div y \)
xcomplex number on the left
ycomplex number on the right

◆ a_complex_eq()

bool a_complex_eq ( a_complex x,
a_complex y )

complex number x is equal to complex number y

Parameters
xcomplex number on the left
ycomplex number on the right
Returns
result of comparison

◆ a_complex_exp()

void a_complex_exp ( a_complex * ctx,
a_complex z )

computes the complex base-e exponential

Parameters
ctx= \( e^z \)
za complex number

◆ a_complex_inv()

void a_complex_inv ( a_complex * ctx,
a_complex z )

inverse of a complex number

\[ \frac{a-bi}{a^2+b^2}=\left(\frac{a}{a^2+b^2}\right)-\left(\frac{b}{a^2+b^2}\right)i \]

Parameters
ctxinverse or reciprocal \( \frac{1}{z} \)
za complex number

◆ a_complex_log()

void a_complex_log ( a_complex * ctx,
a_complex z )

computes the complex natural logarithm

Parameters
ctx= \( \ln{z} \)
za complex number

◆ a_complex_log10()

void a_complex_log10 ( a_complex * ctx,
a_complex z )

computes the complex base-10 logarithm

Parameters
ctx= \( \lg{z} \)
za complex number

◆ a_complex_log2()

void a_complex_log2 ( a_complex * ctx,
a_complex z )

computes the complex base-2 logarithm

Parameters
ctx= \( \log_{2}{z} \)
za complex number

◆ a_complex_logabs()

double a_complex_logabs ( a_complex z)

computes the natural logarithm of magnitude of a complex number

Parameters
za complex number
Returns
= \( \log\left|x\right| \)

◆ a_complex_logb()

void a_complex_logb ( a_complex * ctx,
a_complex z,
a_complex b )

computes the complex base-b logarithm

Parameters
ctx= \( \log_{b}{z} \)
za complex number
ba complex number

◆ a_complex_mul()

void a_complex_mul ( a_complex * ctx,
a_complex x,
a_complex y )

multiplication of complex numbers

\[ (a+b i)(c+d i)=a c+b c i+a d i+b d i^{2}=(a c-b d)+(b c+a d) i \]

Parameters
ctx= \( x \times y \)
xcomplex number on the left
ycomplex number on the right

◆ a_complex_ne()

bool a_complex_ne ( a_complex x,
a_complex y )

complex number x is not equal to complex number y

Parameters
xcomplex number on the left
ycomplex number on the right
Returns
result of comparison

◆ a_complex_neg()

void a_complex_neg ( a_complex * ctx,
a_complex z )

computes the complex negative

Parameters
ctx= \( (-a,-b{i}) \)
za complex number

◆ a_complex_parse()

unsigned int a_complex_parse ( a_complex * ctx,
char const * str )

parse a string into a complex number

Parameters
ctxpoints to an instance structure for complex number
strcomplex number string to be parsed
Returns
number of parsed characters

◆ a_complex_polar()

void a_complex_polar ( a_complex * ctx,
double rho,
double theta )

constructs a complex number from polar form

Parameters
ctx= \( (\rho\cos\theta,\rho\sin\theta{i}) \)
rhoa distance from a reference point
thetaan angle from a reference direction

◆ a_complex_pow()

void a_complex_pow ( a_complex * ctx,
a_complex z,
a_complex a )

complex number z raised to complex power a

Parameters
ctx= \( z^a \)
za complex number
aa complex number

◆ a_complex_pow_real()

void a_complex_pow_real ( a_complex * ctx,
a_complex z,
double a )

complex number z raised to real power a

Parameters
ctx= \( z^a \)
za complex number
aa real number

◆ a_complex_proj()

void a_complex_proj ( a_complex * ctx,
a_complex z )

computes the projection on Riemann sphere

Parameters
ctx= \( z \) or \( (\inf,\rm{copysign}(0,b)i) \)
za complex number

◆ a_complex_rect()

static void a_complex_rect ( a_complex * ctx,
double real,
double imag )
inlinestatic

constructs a complex number from real and imaginary parts

Parameters
ctx= \( (\rm{Re},\rm{Im}) \)
realreal part of complex number
imagimaginary part of complex number

◆ a_complex_sec()

void a_complex_sec ( a_complex * ctx,
a_complex z )

computes the complex secant

\[ \sec(z)=\frac{1}{\cos(z)} \]

Parameters
ctx= \( \sec(z) \)
za complex number

◆ a_complex_sech()

void a_complex_sech ( a_complex * ctx,
a_complex z )

computes the complex hyperbolic secant

\[ \mathrm{sech}(z)=\frac{1}{\cosh(z)} \]

Parameters
ctx= \( \mathrm{sech}(z) \)
za complex number

◆ a_complex_sin()

void a_complex_sin ( a_complex * ctx,
a_complex z )

computes the complex sine

\[ \sin(z)=\frac{\exp(z{i})-\exp(-z{i})}{2{i}} \]

Parameters
ctx= \( \sin(z) \)
za complex number

◆ a_complex_sinh()

void a_complex_sinh ( a_complex * ctx,
a_complex z )

computes the complex hyperbolic sine

\[ \sinh(z)=\frac{\exp(z)-\exp(-z)}{2} \]

Parameters
ctx= \( \sinh(z) \)
za complex number

◆ a_complex_sqrt()

void a_complex_sqrt ( a_complex * ctx,
a_complex z )

computes the complex square root

Parameters
ctx= \( \sqrt{z} \)
za complex number

◆ a_complex_sub()

void a_complex_sub ( a_complex * ctx,
a_complex x,
a_complex y )

subtraction of complex numbers

\[ (a+b i)-(c+d i)=(a-c)+(b-d)i \]

Parameters
ctx= \( x - y \)
xcomplex number on the left
ycomplex number on the right

◆ a_complex_tan()

void a_complex_tan ( a_complex * ctx,
a_complex z )

computes the complex tangent

\[ \tan(z)=\frac{\sin(z)}{\cos(z)} \]

Parameters
ctx= \( \tan(z) \)
za complex number

◆ a_complex_tanh()

void a_complex_tanh ( a_complex * ctx,
a_complex z )

computes the complex hyperbolic tangent

\[ \tanh(z)=\frac{\sinh(z)}{\cosh(z)} \]

Parameters
ctx= \( \tanh(z) \)
za complex number