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

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

A complex number is converted to polar coordinates using the cmath.polar() method. It returns a tuple consisting of modulus and phase.<\/p>\n

A complex number in polar coordinates is defined by modulus r and phase angle phi.<\/p>\n

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

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

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

x:<\/strong> This is Required. A number used to calculate the polar coordinates of<\/p>\n

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

Returns a tuple value containing polar coordinates.<\/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 polar coordinates of given complex number (3+4j)  = \r\n(5.0, 0.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 polar coordinates of given complex number (5+2j) = \r\n(5.385164807134504, 0.3805063771123649)<\/pre>\n

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

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