Complex Number 0.1.2 |
A class template which supports complex numbers. More...
#include <include/ComplexNumber.h>
Public Member Functions | |
ComplexNumber () | |
Default constructor for ComplexNumber. | |
ComplexNumber (const T &real, const T &imaginary) | |
Overloaded constructor for ComplexNumber. | |
ComplexNumber (const ComplexNumber< T > &z) | |
Copy constructor for ComplexNumber. | |
virtual | ~ComplexNumber () |
Default destructor for ComplexNumber. | |
ComplexNumber< T > | operator+ () const |
Unary plus operator. | |
ComplexNumber< T > | operator- () const |
Unary minus operator. | |
template<class U > | |
operator ComplexNumber< U > () const | |
Type conversion operator. | |
template<class U > | |
ComplexNumber< T > & | operator= (const ComplexNumber< U > &z) |
Assingns a ComplexNumber to this ComplexNumber. | |
template<class U > | |
ComplexNumber< T > & | operator= (const U &real) |
Assingns a real number to this ComplexNumber. | |
template<class U > | |
ComplexNumber< T > & | operator+= (const ComplexNumber< U > &z) |
Adds and assigns a ComplexNumber to this. | |
template<class U > | |
ComplexNumber< T > & | operator+= (const U &real) |
Adds and assigns a real value to this. | |
template<class U > | |
ComplexNumber< T > & | operator-= (const ComplexNumber< U > &z) |
Subtracts and assigns a ComplexNumber to this. | |
template<class U > | |
ComplexNumber< T > & | operator-= (const U &real) |
Subtracts and assigns a real value to this. | |
template<class U > | |
ComplexNumber< T > & | operator*= (const ComplexNumber< U > &z) |
Multiplies and assigns a ComplexNumber to this. | |
template<class U > | |
ComplexNumber< T > & | operator*= (const U &real) |
Multiplies and assigns a real value to this. | |
template<class U > | |
ComplexNumber< T > & | operator/= (const ComplexNumber< U > &z) |
Divides and assigns a ComplexNumber to this. | |
template<class U > | |
ComplexNumber< T > & | operator/= (const U &real) |
Divides and assigns a real value to this. | |
T | getReal () const |
Get the real part. | |
T | getImaginary () const |
Get the imaginary part. | |
void | setReal (const T &real) |
Set the real part. | |
void | setImaginary (const T &imaginary) |
Set the imaginary part. | |
template<> | |
const ComplexNumber< double > | i (0, 1) |
Static Public Member Functions | |
static ComplexNumber< T > | polar (const T &r, const T &theta) |
Construct a ComplexNumber from the given polar coordinates. | |
Static Public Attributes | |
static const ComplexNumber < double > | i |
A public constant representing the value . | |
Private Attributes | |
T | real |
The value of the real part of the complex number. | |
T | imaginary |
The value of the non-real part of the complex number. | |
Friends | |
template<class U > | |
std::ostream & | operator<< (std::ostream &out, const ComplexNumber< U > &z) |
Inserts a ComplexNumber into the ostream. | |
template<class U > | |
std::istream & | operator>> (std::istream &in, ComplexNumber< U > &z) |
Extracts a ComplexNumber from the istream. | |
Related Functions | |
(Note that these are not member functions.) | |
template<class T > | |
T | abs (const ComplexNumber< T > &z) |
Absolute value of a ComplexNumber. | |
template<class T > | |
T | abs2 (const ComplexNumber< T > &z) |
Square absolute value of a ComplexNumber. | |
template<class T > | |
T | arg (const ComplexNumber< T > &z) |
Argument of a ComplexNumber. | |
template<class T > | |
T | logabs (const ComplexNumber< T > &z) |
Natural logarithm absolute value of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | conjugate (const ComplexNumber< T > &z) |
Complex conjugate of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | exp (const ComplexNumber< T > &z) |
Exponential function of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | inverse (const ComplexNumber< T > &z) |
Inverse of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | log (const ComplexNumber< T > &z) |
Natural logarithm of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | log (const T &x) |
Natural logarithm of a real value. | |
template<class T > | |
ComplexNumber< T > | log10 (const ComplexNumber< T > &z) |
Logarithm base 10 of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | log10 (const T &x) |
Logarithm base 10 of a real value. | |
template<class T > | |
ComplexNumber< T > | logb (const ComplexNumber< T > &z, const ComplexNumber< T > &b) |
Logarithm base b of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | logb (const ComplexNumber< T > &z, const T &b) |
Logarithm base b of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | logb (const T &x, const ComplexNumber< T > &b) |
Logarithm base b of a real value. | |
template<class T > | |
ComplexNumber< T > | logb (const T &x, const T &b) |
Logarithm base b of a real value. | |
template<class T > | |
ComplexNumber< T > | pow (const ComplexNumber< T > &a, const ComplexNumber< T > &b) |
Exponentiation of ComplexNumbers. | |
template<class T > | |
ComplexNumber< T > | pow (const ComplexNumber< T > &a, const T &b) |
Exponentiation of a ComplexNumber and real value. | |
template<class T > | |
ComplexNumber< T > | pow (const T &a, const ComplexNumber< T > &b) |
Exponentiation of a real value and a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | sqrt (const ComplexNumber< T > &z) |
Square root of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | sqrt (const T &x) |
Square root of a real value. | |
template<class T > | |
ComplexNumber< T > | cbrt (const ComplexNumber< T > &z) |
Cube root of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | nthRoot (const ComplexNumber< T > &z, const int n) |
nth root of a ComplexNumber | |
template<class T > | |
std::vector< ComplexNumber< T > > | nthRoots (const ComplexNumber< T > &z, const int n) |
nth roots of a ComplexNumber | |
template<class T > | |
void | nthRoots (const ComplexNumber< T > &z, std::vector< ComplexNumber< T > > roots, const int n) |
nth roots of a ComplexNumber | |
template<class T > | |
ComplexNumber< T > | sin (const ComplexNumber< T > &z) |
Sine of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | cos (const ComplexNumber< T > &z) |
Cosine of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | tan (const ComplexNumber< T > &z) |
Tangent of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | csc (const ComplexNumber< T > &z) |
Cosecant of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | sec (const ComplexNumber< T > &z) |
Secant of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | cot (const ComplexNumber< T > &z) |
Cotangent of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | asin (const ComplexNumber< T > &z) |
Arcsine of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | asin (const T &x) |
Arcsine of a real value. | |
template<class T > | |
ComplexNumber< T > | acos (const ComplexNumber< T > &z) |
Arccosine of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | acos (const T &x) |
Arccosine of a real value. | |
template<class T > | |
ComplexNumber< T > | atan (const ComplexNumber< T > &z) |
Arctangent of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | atan (const T &x) |
Arctangent of a real value. | |
template<class T > | |
ComplexNumber< T > | acsc (const ComplexNumber< T > &z) |
Arccosecant of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | acsc (const T &x) |
Arccosecant of a real value. | |
template<class T > | |
ComplexNumber< T > | asec (const ComplexNumber< T > &z) |
Arcsecant of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | asec (const T &x) |
Arcsecant of a real value. | |
template<class T > | |
ComplexNumber< T > | acot (const ComplexNumber< T > &z) |
Arccotangent of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | acot (const T &x) |
Arccotangent of a real value. | |
template<class T > | |
ComplexNumber< T > | sinh (const ComplexNumber< T > &z) |
Hyperbolic sine of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | cosh (const ComplexNumber< T > &z) |
Hyperbolic cosine of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | tanh (const ComplexNumber< T > &z) |
Hyperbolic tangent of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | csch (const ComplexNumber< T > &z) |
Hyperbolic cosecant of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | sech (const ComplexNumber< T > &z) |
Hyperbolic secant of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | coth (const ComplexNumber< T > &z) |
Hyperbolic cotangent of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | asinh (const ComplexNumber< T > &z) |
Hyperbolic arsine of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | asinh (const T &x) |
Hyperbolic arsine of a real value. | |
template<class T > | |
ComplexNumber< T > | acosh (const ComplexNumber< T > &z) |
Hyperbolic arcosine of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | acosh (const T &x) |
Hyperbolic arcosine of a real value. | |
template<class T > | |
ComplexNumber< T > | atanh (const ComplexNumber< T > &z) |
Hyperbolic artangent of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | atanh (const T &x) |
Hyperbolic artangent of a real value. | |
template<class T > | |
ComplexNumber< T > | acsch (const ComplexNumber< T > &z) |
Hyperbolic arcosecant of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | acsch (const T &x) |
Hyperbolic arcosecant of a real value. | |
template<class T > | |
ComplexNumber< T > | asech (const ComplexNumber< T > &z) |
Hyperbolic arsecant of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | asech (const T &x) |
Hyperbolic arsecant of a real value. | |
template<class T > | |
ComplexNumber< T > | acoth (const ComplexNumber< T > &z) |
Hyperbolic arcotangent of a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | acoth (const T &x) |
Hyperbolic arcotangent of a real value. | |
template<class T > | |
ComplexNumber< T > | operator+ (const ComplexNumber< T > &lhs, const ComplexNumber< T > &rhs) |
Adds a ComplexNumber to another ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | operator+ (const ComplexNumber< T > &lhs, const T &rhs) |
Adds a real value to a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | operator+ (const T &lhs, const ComplexNumber< T > &rhs) |
Adds a ComplexNumber to a real value. | |
template<class T > | |
ComplexNumber< T > | operator- (const ComplexNumber< T > &lhs, const ComplexNumber< T > &rhs) |
Subtracts a ComplexNumber from another ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | operator- (const ComplexNumber< T > &lhs, const T &rhs) |
Subtracts a real value from a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | operator- (const T &lhs, const ComplexNumber< T > &rhs) |
Subtracts a ComplexNumber from a real value. | |
template<class T > | |
ComplexNumber< T > | operator* (const ComplexNumber< T > &lhs, const ComplexNumber< T > &rhs) |
Multiplies a ComplexNumber by another ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | operator* (const ComplexNumber< T > &lhs, const T &rhs) |
Multiplies a ComplexNumber by a real value. | |
template<class T > | |
ComplexNumber< T > | operator* (const T &lhs, const ComplexNumber< T > &rhs) |
Multiplies a real value by a ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | operator/ (const ComplexNumber< T > &lhs, const ComplexNumber< T > &rhs) |
Divides a ComplexNumber by another ComplexNumber. | |
template<class T > | |
ComplexNumber< T > | operator/ (const ComplexNumber< T > &lhs, const T &rhs) |
Divides a ComplexNumber by a real value. | |
template<class T > | |
ComplexNumber< T > | operator/ (const T &lhs, const ComplexNumber< T > &rhs) |
Divides a real value by a ComplexNumber. | |
template<class T , class U > | |
bool | operator== (const ComplexNumber< T > &lhs, const ComplexNumber< U > &rhs) |
Compares a ComplexNumber to another ComplexNumber. | |
template<class T , class U > | |
bool | operator== (const ComplexNumber< T > &lhs, const U &rhs) |
Compares a ComplexNumber to a real value. | |
template<class T , class U > | |
bool | operator== (const T &lhs, const ComplexNumber< U > &rhs) |
Compares a real value to a ComplexNumber. | |
template<class T , class U > | |
bool | operator!= (const ComplexNumber< T > &lhs, const ComplexNumber< U > &rhs) |
Compares a ComplexNumber to another ComplexNumber. | |
template<class T , class U > | |
bool | operator!= (const ComplexNumber< T > &lhs, const U &rhs) |
Compares a ComplexNumber to a real value. | |
template<class T , class U > | |
bool | operator!= (const T &lhs, const ComplexNumber< U > &rhs) |
Compares a real value to a ComplexNumber. |
A class template which supports complex numbers.
This class template manages numbers on the complex plane, providing a set of operators and corresponding template functions
ComplexNumber::ComplexNumber | ( | ) |
Default constructor for ComplexNumber.
This constructor creates and initializes an empty ComplexNumber, with default values of zero for the real and imaginay parts
Definition at line 74 of file ComplexNumber.cpp.
ComplexNumber::ComplexNumber | ( | const T & | real, |
const T & | imaginary | ||
) |
Overloaded constructor for ComplexNumber.
This constructor creates and initializes a ComplexNumber with the specified real and imaginary values
[in] | real | The value of the real component of this ComplexNumber |
[in] | imaginary | The value of the non-real component of this ComplexNumber |
Definition at line 80 of file ComplexNumber.cpp.
ComplexNumber::ComplexNumber | ( | const ComplexNumber< T > & | z | ) |
Copy constructor for ComplexNumber.
This constructor creates and initializes a copy of a ComplexNumber
[in] | z | The ComplexNumber to be copied |
Definition at line 86 of file ComplexNumber.cpp.
ComplexNumber::~ComplexNumber | ( | ) | [virtual] |
Default destructor for ComplexNumber.
The destructor cleans up memory allocated by ComplexNumber. ComplexNumber does not allocate any memory, and therefore, the destructor does nothing.
Definition at line 92 of file ComplexNumber.cpp.
T ComplexNumber::getImaginary | ( | ) | const |
Get the imaginary part.
Gets the non-real part of this ComplexNumber
Definition at line 229 of file ComplexNumber.cpp.
T ComplexNumber::getReal | ( | ) | const |
Get the real part.
Gets the real part of this ComplexNumber
Definition at line 223 of file ComplexNumber.cpp.
const ComplexNumber< double > ComplexNumber< double >::i | ( | 0 | , |
1 | |||
) |
ComplexNumber::operator ComplexNumber< U > | ( | ) | const |
Type conversion operator.
Returns this ComplexNumber type-casted as a different ComplexNumber
Definition at line 116 of file ComplexNumber.cpp.
ComplexNumber< T > & ComplexNumber::operator*= | ( | const ComplexNumber< U > & | z | ) |
Multiplies and assigns a ComplexNumber to this.
Multiplies this ComplexNumber by another ComplexNumber and assigns the product to this ComplexNumber
[in] | z | The ComplexNumber by which this ComplexNumber will be multiplied |
Definition at line 178 of file ComplexNumber.cpp.
ComplexNumber< T > & ComplexNumber::operator*= | ( | const U & | real | ) |
Multiplies and assigns a real value to this.
Multiplies this ComplexNumber by a real value and assigns the product to this ComplexNumber
[in] | real | The real value by which this ComplexNumber will be multiplied |
Definition at line 187 of file ComplexNumber.cpp.
ComplexNumber< T > ComplexNumber::operator+ | ( | ) | const |
Unary plus operator.
Returns the positive of this ComplexNumber
Definition at line 104 of file ComplexNumber.cpp.
ComplexNumber< T > & ComplexNumber::operator+= | ( | const ComplexNumber< U > & | z | ) |
Adds and assigns a ComplexNumber to this.
Adds a ComplexNumber to this ComplexNumber and assigns the sum to this ComplexNumber
[in] | z | The ComplexNumber which will be added to this ComplexNumber |
Definition at line 144 of file ComplexNumber.cpp.
ComplexNumber< T > & ComplexNumber::operator+= | ( | const U & | real | ) |
Adds and assigns a real value to this.
Adds a real value to this ComplexNumber and assigns the sum to this ComplexNumber
[in] | real | The real value which will be added to this ComplexNumber |
Definition at line 153 of file ComplexNumber.cpp.
ComplexNumber< T > ComplexNumber::operator- | ( | ) | const |
Unary minus operator.
Finds the negative of this ComplexNumber and returns it
Definition at line 110 of file ComplexNumber.cpp.
ComplexNumber< T > & ComplexNumber::operator-= | ( | const ComplexNumber< U > & | z | ) |
Subtracts and assigns a ComplexNumber to this.
Subtracts a ComplexNumber from this ComplexNumber and assigns the difference to this ComplexNumber
[in] | z | The ComplexNumber which will be subtracted from this ComplexNumber |
Definition at line 161 of file ComplexNumber.cpp.
ComplexNumber< T > & ComplexNumber::operator-= | ( | const U & | real | ) |
Subtracts and assigns a real value to this.
Subtracts a real value from this ComplexNumber and assigns the difference to this ComplexNumber
[in] | real | The real value which will be subtracted from this ComplexNumber |
Definition at line 170 of file ComplexNumber.cpp.
ComplexNumber< T > & ComplexNumber::operator/= | ( | const ComplexNumber< U > & | z | ) |
Divides and assigns a ComplexNumber to this.
Divides this ComplexNumber by another ComplexNumber and assigns the quotient to this ComplexNumber
[in] | z | The ComplexNumber by which this ComplexNumber will be divided |
DivisionByZeroException | if attempting to divide this ComplexNumber by a ComplexNumber z that is equal to zero, a DivisionByZeroException is thrown |
Definition at line 196 of file ComplexNumber.cpp.
ComplexNumber< T > & ComplexNumber::operator/= | ( | const U & | real | ) |
Divides and assigns a real value to this.
Divides this ComplexNumber by a real value and assigns the quotient to this ComplexNumber
[in] | real | The real value by which this ComplexNumber will be divided |
DivisionByZeroException | if attempting to divide this ComplexNumber by a value real that is equal to zero, a DivisionByZeroException is thrown |
Definition at line 211 of file ComplexNumber.cpp.
ComplexNumber< T > & ComplexNumber::operator= | ( | const ComplexNumber< U > & | z | ) |
Assingns a ComplexNumber to this ComplexNumber.
Assigns a ComplexNumber to this ComplexNumber, copying its private data
[in] | z | The ComplexNumber which will be copied and assigned to this ComplexNumber |
Definition at line 123 of file ComplexNumber.cpp.
ComplexNumber< T > & ComplexNumber::operator= | ( | const U & | real | ) |
Assingns a real number to this ComplexNumber.
Assigns a real number to this ComplexNumber
[in] | real | The real value which will be copied and to this ComplexNumber |
Definition at line 135 of file ComplexNumber.cpp.
ComplexNumber< T > ComplexNumber::polar | ( | const T & | r, |
const T & | theta | ||
) | [static] |
Construct a ComplexNumber from the given polar coordinates.
Converts the polar form of a complex number to the rectangular form used in this class
[in] | r | The magnitude of the complex number |
[in] | theta | The angle of the complex number |
Definition at line 98 of file ComplexNumber.cpp.
void ComplexNumber::setImaginary | ( | const T & | imaginary | ) |
Set the imaginary part.
Sets the non-real part of this ComplexNumber
[in] | imaginary | The value of the non-real component of this ComplexNumber |
Definition at line 241 of file ComplexNumber.cpp.
void ComplexNumber::setReal | ( | const T & | real | ) |
Set the real part.
Sets the real part of this ComplexNumber
[in] | real | The value of the real component of this ComplexNumber |
Definition at line 235 of file ComplexNumber.cpp.
T abs | ( | const ComplexNumber< T > & | z | ) | [related] |
Absolute value of a ComplexNumber.
Computes the absolute value, magnitude, or modulus, of a ComplexNumber
[in] | z | The ComplexNumber of which to compute its absolute value |
Definition at line 73 of file ComplexMath.cpp.
T abs2 | ( | const ComplexNumber< T > & | z | ) | [related] |
Square absolute value of a ComplexNumber.
Computes the square of the absolute value, magnitude or modulus, of a ComplexNumber.
[in] | z | The ComplexNumber of which to compute its squared absolute value |
Definition at line 80 of file ComplexMath.cpp.
ComplexNumber< T > acos | ( | const ComplexNumber< T > & | z | ) | [related] |
Arccosine of a ComplexNumber.
Computes the complex arccosine, or inverse cosine, of a ComplexNumber. This value represents an arclength of a sector of the unit circle .
This is based on the exponential definition of cosine
So, to solve for , we form a quadratic equation
Applying the quadratic formula,
Choosing the positive branch,
[in] | z | The ComplexNumber of which to compute the arccosine |
Definition at line 361 of file ComplexMath.cpp.
ComplexNumber< T > acos | ( | const T & | x | ) | [related] |
Arccosine of a real value.
Computes the complex arccosine, or inverse cosine, of a real value. This value represents an arclength of a sector of the unit circle .
This is based on the exponential definition of cosine
So, to solve for , we form a quadratic equation
Applying the quadratic formula,
Choosing the positive branch,
This can be further simplified to deal with the specific values of that return complex values. Namely, where .
[in] | x | The real value of which to compute the arccosine |
Definition at line 371 of file ComplexMath.cpp.
ComplexNumber< T > acosh | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic arcosine of a ComplexNumber.
Computes the complex hyperbolic arcosine, or inverse hyperbolic cosine, of a ComplexNumber. This value represents an area of a sector of the unit hyperbola .
This is based on the exponential definition of hyperbolic cosine
So, to solve for , we form a quadratic equation
Applying the quadratic formula,
Choosing the positive branch,
[in] | z | The ComplexNumber of which to compute the hyperbolic arcosine |
Definition at line 497 of file ComplexMath.cpp.
ComplexNumber< T > acosh | ( | const T & | x | ) | [related] |
Hyperbolic arcosine of a real value.
Computes the complex hyperbolic arcosine, or inverse hyperbolic cosine, of a real value. This value represents an area of a sector of the unit hyperbola .
This is based on the exponential definition of hyperbolic cosine
So, to solve for , we form a quadratic equation
Applying the quadratic formula,
Choosing the positive branch,
[in] | x | The real value of which to compute the hyperbolic arcosine |
Definition at line 507 of file ComplexMath.cpp.
ComplexNumber< T > acot | ( | const ComplexNumber< T > & | z | ) | [related] |
Arccotangent of a ComplexNumber.
Computes the complex arccotangent, or inverse cotangent, of a ComplexNumber. This value represents an arclength of a sector of the unit circle .
This can be proven using the reciprocal identities as follows,
[in] | z | The ComplexNumber of which to compute the arccotangent |
Definition at line 426 of file ComplexMath.cpp.
ComplexNumber< T > acot | ( | const T & | x | ) | [related] |
Arccotangent of a real value.
Computes the complex arccotangent, or inverse cotangent, of a real value. This value represents an arclength of a sector of the unit circle .
While the domain of the arccotangent function is , this function is included for the sake of completeness.
[in] | x | The real value of which to compute the arccotangent |
Definition at line 432 of file ComplexMath.cpp.
ComplexNumber< T > acoth | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic arcotangent of a ComplexNumber.
Computes the complex hyperbolic arcotangent, or inverse hyperbolic cotangent, of a ComplexNumber. This value represents an area of a sector of the unit hyperbola .
This can be proven using the reciprocal identities as follows,
[in] | z | The ComplexNumber of which to compute the hyperbolic arcotangent |
Definition at line 569 of file ComplexMath.cpp.
ComplexNumber< T > acoth | ( | const T & | x | ) | [related] |
Hyperbolic arcotangent of a real value.
Computes the complex hyperbolic arcotangent, or inverse hyperbolic cotangent, of a real value. This value represents an area of a sector of the unit hyperbola .
This can be proven using the reciprocal identities as follows,
[in] | x | The real value of which to compute the hyperbolic arcotangent |
Definition at line 575 of file ComplexMath.cpp.
ComplexNumber< T > acsc | ( | const ComplexNumber< T > & | z | ) | [related] |
Arccosecant of a ComplexNumber.
Computes the complex arccosecant, or inverse cosecant, of a ComplexNumber. This value represents an arclength of a sector of the unit circle .
This can be proven using the reciprocal identities as follows,
[in] | z | The ComplexNumber of which to compute the arccosecant |
Definition at line 402 of file ComplexMath.cpp.
ComplexNumber< T > acsc | ( | const T & | x | ) | [related] |
Arccosecant of a real value.
Computes the complex arccosecant, or inverse cosecant, of a real value. This value represents an arclength of a sector of the unit circle .
This can be proven using the reciprocal identities as follows,
[in] | x | The real value of which to compute the arccosecant |
Definition at line 408 of file ComplexMath.cpp.
ComplexNumber< T > acsch | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic arcosecant of a ComplexNumber.
Computes the complex hyperbolic arcosecant, or inverse hyperbolic cosecant, of a ComplexNumber. This value represents an area of a sector of the unit hyperbola .
This can be proven using the reciprocal identities as follows,
[in] | z | The ComplexNumber of which to compute the hyperbolic arcosecant |
Definition at line 541 of file ComplexMath.cpp.
ComplexNumber< T > acsch | ( | const T & | x | ) | [related] |
Hyperbolic arcosecant of a real value.
Computes the complex hyperbolic arcosecant, or inverse hyperbolic cosecant, of a real value. This value represents an area of a sector of the unit hyperbola .
This can be proven using the reciprocal identities as follows,
[in] | x | The real value of which to compute the hyperbolic arcosecant |
Definition at line 547 of file ComplexMath.cpp.
T arg | ( | const ComplexNumber< T > & | z | ) | [related] |
Argument of a ComplexNumber.
Computes the argument, the angle between the positive real axis and the vector representing z.
Where
[in] | z | The ComplexNumber of which to compute its argument |
Definition at line 87 of file ComplexMath.cpp.
ComplexNumber< T > asec | ( | const ComplexNumber< T > & | z | ) | [related] |
Arcsecant of a ComplexNumber.
Computes the complex arcsecant, or inverse secant, of a ComplexNumber. This value represents an arclength of a sector of the unit circle .
This can be proven using the reciprocal identities as follows,
[in] | z | The ComplexNumber of which to compute the arcsecant |
Definition at line 414 of file ComplexMath.cpp.
ComplexNumber< T > asec | ( | const T & | x | ) | [related] |
Arcsecant of a real value.
Computes the complex arcsecant, or inverse secant, of a real value. This value represents an arclength of a sector of the unit circle .
This can be proven using the reciprocal identities as follows,
[in] | x | The real value of which to compute the arcsecant |
Definition at line 420 of file ComplexMath.cpp.
ComplexNumber< T > asech | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic arsecant of a ComplexNumber.
Computes the complex hyperbolic arsecant, or inverse hyperbolic secant, of a ComplexNumber. This value represents an area of a sector of the unit hyperbola .
This can be proven using the reciprocal identities as follows,
[in] | z | The ComplexNumber of which to compute the hyperbolic arsecant |
Definition at line 553 of file ComplexMath.cpp.
ComplexNumber< T > asech | ( | const T & | x | ) | [related] |
Hyperbolic arsecant of a real value.
Computes the complex hyperbolic arsecant, or inverse hyperbolic secant, of a real value. This value represents an area of a sector of the unit hyperbola .
This can be proven using the reciprocal identities as follows,
[in] | x | The real value of which to compute the hyperbolic arsecant |
Definition at line 559 of file ComplexMath.cpp.
ComplexNumber< T > asin | ( | const ComplexNumber< T > & | z | ) | [related] |
Arcsine of a ComplexNumber.
Computes the complex arcsine, or inverse sine, of a ComplexNumber. This value represents an arclength of a sector of the unit circle .
This is based on the exponential definition of sine
So, to solve for , we form a quadratic equation
Applying the quadratic formula,
Choosing the positive branch,
[in] | z | The ComplexNumber of which to compute the arcsine |
Definition at line 336 of file ComplexMath.cpp.
ComplexNumber< T > asin | ( | const T & | x | ) | [related] |
Arcsine of a real value.
Computes the complex arcsine, or inverse sine, of a real value. This value represents an arclength of a sector of the unit circle .
This is based on the exponential definition of sine
So, to solve for , we form a quadratic equation
Applying the quadratic formula,
Choosing the positive branch,
This can be further simplified to deal with the specific values of that return complex values. Namely, where .
[in] | x | The real value of which to compute the arcsine |
Definition at line 347 of file ComplexMath.cpp.
ComplexNumber< T > asinh | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic arsine of a ComplexNumber.
Computes the complex hyperbolic arsine, or inverse hyperbolic sine, of a ComplexNumber. This value represents an area of a sector of the unit hyperbola .
This is based on the definition of hyperbolic sine
So, to solve for , we form a quadratic equation
Applying the quadratic formula,
Choosing the positive branch,
[in] | z | The ComplexNumber of which to compute the hyperbolic arsine |
Definition at line 481 of file ComplexMath.cpp.
ComplexNumber< T > asinh | ( | const T & | x | ) | [related] |
Hyperbolic arsine of a real value.
Computes the complex hyperbolic arsine, or inverse hyperbolic sine, of a real value. This value represents an area of a sector of the unit hyperbola .
This is based on the definition of hyperbolic sine
So, to solve for , we form a quadratic equation
Applying the quadratic formula,
Choosing the positive branch,
[in] | x | The real value of which to compute the hyperbolic arsine |
Definition at line 491 of file ComplexMath.cpp.
ComplexNumber< T > atan | ( | const ComplexNumber< T > & | z | ) | [related] |
Arctangent of a ComplexNumber.
Computes the complex arctangent, or inverse tangent, of a ComplexNumber. This value represents an arclength of a sector of the unit circle .
This is based on the exponential definition of tangent
So, to solve for , we form a quadratic equation
Choosing the positive branch,
[in] | z | The ComplexNumber of which to compute the arctangent |
Definition at line 385 of file ComplexMath.cpp.
ComplexNumber< T > atan | ( | const T & | x | ) | [related] |
Arctangent of a real value.
Computes the complex arctangent, or inverse tangent, of a real value. This value represents an arclength of a sector of the unit circle .
While the domain of the arctangent function is , this function is included for the sake of completeness.
[in] | x | The real value of which to compute the arctangent |
Definition at line 396 of file ComplexMath.cpp.
ComplexNumber< T > atanh | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic artangent of a ComplexNumber.
Computes the complex hyperbolic artangent, or inverse hyperbolic tangent, of a ComplexNumber. This value represents an area of a sector of the unit hyperbola .
This is based on the exponential definition of hyperbolic tangent
So, to solve for , we form a quadratic equation
Choosing the positive branch,
[in] | z | The ComplexNumber of which to compute the hyperbolic artangent |
Definition at line 521 of file ComplexMath.cpp.
ComplexNumber< T > atanh | ( | const T & | x | ) | [related] |
Hyperbolic artangent of a real value.
Computes the complex hyperbolic artangent, or inverse hyperbolic tangent, of a real value. This value represents an area of a sector of the unit hyperbola .
This is based on the exponential definition of hyperbolic tangent
So, to solve for , we form a quadratic equation
Choosing the positive branch,
[in] | x | The real value of which to compute the hyperbolic artangent |
Definition at line 531 of file ComplexMath.cpp.
ComplexNumber< T > cbrt | ( | const ComplexNumber< T > & | z | ) | [related] |
Cube root of a ComplexNumber.
Computes the principle cube root of a ComplexNumber.
If , where and , then
This is a result of de Moivre's formula,
which can be proven by Euler's formula,
and the rules of exponentiation,
So,
[in] | z | The ComplexNumber of which to compute the cube root |
Definition at line 242 of file ComplexMath.cpp.
ComplexNumber< T > conjugate | ( | const ComplexNumber< T > & | z | ) | [related] |
Complex conjugate of a ComplexNumber.
Finds the complex conjugate of a ComplexNumber
[in] | z | The ComplexNumber of which to find the complex conjugate. |
Definition at line 105 of file ComplexMath.cpp.
ComplexNumber< T > cos | ( | const ComplexNumber< T > & | z | ) | [related] |
Cosine of a ComplexNumber.
Computes the complex cosine of a ComplexNumber.
This is a result of the addition or subtraction theorems or formulae, which can be proven by Euler's formula, , and by noting the symmetry of the sine and cosine functions as follows,
Thus,
Since, by the exponential definitions of the trigonometric functions derived from Euler's formula and the definitions of the hyperbolic functions,
Then,
[in] | z | The ComplexNumber of which to compute the cosine |
Definition at line 300 of file ComplexMath.cpp.
ComplexNumber< T > cosh | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic cosine of a ComplexNumber.
Computes the complex hyperbolic cosine of a ComplexNumber.
This is a result of the addition or subtraction theorems or formulae,
which can be proven as follows, also noting the symmetry of the hyperbolic sine and hyperbolic cosine functions,
Euler's formula,
Since, by the exponential definitions of the trigonometric functions derived from Euler's formula and the definitions of the hyperbolic functions,
Then,
[in] | z | The ComplexNumber of which to compute the hyperbolic cosine |
Definition at line 445 of file ComplexMath.cpp.
ComplexNumber< T > cot | ( | const ComplexNumber< T > & | z | ) | [related] |
Cotangent of a ComplexNumber.
Computes the complex cotangent of a ComplexNumber.
[in] | z | The ComplexNumber of which to compute the cotangent |
Definition at line 330 of file ComplexMath.cpp.
ComplexNumber< T > coth | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic cotangent of a ComplexNumber.
Computes the complex hyperbolic cotangent of a ComplexNumber.
[in] | z | The ComplexNumber of which to compute the hyperbolic cotangent |
Definition at line 475 of file ComplexMath.cpp.
ComplexNumber< T > csc | ( | const ComplexNumber< T > & | z | ) | [related] |
Cosecant of a ComplexNumber.
Computes the complex cosecant of a ComplexNumber.
[in] | z | The ComplexNumber of which to compute the cosecant |
Definition at line 318 of file ComplexMath.cpp.
ComplexNumber< T > csch | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic cosecant of a ComplexNumber.
Computes the complex hyperbolic cosecant of a ComplexNumber.
[in] | z | The ComplexNumber of which to compute the hyperbolic cosecant |
Definition at line 463 of file ComplexMath.cpp.
ComplexNumber< T > exp | ( | const ComplexNumber< T > & | z | ) | [related] |
Exponential function of a ComplexNumber.
Computes the e raised to a ComplexNumber.
This comes from Euler's formula,
[in] | z | The ComplexNumber to which e is raised |
Definition at line 111 of file ComplexMath.cpp.
ComplexNumber< T > inverse | ( | const ComplexNumber< T > & | z | ) | [related] |
Inverse of a ComplexNumber.
Finds the inverse, or reciprocal, of a ComplexNumber.
[in] | z | The ComplexNumber of which the inverse is to be found |
Definition at line 118 of file ComplexMath.cpp.
ComplexNumber< T > log | ( | const ComplexNumber< T > & | z | ) | [related] |
Natural logarithm of a ComplexNumber.
Computes the natural logarithm of a ComplexNumber.
If , where and , then
[in] | z | The ComplexNumber of which the natural logarithm is to be found |
Definition at line 128 of file ComplexMath.cpp.
ComplexNumber< T > log | ( | const T & | x | ) | [related] |
Natural logarithm of a real value.
Computes the natural logarithm of a real value. This is useful for when .
If , where and , then
For values , and for values .
[in] | x | The real value of which the natural logarithm is to be found |
Definition at line 137 of file ComplexMath.cpp.
ComplexNumber< T > log10 | ( | const ComplexNumber< T > & | z | ) | [related] |
Logarithm base 10 of a ComplexNumber.
Computes the base 10 logarithm of a ComplexNumber.
If , where and , then
This uses the change of base formula, which says
By the definition of a logarithm,
and using the base logarithm,
Since the natural logarithm is defined by the standard C library, and the desired base is 10, we use and .
[in] | z | The ComplexNumber of which the natural logarithm is to be found |
Definition at line 146 of file ComplexMath.cpp.
ComplexNumber< T > log10 | ( | const T & | x | ) | [related] |
Logarithm base 10 of a real value.
Computes the base 10 logarithm of a real value. This is useful for when .
If , where and , then
This uses the change of base formula, which says
By the definition of a logarithm,
and using the base logarithm,
Since the natural logarithm is defined by the standard C library, and the desired base is 10, we use and .
[in] | x | The real value of which the natural logarithm is to be found |
Definition at line 152 of file ComplexMath.cpp.
T logabs | ( | const ComplexNumber< T > & | z | ) | [related] |
Natural logarithm absolute value of a ComplexNumber.
Computes the natural logarithm of the absolute value, magnitude, or modulus of a ComplexNumber.
[in] | z | The ComplexNumber of which to compute the natural logarithm of its absolute value |
Definition at line 96 of file ComplexMath.cpp.
ComplexNumber< T > logb | ( | const ComplexNumber< T > & | z, |
const ComplexNumber< T > & | b | ||
) | [related] |
Logarithm base b of a ComplexNumber.
Computes the complex base b logarithm of a ComplexNumber.
If and , where and and and , then
This uses the change of base formula, which says
By the definition of a logarithm,
and using the base logarithm,
Since the natural logarithm is defined by the standard C library, and the desired base is b, we use and .
[in] | z | The ComplexNumber of which the logarithm base b is to be found |
[in] | b | The ComplexNumber that is the base of the logarithm |
Definition at line 162 of file ComplexMath.cpp.
ComplexNumber< T > logb | ( | const ComplexNumber< T > & | z, |
const T & | b | ||
) | [related] |
Logarithm base b of a ComplexNumber.
Computes the real base b logarithm of a ComplexNumber. This is usefule for when .
If and , where and and and , then
This uses the change of base formula, which says
By the definition of a logarithm,
and using the base logarithm,
Since the natural logarithm is defined by the standard C library, and the desired base is b, we use and .
[in] | z | The ComplexNumber of which the logarithm base b is to be found |
[in] | b | The real value that is the base of the logarithm |
Definition at line 168 of file ComplexMath.cpp.
ComplexNumber< T > logb | ( | const T & | x, |
const ComplexNumber< T > & | b | ||
) | [related] |
Logarithm base b of a real value.
Computes the complex base b logarithm of a real value. This is usefule for when .
If and , where and and and , then
This uses the change of base formula, which says
By the definition of a logarithm,
and using the base logarithm,
Since the natural logarithm is defined by the standard C library, and the desired base is b, we use and .
[in] | x | The real value of which the logarithm base b is to be found |
[in] | b | The ComplexNumber that is the base of the logarithm |
Definition at line 174 of file ComplexMath.cpp.
ComplexNumber< T > logb | ( | const T & | x, |
const T & | b | ||
) | [related] |
Logarithm base b of a real value.
Computes the real base b logarithm of a real value. This is useful for when and/or .
If and , where and and and , then
This uses the change of base formula, which says
By the definition of a logarithm,
and using the base logarithm,
Since the natural logarithm is defined by the standard C library, and the desired base is b, we use and .
[in] | x | The real value of which the logarithm base b is to be found |
[in] | b | The real value that is the base of the logarithm |
Definition at line 180 of file ComplexMath.cpp.
ComplexNumber< T > nthRoot | ( | const ComplexNumber< T > & | z, |
const int | n | ||
) | [related] |
nth root of a ComplexNumber
Computes the principle nth root of a ComplexNumber.
If , where and , then
This is a result of de Moivre's formula,
which can be proven by Euler's formula,
and the rules of exponentiation,
So,
[in] | z | The ComplexNumber of which to compute the nth root |
[in] | n | The root to which the ComplexNumber is evaluated |
Definition at line 253 of file ComplexMath.cpp.
std::vector< ComplexNumber< T > > nthRoots | ( | const ComplexNumber< T > & | z, |
const int | n | ||
) | [related] |
nth roots of a ComplexNumber
Computes the nth roots of a ComplexNumber.
If , where and , then
Where
This is a result of de Moivre's formula,
which can be proven by Euler's formula,
and the rules of exponentiation,
So,
[in] | z | The ComplexNumber of which to compute the nth roots |
[in] | n | The root to which the ComplexNumber is evaluated |
Definition at line 267 of file ComplexMath.cpp.
void nthRoots | ( | const ComplexNumber< T > & | z, |
std::vector< ComplexNumber< T > > | roots, | ||
const int | n | ||
) | [related] |
nth roots of a ComplexNumber
Computes the nth roots of a ComplexNumber.
If , where and , then
Where
This is a result of de Moivre's formula,
which can be proven by Euler's formula,
and the rules of exponentiation,
So,
[in] | z | The ComplexNumber of which to compute the nth roots |
[in] | roots | The vector containing the ComplexNumbers that are the nth roots of a ComplexNumber |
[in] | n | The root to which the ComplexNumber is evaluated |
bool operator!= | ( | const ComplexNumber< T > & | lhs, |
const ComplexNumber< U > & | rhs | ||
) | [related] |
Compares a ComplexNumber to another ComplexNumber.
Determines if the ComplexNumber on the left side of the operand is not equal to the ComplexNumber on the right side of the operand
[in] | lhs | The ComplexNumber on the left side of the operand to which the ComplexNumber on the right will be compared |
[in] | rhs | The ComplexNumber on the right side of the operand, which will be compared to the the ComplexNumber on the left side of the operand |
Definition at line 355 of file ComplexNumber.cpp.
bool operator!= | ( | const ComplexNumber< T > & | lhs, |
const U & | rhs | ||
) | [related] |
Compares a ComplexNumber to a real value.
Determines if the ComplexNumber on the left side of the operand is not equal to the real value on the right side of the operand
[in] | lhs | The ComplexNumber on the left side of the operand to which the real value on the right will be compared |
[in] | rhs | The real value on the right side of the operand, which will be compared to the the ComplexNumber on the left side of the operand |
Definition at line 361 of file ComplexNumber.cpp.
bool operator!= | ( | const T & | lhs, |
const ComplexNumber< U > & | rhs | ||
) | [related] |
Compares a real value to a ComplexNumber.
Determines if the real value on the left side of the operand is not equal to the ComplexNumber on the right side of the operand
[in] | lhs | The real value on the left side of the operand to which the ComplexNumber on the right will be compared |
[in] | rhs | The ComplexNumber on the right side of the operand, which will be compared to the the real value on the left side of the operand |
Definition at line 366 of file ComplexNumber.cpp.
ComplexNumber< T > operator* | ( | const ComplexNumber< T > & | lhs, |
const ComplexNumber< T > & | rhs | ||
) | [related] |
Multiplies a ComplexNumber by another ComplexNumber.
Multiplies a ComplexNumber on the left side of the operand by a ComplexNumber on the left side of the operand, returning the resultant product as a third ComplexNumber.
[in] | lhs | The ComplexNumber on the left side of the operand, by which the ComplexNumber on the right side of the operand will be multiplied |
[in] | rhs | The ComplexNumber on the right side of the operand, by which the ComplexNumber on the left side of the operand will be multiplied |
Definition at line 280 of file ComplexNumber.cpp.
ComplexNumber< T > operator* | ( | const ComplexNumber< T > & | lhs, |
const T & | rhs | ||
) | [related] |
Multiplies a ComplexNumber by a real value.
Multiplies the real and imaginary values of the ComplexNumber on the left side of the operand by a real number on the right side of the operand, returning the resultant product as a third ComplexNumber.
[in] | lhs | The ComplexNumber on the left side of the operand, by which the real value on the right side of the operand will be multiplied |
[in] | rhs | The real value on the right side of the operand, by which the ComplexNumber on the left side of the operand will be multiplied |
Definition at line 289 of file ComplexNumber.cpp.
ComplexNumber< T > operator* | ( | const T & | lhs, |
const ComplexNumber< T > & | rhs | ||
) | [related] |
Multiplies a real value by a ComplexNumber.
Multiplies a real value on the left side of the operand by the real and imaginary values of a ComplexNumber on the right side of the operand, returning the resultant product as a third ComplexNumber.
[in] | lhs | The real value on the left side of the operand, by which the ComplexNumber on the right side of the operand will be multiplied |
[in] | rhs | The ComplexNumber on the right side of the operand, by which the ComplexNumber on the left side of the operand will be multiplied |
Definition at line 294 of file ComplexNumber.cpp.
ComplexNumber< T > operator+ | ( | const ComplexNumber< T > & | lhs, |
const ComplexNumber< T > & | rhs | ||
) | [related] |
Adds a ComplexNumber to another ComplexNumber.
Adds the real and imaginary values of a ComplexNumber on the right and left side of the operand, returning the resultant sum as a third ComplexNumber.
[in] | lhs | The ComplexNumber on the left side of the operand, to which the ComplexNumber on the right side of the operand will be added |
[in] | rhs | The ComplexNumber on the right side of the operand, which will be added to the ComplexNumber on the left side of the operand |
Definition at line 246 of file ComplexNumber.cpp.
ComplexNumber< T > operator+ | ( | const ComplexNumber< T > & | lhs, |
const T & | rhs | ||
) | [related] |
Adds a real value to a ComplexNumber.
Adds the real value of a ComplexNumber on the left side of the operand and a real number on the right side of the operand, returning the resultant sum as a third ComplexNumber.
[in] | lhs | The ComplexNumber on the left side of the operand, to which the real value on the right side of the operand will be added |
[in] | rhs | The real value on the right side of the operand, which will be added to the ComplexNumber on the left side of the operand |
Definition at line 253 of file ComplexNumber.cpp.
ComplexNumber< T > operator+ | ( | const T & | lhs, |
const ComplexNumber< T > & | rhs | ||
) | [related] |
Adds a ComplexNumber to a real value.
Adds a real value on the left side of the operand the real value of a ComplexNumber on the right side of the operand, returning the resultant sum as a third ComplexNumber.
[in] | lhs | The real value on the right side of the operand, to which the ComplexNumber on the right side of the operand will be added |
[in] | rhs | The ComplexNumber on the right side of the operand, which will be added to the real value on the left side of the operand |
Definition at line 258 of file ComplexNumber.cpp.
ComplexNumber< T > operator- | ( | const ComplexNumber< T > & | lhs, |
const ComplexNumber< T > & | rhs | ||
) | [related] |
Subtracts a ComplexNumber from another ComplexNumber.
Subtracts the real and imaginary values of a ComplexNumber on the right side of the operand from those of the ComplexNumber on the left side of the operand, returning the resultant difference as a third ComplexNumber.
[in] | lhs | The ComplexNumber on the left side of the operand, from which the ComplexNumber on the right side of the operand will be subtracted |
[in] | rhs | The ComplexNumber on the right side of the operand, which will be subtracted from the ComplexNumber on the left side of the operand |
Definition at line 263 of file ComplexNumber.cpp.
ComplexNumber< T > operator- | ( | const ComplexNumber< T > & | lhs, |
const T & | rhs | ||
) | [related] |
Subtracts a real value from a ComplexNumber.
Subtracts a real value on the right side of the operand from the real value of the ComplexNumber on the left side of the operand, returning the resultant difference as a third ComplexNumber.
[in] | lhs | The ComplexNumber on the left side of the operand, from which the real value on the right side of the operand will be subtracted |
[in] | rhs | The real value on the right side of the operand, which will be subtracted from the ComplexNumber on the left side of the operand |
Definition at line 270 of file ComplexNumber.cpp.
ComplexNumber< T > operator- | ( | const T & | lhs, |
const ComplexNumber< T > & | rhs | ||
) | [related] |
Subtracts a ComplexNumber from a real value.
Subtracts the real value of the ComplexNumber on the right side of the operand from a real value on the left side of the operand, returning the resultant difference as a third ComplexNumber.
[in] | lhs | The real value on the left side of the operand, from which the ComplexNumber on the right side of the operand will be subtracted |
[in] | rhs | The ComplexNumber on the right side of the operand, which will be subtracted from the real value on the left side of the operand |
Definition at line 275 of file ComplexNumber.cpp.
ComplexNumber< T > operator/ | ( | const ComplexNumber< T > & | lhs, |
const ComplexNumber< T > & | rhs | ||
) | [related] |
Divides a ComplexNumber by another ComplexNumber.
Divides the ComplexNumber on the left side of the operand by the ComplexNumber on the right side of the operand, using the complex conjugate of the denominator, returning the resultant quotient as a third ComplexNumber.
[in] | lhs | The ComplexNumber on the left side of the operand, by which the ComplexNumber on the right side of the operand will be divided |
[in] | rhs | The ComplexNumber on the right side of the operand, which will divide the ComplexNumber on the left side of the operand |
DivisionByZeroException | if attempting to divide a ComplexNumber lhs by a ComplexNumber rhs that is equal to zero, a DivisionByZeroException is thrown |
Definition at line 299 of file ComplexNumber.cpp.
ComplexNumber< T > operator/ | ( | const ComplexNumber< T > & | lhs, |
const T & | rhs | ||
) | [related] |
Divides a ComplexNumber by a real value.
Divides the real and imaginary values of a ComplexNumber on the left side of the operand by a real value on the right side of the operand, returning the resultant quotient as a third ComplexNumber.
[in] | lhs | The ComplexNumber on the left side of the operand, by which the real value on the right side of the operand will be divided |
[in] | rhs | The real value on the right side of the operand, which will divide the ComplexNumber on the left side of the operand |
DivisionByZeroException | if attempting to divide a ComplexNumber lhs by a value rhs that is equal to zero, a DivisionByZeroException is thrown |
Definition at line 316 of file ComplexNumber.cpp.
ComplexNumber< T > operator/ | ( | const T & | lhs, |
const ComplexNumber< T > & | rhs | ||
) | [related] |
Divides a real value by a ComplexNumber.
Divides a real value on the left side of the operand by a ComplexNumber on the right side of the operand, returning the resultant quotient as a third ComplexNumber.
[in] | lhs | The real value on the left side of the operand, by which the ComplexNumber on the right side of the operand will be divided |
[in] | rhs | The ComplexNumber on the right side of the operand, which will divide the real value on the left side of the operand |
DivisionByZeroException | if attempting to divide a value lhs by a ComplexNumber rhs that is equal to zero, a DivisionByZeroException is thrown |
Definition at line 325 of file ComplexNumber.cpp.
std::ostream& operator<< | ( | std::ostream & | out, |
const ComplexNumber< U > & | z | ||
) | [friend] |
Inserts a ComplexNumber into the ostream.
Sends a representation of this ComplexNumber into the ostream
[in] | out | The ostream reference into which the ComplexNumber will be inserted |
[in] | z | The ComplexNumber from which the data will be obtained |
Definition at line 371 of file ComplexNumber.cpp.
bool operator== | ( | const ComplexNumber< T > & | lhs, |
const ComplexNumber< U > & | rhs | ||
) | [related] |
Compares a ComplexNumber to another ComplexNumber.
Determines if the ComplexNumber on the left side of the operand is equal to the ComplexNumber on the right side of the operand
[in] | lhs | The ComplexNumber on the left side of the operand to which the ComplexNumber on the right will be compared |
[in] | rhs | The ComplexNumber on the right side of the operand, which will be compared to the the ComplexNumber on the left side of the operand |
Definition at line 339 of file ComplexNumber.cpp.
bool operator== | ( | const ComplexNumber< T > & | lhs, |
const U & | rhs | ||
) | [related] |
Compares a ComplexNumber to a real value.
Determines if the ComplexNumber on the left side of the operand is equal to the real value on the right side of the operand
[in] | lhs | The ComplexNumber on the left side of the operand to which the real value on the right will be compared |
[in] | rhs | The real value on the right side of the operand, which will be compared to the the ComplexNumber on the left side of the operand |
Definition at line 345 of file ComplexNumber.cpp.
bool operator== | ( | const T & | lhs, |
const ComplexNumber< U > & | rhs | ||
) | [related] |
Compares a real value to a ComplexNumber.
Determines if the real value on the left side of the operand is equal to the ComplexNumber on the right side of the operand
[in] | lhs | The real value on the left side of the operand to which the ComplexNumber on the right will be compared |
[in] | rhs | The ComplexNumber on the right side of the operand, which will be compared to the the real value on the left side of the operand |
Definition at line 350 of file ComplexNumber.cpp.
std::istream& operator>> | ( | std::istream & | in, |
ComplexNumber< U > & | z | ||
) | [friend] |
Extracts a ComplexNumber from the istream.
Initializes a ComplexNumber from values extracted from the istream
[in] | in | The istream reference from which the ComplexNumber will be extracted |
[in] | z | The ComplexNumber into which the data will be inserted |
Definition at line 383 of file ComplexNumber.cpp.
ComplexNumber< T > pow | ( | const ComplexNumber< T > & | a, |
const ComplexNumber< T > & | b | ||
) | [related] |
Exponentiation of ComplexNumbers.
Computes the exponentiation of a ComplexNumber and another ComplexNumber.
[in] | a | The ComplexNumber that is the base of the exponentiation |
[in] | b | The ComplexNumber that is the exponent of the exponentiation |
Definition at line 186 of file ComplexMath.cpp.
ComplexNumber< T > pow | ( | const ComplexNumber< T > & | a, |
const T & | b | ||
) | [related] |
Exponentiation of a ComplexNumber and real value.
Computes the exponentiation of a ComplexNumber and a real value.
[in] | a | The ComplexNumber that is the base of the exponentiation |
[in] | b | The real value that is the exponent of the exponentiation |
Definition at line 199 of file ComplexMath.cpp.
ComplexNumber< T > pow | ( | const T & | a, |
const ComplexNumber< T > & | b | ||
) | [related] |
Exponentiation of a real value and a ComplexNumber.
Computes the exponentiation of a real value and a ComplexNumber.
[in] | a | The real value that is the base of the exponentiation |
[in] | b | The ComplexNumber that is the exponent of the exponentiation |
Definition at line 208 of file ComplexMath.cpp.
ComplexNumber< T > sec | ( | const ComplexNumber< T > & | z | ) | [related] |
Secant of a ComplexNumber.
Computes the complex secant of a ComplexNumber.
[in] | z | The ComplexNumber of which to compute the secant |
Definition at line 324 of file ComplexMath.cpp.
ComplexNumber< T > sech | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic secant of a ComplexNumber.
Computes the complex hyperbolic secant of a ComplexNumber.
[in] | z | The ComplexNumber of which to compute the hyperbolic secant |
Definition at line 469 of file ComplexMath.cpp.
ComplexNumber< T > sin | ( | const ComplexNumber< T > & | z | ) | [related] |
Sine of a ComplexNumber.
Computes the complex sine of a ComplexNumber.
This is a result of the addition or subtraction theorems or formulae, which can be proven by Euler's formula, , and by noting the symmetry of the sine and cosine functions as follows,
Thus,
Since, by the exponential definitions of the trigonometric functions derived from Euler's formula and the definitions of the hyperbolic functions,
Then,
[in] | z | The ComplexNumber of which to compute the sine |
Definition at line 293 of file ComplexMath.cpp.
ComplexNumber< T > sinh | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic sine of a ComplexNumber.
Computes the complex hyperbolic sine of a ComplexNumber.
This is a result of the addition or subtraction theorems or formulae,
which can be proven as follows, also noting the symmetry of the hyperbolic sine and hyperbolic cosine functions,
Euler's formula,
Since, by the exponential definitions of the trigonometric functions derived from Euler's formula and the definitions of the hyperbolic functions,
Then,
[in] | z | The ComplexNumber of which to compute the hyperbolic sine |
Definition at line 438 of file ComplexMath.cpp.
ComplexNumber< T > sqrt | ( | const ComplexNumber< T > & | z | ) | [related] |
Square root of a ComplexNumber.
Computes the principle square root of a ComplexNumber.
If , where and , then
This is a result of de Moivre's formula,
which can be proven by Euler's formula,
and the rules of exponentiation,
So,
[in] | z | The ComplexNumber of which to compute the square roots |
Definition at line 221 of file ComplexMath.cpp.
ComplexNumber< T > sqrt | ( | const T & | x | ) | [related] |
Square root of a real value.
Computes the principle square root of a real value.
If , the solutions are both real numbers and can be computed as usual.
If , since , we can factor out of the radical and compute the square root of as usual, resulting in imaginary solutions.
[in] | x | The real value of which to compute the square root |
Definition at line 232 of file ComplexMath.cpp.
ComplexNumber< T > tan | ( | const ComplexNumber< T > & | z | ) | [related] |
Tangent of a ComplexNumber.
Computes the complex tangent of a ComplexNumber.
This is a result of the exponential definitions for the trigonometric functions derived from Euler's formula and the definitions of the hyperbolic functions,
Euler's formula,
and the double angle formulae for sine and cosine, which can be proven by either the multiple-angle formulae or the angle sum and difference identities,
So,
Multiplying the numerator and denominator by the complex conjugate of the denominator,
[in] | z | The ComplexNumber of which to compute the tangent |
Definition at line 307 of file ComplexMath.cpp.
ComplexNumber< T > tanh | ( | const ComplexNumber< T > & | z | ) | [related] |
Hyperbolic tangent of a ComplexNumber.
Computes the complex hyperbolic tangent of a ComplexNumber.
This is a result of the definitions for the hyperbolic functions,
Euler's formula,
and the double angle formulae for sine and cosine, which can be proven by either the multiple-angle formulae or the angle sum and difference identities,
So,
Multiplying the numerator and denominator by the complex conjugate of the denominator,
[in] | z | The ComplexNumber of which to compute the hyperbolic tangent |
Definition at line 452 of file ComplexMath.cpp.
const ComplexNumber<double> ComplexNumber::i [static] |
A public constant representing the value .
This constant value is the imaginary unit, , defined as .
Definition at line 495 of file ComplexNumber.h.
T ComplexNumber::imaginary [private] |
The value of the non-real part of the complex number.
This value is the non-real part of the complex number in rectangular form
Definition at line 517 of file ComplexNumber.h.
T ComplexNumber::real [private] |
The value of the real part of the complex number.
This value is the real part of the complex number in rectangular form
Definition at line 509 of file ComplexNumber.h.