Python Program to Plot Lemniscate Curve


This example plots Lemniscate Curve in Python language using numpy and matplotlib library.


In mathematics, Lemniscate curve has general form r2 = a2 cos(2θ) or r2 = a2 sin(2θ).

Lemniscate curve example: r = 4 cos(2θ), r = 9 sin(2θ), r = 16 cos(2θ) etc.

Python Source Code: Lemniscate Curve (Polar Plot)


# Python program to Plot Lemniscate curve
import numpy as np
from matplotlib import pyplot as plt

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

r = 4* np.cos(2 * theta)

plt.polar(theta, r, 'r')

plt.show()

Output

Python Lemniscate Curve
Figure: Python Lemniscate Curve Output