code: def main():
      L = [1]
      for i in range(1, 100):
          L.append(cos(i * x))
          L.append(sin(i * x))
      # next 2 lines equivalent to L = l2_gram_schmidt(L, (x, -pi, pi)), but faster:
      L[0] /= sqrt(2)
      L = [f / sqrt(pi) for f in L]
  
      f = series(L)
      print("Fourier series of the step function")
      pprint(f)
      x0 = msolve(f.diff(x), x)
  
      print("x-value of the maximum:", x0)
      max = f.subs(x, x0).evalf()
      print("y-value of the maximum:", max)
      g = max * pi / 2
      print("Wilbraham-Gibbs constant        :", g.evalf())
      print(
          "Wilbraham-Gibbs constant (exact):",
          Integral(sin(x) / x, (x, 0, pi)).evalf(),
      )
  
file_path: sympy/examples/advanced/gibbs_phenomenon.py
imports: from sympy import var, sqrt, integrate, conjugate, seterr, Abs, pprint, I, pi, sin, cos, sign, lambdify, Integral, S
label_desc: Use image node_id 8 for calling a global function with example usage: main() without return types