function _zpk2tf (z, p, k) {
    // if z is bignumber, convert it to number
    if (z.some((el) => el.type === 'BigNumber')) {
      z = z.map((el) => number(el))
    }
    // if p is bignumber, convert it to number
    if (p.some((el) => el.type === 'BigNumber')) {
      p = p.map((el) => number(el))
    }
    let num = [Complex(1, 0)]
    let den = [Complex(1, 0)]
    for (let i = 0; i < z.length; i++) {
      let zero = z[i]
      if (typeof zero === 'number') zero = Complex(zero, 0)
      num = _multiply(num, [Complex(1, 0), Complex(-zero.re, -zero.im)])
    }
    for (let i = 0; i < p.length; i++) {
      let pole = p[i]
      if (typeof pole === 'number') pole = Complex(pole, 0)
      den = _multiply(den, [Complex(1, 0), Complex(-pole.re, -pole.im)])
    }
    for (let i = 0; i < num.length; i++) {
      num[i] = multiply(num[i], k)
    }
    return [num, den]
  }
Compute the transfer function of a zero-pole-gain model.

Syntax:
     math.zpk2tf(z, p, k)

Examples:
   math.zpk2tf([1, 2], [-1, -2], 1)    // returns [[1, -3, 2], [1, 3, 2]]

See also:
  freqz

@param {Array} z Array of zeros values
@param {Array} p Array of poles values
@param {number} k Gain value
@return {Array} Two dimensional array containing the numerator (first row) and denominator (second row) polynomials