{"id":25433,"date":"2021-11-12T14:59:45","date_gmt":"2021-11-12T09:29:45","guid":{"rendered":"https:\/\/python-programs.com\/?p=25433"},"modified":"2021-11-14T15:02:31","modified_gmt":"2021-11-14T09:32:31","slug":"python-cmath-phase-method-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-cmath-phase-method-with-examples\/","title":{"rendered":"Python cmath.phase() Method with Examples"},"content":{"rendered":"

cmath.phase() Method in Python:<\/strong><\/p>\n

The phase of a complex number is returned by the cmath.phase() method.<\/p>\n

The magnitude and angle of a complex number can be expressed. Phase is the angle formed by a vector (representing a complex number) and the positive x-axis.<\/p>\n

Note: It should be noted that the output is always between -\u03c0 and \u03c0.<\/p>\n

Syntax:<\/strong><\/p>\n

cmath.phase(x)<\/pre>\n

Parameters<\/strong><\/p>\n

x:<\/strong> This is Required. The number used to determine the phase of<\/p>\n

Return Value:<\/strong><\/p>\n

Returns a float value that represents a complex number’s phase.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Complex Number = 3+4j<\/pre>\n

Output:<\/strong><\/p>\n

The given complex number's (3+4j) phase value = \r\n0.9272952180016122<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given realpart = 5\r\nGiven imaginary part = 2<\/pre>\n

Output:<\/strong><\/p>\n

The given complex number's (5+2j) phase value = \r\n0.3805063771123649<\/pre>\n

Note:<\/strong> The above input format is for dynamic input.<\/p>\n

cmath.phase() Method with Examples in Python<\/h2>\n