code: def beale(x):
      """Beale objective function.
  
      Only takes two dimensions and has a global minimum of `0` at
      :code:`f([3,0.5])` Its domain is bounded between :code:`[-4.5, 4.5]`
  
      Parameters
      ----------
      x : numpy.ndarray
          set of inputs of shape :code:`(n_particles, dimensions)`
  
      Returns
      -------
      numpy.ndarray
          computed cost of size :code:`(n_particles, )`
  
      Raises
      ------
      IndexError
          When the input dimensions is greater than what the function
          allows
      ValueError
          When the input is out of bounds with respect to the function
          domain
      """
      if not x.shape[1] == 2:
          raise IndexError(
              "Beale function only takes two-dimensional input."
          )
      if not np.logical_and(x >= -4.5, x <= 4.5).all():
          raise ValueError(
              "Input for Beale function must be within " "[-4.5, 4.5]."
          )
  
      x_ = x[:, 0]
      y_ = x[:, 1]
      j = (
          (1.5 - x_ + x_ * y_) ** 2.0
          + (2.25 - x_ + x_ * y_**2.0) ** 2.0
          + (2.625 - x_ + x_ * y_**3.0) ** 2.0
      )
  
      return j
  
file_path: pyswarms/pyswarms/utils/functions/single_obj.py
imports: import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: beale(x) and returns: j