complex - STL C++

log10()

Declaration

complex<X> log10(const complex<X>& kqrZ);

Description

This is the friend function log10() for complex numbers. It returns the logarithm base 10 of the complex number kqrZ, where the branch cuts along the negative real axis. The formula for the logarithm base 10 of a complex number z is

log10(z) = log10(e)(ln(abs(z)) + iarg(z))

Header Include

#include <complex>

Example

#include <complex>
#include <iostream>

int main()
{
	using namespace std;

	// Create a complex number and calculate its log base 10
	complex<double> qZ(2.0, 4.0);
	cout << "Complex Number : "<< qZ << endl;
	cout << "The log base 10 is "<< log10(qZ) << endl;

	// Keep the window open
	cin.get();
	return 0;
}

Output

log10() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.