Python Encyclopedia for Academics
  • Course Outline
  • Artificial Intelligence
    • Data Science Foundation
      • Python Programming
        • Introduction and Basics
          • Variables
          • Print Function
          • Input From User
          • Data Types
          • Type Conversion
        • Operators
          • Arithmetic Operators
          • Relational Operators
          • Bitwise Operators
          • Logical Operators
          • Assignment Operators
          • Compound Operators
          • Membership Operators
          • Identity Operators
      • Numpy
        • Vectors, Matrix
        • Operations on Matrix
        • Mean, Variance, and Standard Deviation
        • Reshaping Arrays
        • Transpose and Determinant of Matrix
      • Pandas
        • Series and DataFrames
        • Slicing, Rows, and Columns
        • Operations on DataFrames
        • Different wayes to creat DataFrame
        • Read, Write Operations with CSV files
      • Matplotlib
        • Graph Basics
        • Format Strings in Plots
        • Label Parameters, Legend
        • Bar Chart, Pie Chart, Histogram, and Scatter Plot
  • Machine Learning Algorithms
    • Regression Analysis In ML
      • Regression Analysis in Machine Learning
      • Proof of Linear Regression Formulas
      • Simple Linear Regression Implementation
      • Multiple Linear Regression
      • Advertising Dataset Example
      • Bike Sharing Dataset
      • Wine Quality Dataset
      • Auto MPG Dataset
    • Classification Algorithms in ML
      • Proof of Logistic Regression
      • Simplified Mathematical Proof of SVM
      • Iris Dataset
  • Machine Learning Laboratory
    • Lab 1: Titanic Dataset
      • Predicting Survival on the Titanic with Machine Learning
    • Lab 2: Dow Jones Index Dataset
      • Dow Jones Index Predictions Using Machine Learning
    • Lab 3: Diabetes Dataset
      • Numpy
      • Pandas
      • Matplotlib
      • Simple Linear Regression
      • Simple Non-linear Regression
      • Performance Matrix
      • Preprocessing
      • Naive Bayes Classification
      • K-Nearest Neighbors (KNN) Classification
      • Decision Tree & Random Forest
      • SVM Classifier
      • Logistic Regression
      • Artificial Neural Network
      • K means Clustering
    • Lab 4: MAGIC Gamma Telescope Dataset
      • Classification in ML-MAGIC Gamma Telescope Dataset
    • Lab 5: Seoul Bike Sharing Demand Dataset
      • Regression in ML-Seoul Bike Sharing Demand Dataset
    • Lab 6: Medical Cost Personal Datasets
      • Predict Insurance Costs with Linear Regression in Python
    • Lab 6: Predict The S&P 500 Index With Machine Learning And Python
      • Predict The S&P 500 Index With Machine Learning And Python
  • Artificial Neural Networks
    • Biological Inspiration vs. Artificial Neurons
    • Review linear algebra and calculus essentials for ANNs
    • Activation Function
  • Mathematics
    • Pre-Calculus
      • Factorials
      • Roots of Polynomials
      • Complex Numbers
      • Polar Coordinates
      • Graph of a Function
    • Calculus 1
      • Limit of a Function
      • Derivative of Function
      • Critical Points
      • Indefinite Integrals
  • Calculus 2
    • 3D Coordinates and Vectors
    • Vectors and Vector Operations
    • Lines and Planes in Space (3D)
    • Partial Derivatives
    • Optimization Problems (Maxima/Minima) in Multivariable Functions
    • Gradient Vectors
  • Engineering Mathematics
    • Laplace Transform
  • Electrical & electronics Eng
    • Resistor
      • Series Resistors
      • Parallel Resistors
    • Nodal Analysis
      • Example 1
      • Example 2
    • Transient State
      • RC Circuit Equations in the s-Domain
      • RL Circuit Equations in the s-Domain
      • LC Circuit Equations in the s-Domain
      • Series RLC Circuit with DC Source
  • Computer Networking
    • Fundamental
      • IPv4 Addressing
      • Network Diagnostics
  • Cybersecurity
    • Classical Ciphers
      • Caesar Cipher
      • Affine Cipher
      • Atbash Cipher
      • Vigenère Cipher
      • Gronsfeld Cipher
      • Alberti Cipher
      • Hill Cipher
Powered by GitBook
On this page
  • 1. What Are Polar Coordinates?
  • 2. Converting Between Cartesian and Polar Coordinates
  • Python Example 1: Convert Polar to Cartesian
  • Python Example 2: Convert Cartesian to Polar
  • 3. Graphing Polar Equations
  • Python Example 3: Plot Polar Equation
  • Python Example 4: Plot Polar Equation
  • Python Example 5: Plot Polar Equation
  • 4. Symmetry in Polar Graphs
  • 5. Area in Polar Coordinates
  • Python Example 6: Area of a Petal of r=sin(2𝜃)
  • 6. Direction of Rotation
  • Keywords
  1. Mathematics
  2. Pre-Calculus

Polar Coordinates

Nerd Cafe

1. What Are Polar Coordinates?

Unlike Cartesian coordinates (x, y), polar coordinates represent a point using:

  • r = the distance from the origin (radius)

  • θ = the angle (in radians or degrees) from the positive x-axis

So a point P is written as:

P=(r,θ)P=(r,θ)P=(r,θ)

2. Converting Between Cartesian and Polar Coordinates

A. Polar ➡️ Cartesian

x=r⋅cos(θ)y=r⋅sin(θ)\begin{matrix} x=r⋅cos(θ) \\ \\ y=r⋅sin(θ) \end{matrix}x=r⋅cos(θ)y=r⋅sin(θ)​

B. Cartesian ➡️ Polar

r=x2+y2θ=tan−1(yx)\begin{matrix} r=\sqrt{x^{2}+y^{2}} \\ \\ \theta=tan^{-1}\left( \frac{y}{x} \right) \end{matrix}r=x2+y2​θ=tan−1(xy​)​

Note: Adjust 𝜃 based on quadrant.

Python Example 1: Convert Polar to Cartesian

import math

# Polar coordinates
r = 5
theta = math.radians(45)  # Convert degrees to radians

# Convert to Cartesian
x = r * math.cos(theta)
y = r * math.sin(theta)

print(f"Cartesian coordinates: x = {x:.2f}, y = {y:.2f}")

Output:

Cartesian coordinates: x = 3.54, y = 3.54

Python Example 2: Convert Cartesian to Polar

import math

# Cartesian coordinates
x, y = 3, 4

# Convert to Polar
r = math.hypot(x, y)
theta = math.atan2(y, x)

print(f"Polar coordinates: r = {r:.2f}, theta = {math.degrees(theta):.2f}°")

Output:

Polar coordinates: r = 5.00, theta = 53.13°

3. Graphing Polar Equations

Common Polar Graphs:

Equation
Shape

r=a

Circle

r=a⋅cos(θ)

Circle shifted

r=a⋅sin(nθ)

Rose curve

r=a+b⋅cos(θ)

Limaçon

r=a⋅ebθ

Spiral (logarithmic)

Python Example 3: Plot Polar Equation

Let’s plot:

r=2+2⋅cos(θ)r=2+2⋅cos(θ)r=2+2⋅cos(θ)
import numpy as np
import matplotlib.pyplot as plt

theta = np.linspace(0, 2 * np.pi, 1000)
r = 2 + 2 * np.cos(theta)

plt.figure(figsize=(6,6))
ax = plt.subplot(111, projection='polar')
ax.plot(theta, r)

plt.title(r'$r = 2 + 2\cos(\theta)$')
plt.show()

Output:

Python Example 4: Plot Polar Equation

Let’s plot:

r=3⋅cos(5θ)r=3⋅cos(5θ)r=3⋅cos(5θ)
import numpy as np
import matplotlib.pyplot as plt

# Plot a Rose Curve: r = a * cos(n * theta)
def plot_polar_equation(a, n):
    theta = np.linspace(0, 2 * np.pi, 1000)
    r = a * np.cos(n * theta)
    plt.polar(theta, r)
    plt.title(f"Rose Curve: r = {a} * cos({n} * θ)")
    plt.show()

plot_polar_equation(3, 5)

Output:

Python Example 5: Plot Polar Equation

Let’s plot:

r=0.5θr=0.5\thetar=0.5θ
def plot_spiral(a):
    theta = np.linspace(0, 4 * np.pi, 1000)  # Cover multiple rotations
    r = a * theta
    plt.polar(theta, r)
    plt.title(f"Spiral: r = {a} * θ")
    plt.show()

plot_spiral(0.5)

Output:

4. Symmetry in Polar Graphs

Symmetry
Test

Polar Axis (x-axis)

Replace 𝜃 with −𝜃

Line 𝜃=𝜋/2

Replace 𝜃 with 𝜋−𝜃

Origin

Replace 𝑟 with −𝑟

5. Area in Polar Coordinates

To find the area under a polar curve:

A=12∫αβr2dθA=\frac{1}{2}\int_{\alpha}^{\beta}r^{2}d\thetaA=21​∫αβ​r2dθ

Python Example 6: Area of a Petal of r=sin(2𝜃)

import sympy as sp

theta = sp.Symbol('theta')
r = sp.sin(2 * theta)

# Area of one petal (0 to pi/2)
area_expr = 0.5 * r**2
area = sp.integrate(area_expr, (theta, 0, sp.pi/2))

print("Area of one petal:", area.evalf())

Output:

Area of one petal: 0.392699081698724

6. Direction of Rotation

In polar plots:

  • Increasing θ: rotates counterclockwise

  • Negative θ: rotates clockwise

  • Negative r: reflects across origin

Keywords

polar coordinates, polar graph, radius and angle, r and theta, cartesian to polar, polar to cartesian, polar equations, plotting polar graphs, area in polar coordinates, rose curve, limaçon, polar symmetry, polar transformation, python polar plot, matplotlib polar, numpy theta, symbolic integration, polar area formula, polar curve analysis, polar math tutorial, nerd cafe

PreviousComplex NumbersNextGraph of a Function

Last updated 2 months ago