In mathematics, a Fourier series is a way to represent a wave-like function as the sum of simple sine waves. More formally, it decomposes any periodic function or periodic signal into the sum of a set of simple oscillating functions, namely sine and cosine with the harmonics of periods. So, Fourier series are used in the analysis of periodic functions.
import numpy as np
import matplotlib.pyplot as plt
resolution = 0.0001
x = np.arange(-np.pi,np.pi,resolution)
square = np.array(x) ……