Cpow is a library function in the C programming language, used to calculate powers in the field of complex numbers

It was added to the C programming language, together with complex number support, in the C99 standard.

## Contents

## Complex Power FunctionEdit

### IntroductionEdit

In mathematics, complex numbers are often denoted by 'z' .

z = x + iy

In this number 'x' is the real part and 'y' is imaginary part. 'i' is imaginary unit, such that "i^{2} = -1 ".

Complex power is defined by the mathematical operation of exponentiation given by "z_{1}^{z2}" .

In C programming language , library function for this is given by *Cpow*.

#### Header FileEdit

Standard Library Header file : <complex.h>(complex arithmetic)

#### Syntax for functionEdit

```
double complex cpow(double complex x, double complex y);
```

This function calculates the power of real number 'x' raised to y-th power ,where y is a complex number .

In mathematics ,by Euler's formula, e^{ia} = (cos a +i sin a).Here,cos and sin are trigonometric functions.

For x^{ia},

x^{i .a} = e^{i .a ln(x)} = ( cos(a ln(x)) + i sin(a ln(x)) ) ; ln : logarithmic function to the base e.

#### Return ValueEdit

This function shall return the complex power function value.

Returns the complex power of base x raised to the y-th power using the principal branch, whose cuts are along the negative real axis.

### Usage of Cpow functionEdit

```
//Program returns the complex number z3
#include<stdio.h>
#include<complex.h>
#include<math.h>
int main()
{ int x, y, p, q;
double complex z1, z2, z3; //complex variables declaration
scanf("%d %d %d %d", &x, &y, &p, &q);
z1 = (p + q * I);
z2 = (x + y * I);
z3 = cpow (z2, z1);
printf("%f + %f * i\n", creal(z3), cimag(z3));
return 0;
}
```