# **[](https://en.cppreference.com/w/cpp/header/complex)** provides `std::complex` for complex numbers with arithmetic operations, trigonometric functions, and conversions. It's useful for signal processing, control theory, and wave simulations. Operations like `abs()`, `arg()`, `conj()`, `polar()` work on complex numbers just as you'd expect, and they compose with `` functions. ## Example This example performs arithmetic on complex numbers, calculates magnitude and phase, and constructs a complex number from polar form. ```cpp // compile: g++ -std=c++11 -o complexexample complexexample.cpp // run: ./complexexample // description: complex arithmetic and polar form #include #include #include int main() { std::complex z1(3, 4); std::complex z2(1, 2); auto product = z1 * z2; std::cout << "product: " << product << "\n"; std::cout << "magnitude of z1: " << std::abs(z1) << "\n"; std::cout << "phase of z1: " << std::arg(z1) << " radians\n"; auto polar = std::polar(2.0, M_PI / 4); std::cout << "polar(2, pi/4): " << polar << "\n"; return 0; } ```