amath
1.8.5
Simple command line calculator
|
Complex numbers math library. More...
Go to the source code of this file.
Classes | |
union | complex |
Functions | |
double | csgn (complex z) |
Complex signum. More... | |
double | cabs (complex z) |
Absolute value of complex number. More... | |
double | creal (complex z) |
Real part of complex number. More... | |
double | cimag (complex z) |
Imaginary part of complex number. More... | |
complex | cpack (double x, double y) |
Pack two real numbers into a complex number. More... | |
complex | cadd (complex a, complex z) |
Addition of two complex numbers. More... | |
complex | csub (complex a, complex z) |
Subtraction of two complex numbers. More... | |
complex | cmul (complex a, complex z) |
Multiplication of two complex numbers. More... | |
complex | cdiv (complex a, complex z) |
Division of two complex numbers. More... | |
complex | cpow (complex x, complex z) |
Complex number raised to a power. More... | |
complex | cceil (complex z) |
Ceiling value of complex number. More... | |
complex | cfloor (complex z) |
Floor value of complex number. More... | |
complex | ctrunc (complex z) |
Truncated value of complex number. More... | |
complex | cround (complex z) |
Division of two complex numbers. More... | |
complex | creci (complex z) |
Reciprocal value of complex number. More... | |
complex | conj (complex z) |
complex | cexp (complex z) |
Returns e to the power of a complex number. More... | |
complex | csqrt (complex z) |
Square root of complex number. More... | |
complex | ccbrt (complex z) |
Cube root of complex number. More... | |
complex | clog (complex z) |
Natural logarithm of a complex number. More... | |
complex | clogb (complex z) |
Base 2 logarithmic value of complex number. More... | |
complex | clog10 (complex z) |
Base 10 logarithmic value of complex number. More... | |
complex | ccos (complex z) |
Cosine of complex number. More... | |
complex | csin (complex z) |
Sine of a complex number. More... | |
complex | ctan (complex z) |
Tangent of a complex number. More... | |
complex | csec (complex z) |
Secant of a complex number. More... | |
complex | ccsc (complex z) |
Cosecant of a complex number. More... | |
complex | ccot (complex z) |
Cotangent of a complex number. More... | |
complex | cacos (complex z) |
Inverse cosine of complex number. More... | |
complex | casin (complex z) |
Inverse sine of complex number. More... | |
complex | catan (complex z) |
Inverse tangent of complex number. More... | |
complex | casec (complex z) |
Inverse secant expressed using complex logarithms: More... | |
complex | cacsc (complex z) |
Inverse cosecant of complex number. More... | |
complex | cacot (complex z) |
Inverse cotangent of complex number. More... | |
complex | ccosh (complex z) |
Hyperbolic cosine of a complex number. More... | |
complex | csinh (complex z) |
Hyperbolic sine of a complex number. More... | |
complex | ctanh (complex z) |
Hyperbolic tangent of a complex number. More... | |
complex | csech (complex z) |
Hyperbolic secant of a complex number. More... | |
complex | ccsch (complex z) |
Hyperbolic secant of a complex number. More... | |
complex | ccoth (complex z) |
Hyperbolic cotangent of a complex number. More... | |
complex | cacosh (complex z) |
Inverse hyperbolic cosine of complex number. More... | |
complex | casinh (complex z) |
Inverse hyperbolic sine of complex number. More... | |
complex | catanh (complex z) |
Inverse hyperbolic tangent of complex number. More... | |
complex | casech (complex z) |
Inverse hyperbolic secant of complex numbers. More... | |
complex | cacsch (complex z) |
Inverse hyperbolic cosecant of complex number. More... | |
complex | cacoth (complex z) |
Inverse hyperbolic cotangent of complex number. More... | |
Complex numbers math library.
Mostly as specified in [IEEE Std 1003.1, 2013 Edition]: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html
Definition in file mathi.h.
double cabs | ( | complex | z | ) |
Inverse cosine of complex number.
Inverse cosine expressed using complex logarithms:
arccos z = -i * log(z + i * sqrt(1 - z * z))
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms
Definition at line 42 of file cacos.c.
References cadd(), clog(), cmul(), cpack(), csqrt(), and csub().
Referenced by ComplexNumber::ArcCosine().
Inverse hyperbolic cosine of complex number.
Inverse hyperbolic cosine expressed using complex logarithms:
acosh(z) = log(z + sqrt(z*z - 1))
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation
Definition at line 42 of file cacosh.c.
References cadd(), clog(), cmul(), cpack(), csqrt(), and csub().
Referenced by ComplexNumber::HypArcCosine().
Inverse cotangent of complex number.
Inverse cotangent expressed using complex logarithms:
arccot z = i/2 * (log(1 - i/z) - log(1 + i/z))
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms
Definition at line 42 of file cacot.c.
References cadd(), cdiv(), clog(), cmul(), cpack(), and csub().
Referenced by ComplexNumber::ArcCotangent().
Inverse hyperbolic cotangent of complex number.
Inverse hyperbolic cotangent expressed using complex logarithms:
acoth(z) = 1/2 * ((log(z + 1) - log(z - 1))
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation
Definition at line 42 of file cacoth.c.
References cadd(), clog(), cmul(), cpack(), and csub().
Referenced by ComplexNumber::HypArcCotangent().
Inverse cosecant of complex number.
Inverse cosecant expressed using complex logarithms:
arccsc z = -i * log(sqr(1 - 1/(z*z)) + i/z)
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms
Definition at line 42 of file cacsc.c.
References cadd(), cdiv(), clog(), cmul(), cpack(), csqrt(), and csub().
Referenced by ComplexNumber::ArcCosecant().
Inverse hyperbolic cosecant of complex number.
Inverse hyperbolic cosecant expressed using complex logarithms:
acsch(z) = log(sqrt(1 + 1 / (z * z)) + 1/z)
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation
Definition at line 42 of file cacsch.c.
References cadd(), clog(), cmul(), cpack(), creci(), and csqrt().
Referenced by ComplexNumber::HypArcCosecant().
Addition of two complex numbers.
Definition at line 120 of file prim.c.
References cimag(), cpack(), and creal().
Referenced by ComplexNumber::Add(), cacos(), cacosh(), cacot(), cacoth(), cacsc(), cacsch(), casec(), casech(), casin(), casinh(), catan(), and catanh().
Inverse secant expressed using complex logarithms:
Inverse secant expressed using complex logarithms:
arcsec z = -i * log(i * sqr(1 - 1/(z*z)) + 1/z)
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms
Definition at line 42 of file casec.c.
References cadd(), cdiv(), clog(), cmul(), cpack(), creci(), csqrt(), and csub().
Referenced by ComplexNumber::ArcSecant().
Inverse hyperbolic secant of complex numbers.
Inverse hyperbolic secant expressed using complex logarithms:
asech(z) = log(sqrt(1 / (z * z) - 1) + 1/z)
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation
Definition at line 42 of file casech.c.
References cadd(), clog(), cmul(), cpack(), creci(), csqrt(), and csub().
Referenced by ComplexNumber::HypArcSecant().
Inverse sine of complex number.
Inverse sine expressed using complex logarithms:
arcsin z = -i * log(iz + sqrt(1 - z*z))
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms
Definition at line 42 of file casin.c.
References cadd(), clog(), cmul(), cpack(), csqrt(), and csub().
Referenced by ComplexNumber::ArcSine().
Inverse hyperbolic sine of complex number.
Inverse hyperbolic sine expressed using complex logarithms:
asinh(z) = log(z + sqrt(z*z + 1))
With branch cuts: -i INF to -i and i to i INF
Domain: -INF to INF Range: -INF to INF
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation
Definition at line 47 of file casinh.c.
References cadd(), clog(), cmul(), cpack(), and csqrt().
Referenced by ComplexNumber::HypArcSine().
Inverse tangent of complex number.
Inverse tangent expressed using complex logarithms:
atan(z) = i/2 * (log(1 - i * z) - log(1 + i * z))
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_trigonometric_functions#Logarithmic_forms
Definition at line 42 of file catan.c.
References cadd(), cdiv(), clog(), cmul(), cpack(), and csub().
Referenced by ComplexNumber::ArcTangent().
Inverse hyperbolic tangent of complex number.
Inverse hyperbolic tangent expressed using complex logarithms:
atanh(z) = 1/2 * ((log(1 + z) - log(1 - z))
More info is available at Wikipedia:
https://wikipedia.org/wiki/Inverse_hyperbolic_function#Logarithmic_representation
Definition at line 42 of file catanh.c.
References cadd(), clog(), cmul(), cpack(), and csub().
Referenced by ComplexNumber::HypArcTangent().
Cube root of complex number.
cbrt z = exp(1/3 * log(z))
More info is available at Wikipedia:
https://wikipedia.org/wiki/Cube_root
Definition at line 41 of file ccbrt.c.
References cexp(), clog(), cmul(), and cpack().
Referenced by ComplexNumber::CubeRoot().
Ceiling value of complex number.
Definition at line 100 of file prim.c.
References ceil(), cimag(), cpack(), and creal().
Referenced by ComplexNumber::Ceiling().
Cosine of complex number.
a+bi real = cos(a) * cosh(b) imag = -sin(a) * sinh(b)
Definition at line 45 of file ccos.c.
References cchsh(), cimag(), cos(), cpack(), creal(), and sin().
Referenced by ComplexNumber::Cosine().
Hyperbolic cosine of a complex number.
a+bi real = cosh(a) * cos(b) imag = sinh(a) * sin(b)
Definition at line 48 of file ccosh.c.
References cchsh(), cimag(), cos(), cpack(), creal(), and sin().
Referenced by ComplexNumber::HypCosine().
Cotangent of a complex number.
Calculated as in Open Office:
a+bi sin(2.0 * a) real = ------------------------------ cosh(2.0 * b) - cos(2.0 * a)
-sinh(2.0 * b) imag = ------------------------------ cosh(2.0 * b) - cos(2.0 * a)
https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMCOT_function
Definition at line 48 of file ccot.c.
References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh().
Referenced by ComplexNumber::Cotangent().
Hyperbolic cotangent of a complex number.
acoth(z) = 0.5 * (log(1 + 1/z) - log(1 - 1/z))
or
a+bi sinh(2.0 * a) real = ---------------------------— cosh(2.0 * a) - cos(2.0 * b)-sin(2.0 * b)imag = ---------------------------— cosh(2.0 * a) - cos(2.0 * b)
Definition at line 50 of file ccoth.c.
References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh().
Referenced by ComplexNumber::HypCotangent().
Cosecant of a complex number.
Calculated as in Open Office:
a+bi 2.0 * sin(a) * cosh(b) real = ------------------------------ cosh(2.0 * b) - cos(2.0 * a)
-2.0 * cos(a) * sinh(b) imag = ------------------------------ cosh(2.0 * b) - cos(2.0 * a)
https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMCSC_function
Definition at line 48 of file ccsc.c.
References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh().
Referenced by ComplexNumber::Cosecant().
Hyperbolic secant of a complex number.
Calculated as in Open Office:
a+bi 2.0 * sinh(a) * cos(b) real = ------------------------------ cosh(2.0 * a) - cos(2.0 * b)
-2.0 * cosh(2.0 * a) * sin(b) imag = ------------------------------ cosh(2.0 * a) - cos(2.0 * b)
https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMCSCH_function
Definition at line 48 of file ccsch.c.
References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh().
Referenced by ComplexNumber::HypCosecant().
Division of two complex numbers.
Definition at line 159 of file prim.c.
References cimag(), cpack(), and creal().
Referenced by cacot(), cacsc(), casec(), catan(), clog10(), clogb(), and ComplexNumber::Div().
Returns e to the power of a complex number.
Definition at line 42 of file cexp.c.
References cimag(), cos(), cpack(), creal(), exp(), and sin().
Referenced by ccbrt().
Floor value of complex number.
Definition at line 90 of file prim.c.
References cimag(), cpack(), creal(), and floor().
Referenced by ComplexNumber::Floor().
double cimag | ( | complex | z | ) |
Imaginary part of complex number.
Definition at line 46 of file prim.c.
Referenced by cabs(), cadd(), cceil(), ccos(), ccosh(), ccot(), ccoth(), ccsc(), ccsch(), cdiv(), cexp(), cfloor(), clog(), cmul(), cpow(), creci(), cround(), csec(), csech(), csgn(), csin(), csinh(), csqrt(), csub(), ctan(), ctanh(), ctrunc(), ComplexNumber::GetDefaultPrecedence(), ComplexNumber::GetImagValue(), ComplexNumber::GetPrecedence(), DecimalSystem::GetText(), PositionalNumeralSystem::GetText(), ComplexNumber::IsInfinite(), ComplexNumber::IsNaN(), ComplexNumber::IsNegative(), ComplexNumber::IsZero(), ComplexNumber::Log(), ComplexNumber::Log10(), ComplexNumber::Log2(), and ComplexNumber::Unary().
Natural logarithm of a complex number.
Definition at line 42 of file clog.c.
References atan2(), cabs(), cimag(), cpack(), creal(), and log().
Referenced by cacos(), cacosh(), cacot(), cacoth(), cacsc(), cacsch(), casec(), casech(), casin(), casinh(), catan(), catanh(), ccbrt(), clog10(), clogb(), and ComplexNumber::Log().
Base 10 logarithmic value of complex number.
log z = log(z) / log(10)
More info is available at Wikipedia:
https://wikipedia.org/wiki/Complex_logarithm
Definition at line 41 of file clog10.c.
References cdiv(), clog(), and cpack().
Referenced by ComplexNumber::Log10().
Base 2 logarithmic value of complex number.
lb z = log(z) / log(2)
More info is available at Wikipedia:
https://wikipedia.org/wiki/Complex_logarithm
Definition at line 41 of file clogb.c.
References cdiv(), clog(), and cpack().
Referenced by ComplexNumber::Log2().
Multiplication of two complex numbers.
Definition at line 140 of file prim.c.
References cimag(), cpack(), and creal().
Referenced by cacos(), cacosh(), cacot(), cacoth(), cacsc(), cacsch(), casec(), casech(), casin(), casinh(), catan(), catanh(), ccbrt(), and ComplexNumber::Mul().
complex cpack | ( | double | x, |
double | y | ||
) |
Pack two real numbers into a complex number.
Definition at line 68 of file prim.c.
Referenced by ComplexNumber::Add(), cacos(), cacosh(), cacot(), cacoth(), cacsc(), cacsch(), cadd(), casec(), casech(), casin(), casinh(), catan(), catanh(), ccbrt(), cceil(), ccos(), ccosh(), ccot(), ccoth(), ccsc(), ccsch(), cdiv(), cexp(), cfloor(), clog(), clog10(), clogb(), cmul(), ComplexNumber::ComplexNumber(), conj(), cpow(), creci(), cround(), csec(), csech(), csin(), csinh(), csqrt(), csub(), ctan(), ctanh(), ctrunc(), ComplexNumber::Div(), ComplexNumber::Mul(), ComplexNumber::Raise(), ComplexNumber::Sub(), and ComplexNumber::Unary().
Complex number raised to a power.
Definition at line 42 of file cpow.c.
References atan2(), cabs(), cimag(), cos(), cpack(), creal(), exp(), log(), pow(), and sin().
Referenced by ComplexNumber::Raise().
double creal | ( | complex | z | ) |
Real part of complex number.
Definition at line 38 of file prim.c.
Referenced by cabs(), cadd(), cceil(), ccos(), ccosh(), ccot(), ccoth(), ccsc(), ccsch(), cdiv(), cexp(), cfloor(), clog(), cmul(), cpow(), creci(), cround(), csec(), csech(), csgn(), csin(), csinh(), csqrt(), csub(), ctan(), ctanh(), ctrunc(), ComplexNumber::GetDefaultPrecedence(), ComplexNumber::GetIntegerValue(), ComplexNumber::GetPrecedence(), ComplexNumber::GetRealValue(), DecimalSystem::GetText(), PositionalNumeralSystem::GetText(), ComplexNumber::IsInfinite(), ComplexNumber::IsNaN(), ComplexNumber::IsNegative(), ComplexNumber::IsZero(), ComplexNumber::Log(), ComplexNumber::Log10(), ComplexNumber::Log2(), ComplexNumber::PureComplexValue(), and ComplexNumber::Unary().
Reciprocal value of complex number.
Definition at line 181 of file prim.c.
References cimag(), conj(), cpack(), and creal().
Referenced by cacsch(), casec(), casech(), and ComplexNumber::Reciprocal().
Division of two complex numbers.
Definition at line 110 of file prim.c.
References cimag(), cpack(), creal(), and round().
Referenced by ComplexNumber::Round().
Secant of a complex number.
Calculated as in Open Office:
https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMSEC_function
a+bi 2.0 * cos(a) * cosh(b) real = ---------------------------— cosh(2.0 * b) + cos(2.0 * a)
2.0 * sin(a) * sinh(b) imag = ---------------------------— cosh(2.0 * b) + cos(2.0 * a)
Definition at line 48 of file csec.c.
References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh().
Referenced by ComplexNumber::Secant().
Hyperbolic secant of a complex number.
Calculated as in Open Office:
https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMSECH_function
a+bi 2.0 * cosh(a) * cos(b) real = ---------------------------— cosh(2.0 * a) + cos(2.0 * b)
-2.0 * sinh(2.0 * a) * sin(b) imag = ---------------------------— cosh(2.0 * a) + cos(2.0 * b)
Definition at line 48 of file csech.c.
References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh().
Referenced by ComplexNumber::HypSecant().
double csgn | ( | complex | z | ) |
Complex signum.
More info is available at Wikipedia:
https://wikipedia.org/wiki/Sign_function#Complex_signum
Definition at line 38 of file csgn.c.
References cimag(), and creal().
Referenced by ComplexNumber::Signum().
Sine of a complex number.
Calculated according to description at wikipedia:
https://wikipedia.org/wiki/Sine#Sine_with_a_complex_argument
a+bi real = sin(a) * cosh(b) imag = cos(a) * sinh(b)
Definition at line 50 of file csin.c.
References cchsh(), cimag(), cos(), cpack(), creal(), and sin().
Referenced by ComplexNumber::Sine().
Hyperbolic sine of a complex number.
Calculated as in Open Office:
https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMSINH_function
a+bi real = sinh(a) * cos(b) imag = cosh(a) * sin(b)
Definition at line 50 of file csinh.c.
References cchsh(), cimag(), cos(), cpack(), creal(), and sin().
Referenced by ComplexNumber::HypSine().
Square root of complex number.
Definition at line 42 of file csqrt.c.
References cabs(), cimag(), cpack(), creal(), fabs(), and sqrt().
Referenced by cacos(), cacosh(), cacsc(), cacsch(), casec(), casech(), casin(), casinh(), and ComplexNumber::SquareRoot().
Subtraction of two complex numbers.
Definition at line 130 of file prim.c.
References cimag(), cpack(), and creal().
Referenced by cacos(), cacosh(), cacot(), cacoth(), cacsc(), casec(), casech(), casin(), catan(), catanh(), and ComplexNumber::Sub().
Tangent of a complex number.
Calculated as in Open Office:
https://wiki.openoffice.org/wiki/Documentation/How_Tos/Calc:_IMTAN_function
a+bi sin(2.0 * a) real = ---------------------------— cos(2.0 * a) + cosh(2.0 * b)sinh(2.0 * b)imag = ---------------------------— cos(2.0 * a) + cosh(2.0 * b)
Definition at line 55 of file ctan.c.
References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh().
Referenced by ComplexNumber::Tangent().
Hyperbolic tangent of a complex number.
a+bi sinh(2.0 * a) real = ---------------------------— cosh(2.0 * a) + cos(2.0 * b)sin(2.0 * b)imag = ---------------------------— cosh(2.0 * a) + cos(2.0 * b)
Definition at line 53 of file ctanh.c.
References cimag(), cos(), cosh(), cpack(), creal(), sin(), and sinh().
Referenced by ComplexNumber::HypTangent().
Truncated value of complex number.
Definition at line 80 of file prim.c.
References cimag(), cpack(), creal(), and trunc().
Referenced by ComplexNumber::Trunc().