Python Program to Convert Polar to Cartesian Coordinate

In mathematics, a Cartesian coordinate system is a coordinate system that specifies each point uniquely in a plane by a set of numeric points.

Cartesian Coordinates is represented by (x,y).

In mathematics, the polar coordinate system is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a reference point known as radius and an angle from a reference direction known as theta or simply angle.

Polar Coordinates system is represented by (r,θ).

Formula to Convert Polar to Cartesian Coordinate

To convert from Polar Coordinates (r,θ) to Cartesian Coordinates (x,y) :
x = r × cos( θ )
y = r × sin( θ )

This python programs converts Polar Coordinate given by user to Cartesian Coordinate using Polar to Cartesian Conversion Formula.

Also check: Cartesian to Polar Conversion in Python

Python Source Code: Polar to Cartesian Coordinate


# Converting Polar Coordinate to Cartesian Coordinates
# Importing math library
import math

# Reading radius and angle of polar coordinate
radius = float(input('Enter radius: '))
theta = float(input('Enter theta in degree: '))

# Converting theta from degree to radian
theta = theta * math.pi/180.0;

# Converting polar to cartesian coordinates
x = radius * math.cos(theta)
y = radius * math.sin(theta)

# Displaying cartesian coordinates
print('Cartesian coordinate is: (x = %0.2f, y = %0.2f)' %(x,y))

Output of Above Program

Enter radius: 1.4142
Enter theta in degree: 45
Cartesian coordinate is: (x = 1.00, y = 1.00)