code: def msolve(f, x):
      """
      Finds the first root of f(x) to the left of 0.
  
      The x0 and dx below are tailored to get the correct result for our
      particular function --- the general solver often overshoots the first
      solution.
      """
      f = lambdify(x, f)
      x0 = -0.001
      dx = 0.001
      while f(x0 - dx) * f(x0) > 0:
          x0 = x0 - dx
      x_max = x0 - dx
      x_min = x0
      assert f(x_max) > 0
      assert f(x_min) < 0
      for n in range(100):
          x0 = (x_max + x_min) / 2
          if f(x0) > 0:
              x_max = x0
          else:
              x_min = x0
      return x0
  
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 7 for calling a global function with example usage: msolve(f, x) and returns: x0