
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
POW Function for Complex Number in C++
pow() or power function is a function used to calculate the power of a number. It is generally used in real numbers. Here, we will see its implementation of complex numbers.
Complex numbers are those numbers that can be represented as A + iB, where A is the real part and B is the complex part of the number.
The functions for the complex number in c++ are defined in the header file <complex.h>. Here, the pow() method for complex numbers is defined. It finds the complex power of a complex number to some power.
The method is applied to complex numbers takes two input parameters first a complex number base(C) and next to the exponent(a). It returns a complex number which C^a.
Input − C = 4 + 3i a = 2
Output − (7, 24)
Example
Program to find pow of complex number
#include <iostream> #include <complex> using namespace std; int main() { complex<double> complexnumber(4, 3); cout<<"Square of (4+ 3i) = "<<pow(complexnumber, 2)<<endl; return 0; }
Output
Square of (4+ 3i) = (7,24)