code: def jacobian(ctx, f, x):
      """
      Calculate the Jacobian matrix of a function at the point x0.
  
      This is the first derivative of a vectorial function:
  
          f : R^m -> R^n with m >= n
      """
      x = ctx.matrix(x)
      h = ctx.sqrt(ctx.eps)
      fx = ctx.matrix(f(*x))
      m = len(fx)
      n = len(x)
      J = ctx.matrix(m, n)
      for j in xrange(n):
          xj = x.copy()
          xj[j] += h
          Jj = (ctx.matrix(f(*xj)) - fx) / h
          for i in xrange(m):
              J[i, j] = Jj[i]
      return J
  
imports: from __future__ import print_function
  from copy import copy
  from ..libmp.backend import xrange
label_desc: Use image node_id 4 for calling a global function with example usage: jacobian(ctx, f, x) and returns: J