function coefficients = divided_difference_coefficients(xs)
  ## Compute divided difference coefficients of `f` at points `xs`.
  ##
  ## INPUTS:
  ##
  ##   * ``xs`` - A vector containing x-coordinates.
  ##
  ## OUTPUTS:
  ##
  ##   * ``coefficients`` - The vector of coefficients such that
  ##     dot(coefficients, f(xs)) == f[xs]. Used to solve linear systems.
  ##

  coefficients = [];

  for xj = xs
    this_coeff = 1;
    for xi = xs
      if (xi != xj)
	this_coeff = this_coeff * (1 / (xj - xi));
      end
    end
    coefficients(end+1) = this_coeff;
  end
end
