code: def minkowski(u, v, p=2, w=None):
      """
      Compute the Minkowski distance between two 1-D arrays.
  
      The Minkowski distance between 1-D arrays `u` and `v`,
      is defined as
  
      .. math::
  
         {||u-v||}_p = (\\sum{|u_i - v_i|^p})^{1/p}.
  
  
         \\left(\\sum{w_i(|(u_i - v_i)|^p)}\\right)^{1/p}.
  
      Parameters
      ----------
      u : (N,) array_like
          Input array.
      v : (N,) array_like
          Input array.
      p : int
          The order of the norm of the difference :math:`{||u-v||}_p`.
      w : (N,) array_like, optional
          The weights for each value in `u` and `v`. Default is None,
          which gives each value a weight of 1.0
  
      Returns
      -------
      minkowski : double
          The Minkowski distance between vectors `u` and `v`.
  
      Examples
      --------
      >>> from scipy.spatial import distance
      >>> distance.minkowski([1, 0, 0], [0, 1, 0], 1)
      2.0
      >>> distance.minkowski([1, 0, 0], [0, 1, 0], 2)
      1.4142135623730951
      >>> distance.minkowski([1, 0, 0], [0, 1, 0], 3)
      1.2599210498948732
      >>> distance.minkowski([1, 1, 0], [0, 1, 0], 1)
      1.0
      >>> distance.minkowski([1, 1, 0], [0, 1, 0], 2)
      1.0
      >>> distance.minkowski([1, 1, 0], [0, 1, 0], 3)
      1.0
  
      """
      u = _validate_vector(u)
      v = _validate_vector(v)
      if p < 1:
          raise ValueError("p must be at least 1")
      u_v = u - v
      if w is not None:
          w = _validate_weights(w)
          if p == 1:
              root_w = w
          if p == 2:
              # better precision and speed
              root_w = np.sqrt(w)
          else:
              root_w = np.power(w, 1 / p)
          u_v = root_w * u_v
      dist = norm(u_v, ord=p)
      return dist
  
imports: from __future__ import division, print_function, absolute_import
  import warnings
  import numpy
  from functools import partial
  from collections import namedtuple
  from scipy._lib.six import callable, string_types
  from scipy._lib.six import xrange
  from scipy._lib._util import _asarray_validated
  from .None import _distance_wrap
  from .None import _hausdorff
  from ..linalg import norm
  from ..special import rel_entr
label_desc: Use image node_id 18 for calling a global function with example usage: minkowski(u, v, p, w) and returns: dist