Course Test · University: upper level

Complex analysis: RatMath answers

The same twenty exercises, answered with RatMath Core and the Shelf libraries only. The code below was run when this page was built; its output is shown as printed, and compared with the independent answer.

Agrees 20

Libraries used here: core, complex. In this code each library is in scope under its own name (linalg.det, stats.tTest), and Core's names (R, Rational, …) are in scope directly.

  1. 1.ArithmeticAgrees
    Compute (1+2i)(3−i)(1 + 2i)(3 - i) and 1+2i3−i\dfrac{1 + 2i}{3 - i}.
    Independent answer
    3−i+6i−2i2=5+5i3 - i + 6i - 2i^2 = 5 + 5i. (1+2i)(3+i)10=1+7i10\dfrac{(1 + 2i)(3 + i)}{10} = \dfrac{1 + 7i}{10}.
    RatMath code
    [complex.complex("(1 + 2i)*(3 - i)"), complex.complex("(1 + 2i)/(3 - i)")]
    Output
    [5 + 5i, 1/10 + 7/10i]
  2. 2.Polar formAgrees
    Write −1+i-1 + i in polar form.
    Independent answer
    r=2r = \sqrt2, θ=3π/4\theta = 3\pi/4 (second quadrant), i.e. 38\tfrac38 of a full turn: −1+i=2 e3πi/4-1 + i = \sqrt2\,e^{3\pi i/4}.
    RatMath code
    const p = complex.polar("-1 + i");
    [p.modulus, p.argument, p.exactTurn]
    Output
    [1.414213562373095048[76:88], 2.3561944901923449288[4:5], 3/8]
  3. 3.RootsAgrees
    Find the three cube roots of −8-8.
    Independent answer
    −8=8eiπ-8 = 8e^{i\pi}: roots 2ei(π+2kπ)/32e^{i(\pi + 2k\pi)/3}, i.e. 1+i31 + i\sqrt3, −2-2, 1−i31 - i\sqrt3.
    RatMath code
    complex.roots("-8", 3)
    Output
    [1 + 1.73205080757i ± 1.3e-21, -2 + 0i ± 2.5e-21, 1 - 1.73205080757i ± 1.3e-21]
  4. 4.ExponentialAgrees
    Compute e1+ie^{1 + i}.
    Independent answer
    e(cos⁡1+isin⁡1)≈1.4686939+2.2873553ie(\cos1 + i\sin1) \approx 1.4686939 + 2.2873553i.
    RatMath code
    complex.exp("1 + i")
    Output
    1.4686939399 + 2.2873552872i ± 1.7e-21
    exp("pi i") is refused: the text parser reads exact complex rationals only, so eiπe^{i\pi} cannot be asked for directly.
  5. 5.Principal logarithmAgrees
    Find the principal value Log⁡(−1−i)\operatorname{Log}(-1 - i).
    Independent answer
    ln⁡∣−1−i∣+iArg⁡=12ln⁡2−3π4i≈0.3465736−2.3561945i\ln|{-1-i}| + i\operatorname{Arg} = \tfrac12\ln2 - \tfrac{3\pi}{4}i \approx 0.3465736 - 2.3561945i.
    RatMath code
    complex.log("-1 - i")
    Output
    0.3465735903 - 2.3561944902i ± 1.7e-21
  6. 6.Complex powersAgrees
    Find the principal value of iii^i.
    Independent answer
    ii=eiLog⁡i=ei⋅iπ/2=e−π/2≈0.2078796i^i = e^{i\operatorname{Log} i} = e^{i\cdot i\pi/2} = e^{-\pi/2} \approx 0.2078796, a real number.
    RatMath code
    complex.pow("i", "i")
    Output
    0.20787957635 + 0i ± 1.1e-22
  7. 7.Trigonometric functionsAgrees
    Compute sin⁡i\sin i.
    Independent answer
    sin⁡i=e−1−e2i=isinh⁡1≈1.1752012i\sin i = \dfrac{e^{-1} - e}{2i} = i\sinh 1 \approx 1.1752012i.
    RatMath code
    complex.sin("i")
    Output
    0 + 1.17520119364i ± 8.5e-22
  8. 8.Cauchy–Riemann equationsAgrees
    Check that f=(x2−y2)+2xy if = (x^2 - y^2) + 2xy\,i satisfies the Cauchy–Riemann equations.
    Independent answer
    ux=2x=vyu_x = 2x = v_y and uy=−2y=−vxu_y = -2y = -v_x. (It is f=z2f = z^2.)
    RatMath code
    const r = complex.cauchyRiemann("x^2 - y^2", "2*x*y");
    [r.holds, r.ux, r.vy, r.uy, r.vx]
    Output
    [true, "2*x", "2*x", "-2*y", "2*y"]
    cauchyRiemann differentiates both parts and reduces the two residuals to 0; it also returns f′=2x+2yi=2zf' = 2x + 2yi = 2z.
    Fix: ratmath/complex#7, cauchyRiemann(u, v)
  9. 9.Contour integralAgrees
    Compute ∮∣z∣=1dzz\oint_{|z|=1} \dfrac{dz}{z}, counter-clockwise.
    Independent answer
    z=eitz = e^{it}: ∫02πi dt=2πi\int_0^{2\pi} i\,dt = 2\pi i.
    RatMath code
    complex.contourIntegral("1/z", complex.Contour.circle(0, 1))
    Output
    0 + 6.2831853072i ± 7.9e-17
  10. 10.Cauchy's integral formulaAgrees
    Compute ∮∣z∣=2ezz−1 dz\oint_{|z|=2} \dfrac{e^z}{z - 1}\,dz.
    Independent answer
    2πi e1≈17.0794684i2\pi i\,e^1 \approx 17.0794684i.
    RatMath code
    complex.contourIntegral("exp(z)/(z - 1)", complex.Contour.circle(0, 2))
    Output
    0 + 17.0794684453i ± 4.8e-14
  11. 11.Residue at a simple poleAgrees
    Find Res⁡z=i1z2+1\operatorname{Res}_{z=i} \dfrac{1}{z^2 + 1}.
    Independent answer
    12z∣z=i=12i=−i2\dfrac{1}{2z}\Big|_{z=i} = \dfrac1{2i} = -\dfrac i2.
    RatMath code
    complex.residue("1/(z^2 + 1)", "i")
    Output
    0 - 0.5i ± 5.7e-14
  12. 12.Residue at a higher-order poleAgrees
    Find Res⁡z=0ezz3\operatorname{Res}_{z=0} \dfrac{e^z}{z^3}.
    Independent answer
    The coefficient of z2z^2 in eze^z: 12\tfrac12.
    RatMath code
    complex.residue("exp(z)/z^3", 0)
    Output
    0.5 + 0i ± 3.1e-14
  13. 13.Real integral by residuesAgrees
    Evaluate ∫−∞∞dx(1+x2)2\displaystyle\int_{-\infty}^{\infty} \frac{dx}{(1 + x^2)^2}.
    Independent answer
    Double pole at ii in the upper half-plane: Res⁡=ddz(z+i)−2∣i=−2(2i)−3=14i\operatorname{Res} = \dfrac{d}{dz}(z + i)^{-2}\Big|_i = -2(2i)^{-3} = \dfrac{1}{4i}. Integral =2πi⋅14i=π2= 2\pi i\cdot\dfrac1{4i} = \dfrac\pi2.
    RatMath code
    complex.realLineIntegral("1/(x^2 + 1)^2").real
    Output
    { lo: 28976077832308491369/18446744073709551616, hi: 14488038916154245685/9223372036854775808 }
  14. 14.Trigonometric integralAgrees
    Evaluate ∫02πdθ2+cos⁡θ\displaystyle\int_0^{2\pi} \frac{d\theta}{2 + \cos\theta}.
    Independent answer
    With z=eiθz = e^{i\theta} it becomes ∮2 dzi(z2+4z+1)\oint \dfrac{2\,dz}{i(z^2 + 4z + 1)}; the pole inside is −2+3-2 + \sqrt3 with residue 123⋅2i\dfrac{1}{2\sqrt3}\cdot\dfrac2i. Total 2π3≈3.6275987\dfrac{2\pi}{\sqrt3} \approx 3.6275987.
    RatMath code
    complex.trigIntegral("1/(2 + cos(t))").real
    Output
    { lo: 33458692673085710589/9223372036854775808, hi: 16729346336542855295/4611686018427387904 }
  15. 15.Laurent seriesAgrees
    Find the Laurent series of 1z(1−z)\dfrac{1}{z(1 - z)} in 0<∣z∣<10 < |z| < 1, up to z2z^2.
    Independent answer
    1z⋅11−z=1z+1+z+z2+⋯\dfrac1z\cdot\dfrac1{1 - z} = \dfrac1z + 1 + z + z^2 + \cdots: every coefficient from a−1a_{-1} on is 1.
    RatMath code
    const L = complex.laurent("1/(z*(1 - z))", 0, "1/2", { from: -1, to: 2 });
    [-1, 0, 1, 2].map((n) => L.coefficient ? L.coefficient(n) : L.coefficients[n + 1])
    Output
    [1 + 0i ± 1.6e-14, 1 + 0i ± 2.9e-14, 1 + 0i ± 5.2e-14, 1 + 0i ± 5.8e-14]
  16. 16.Classifying singularitiesAgrees
    Locate and classify the singularities of ez(z2+1)2sin⁡z\dfrac{e^z}{(z^2 + 1)^2\sin z} in the square ∣Re⁡z∣,∣Im⁡z∣≤2|\operatorname{Re} z|, |\operatorname{Im} z| \le 2.
    Independent answer
    sin⁡z=0\sin z = 0 at z=0z = 0 only in the square (±π\pm\pi lie outside): a simple pole. (z2+1)2(z^2 + 1)^2 vanishes to order 2 at ±i\pm i: double poles. eze^z never vanishes, so nothing cancels.
    RatMath code
    const r = complex.singularities("exp(z)/((z^2 + 1)^2 * sin(z))", complex.rect([-2, 2], [-2, 2]));
    r.singularities.map((s) => [s.kind, s.order, s.enclosure.center])
    Output
    [["pole", 2, -i], ["pole", 2, i], ["pole", 1, 34111122517574425733/1496577676626844588240573268701473812127674924007424 + 73386374099144628655/1496577676626844588240573268701473812127674924007424i]]
  17. 17.Counting zerosAgrees
    How many zeros does z5+3z+1z^5 + 3z + 1 have in ∣z∣<1|z| < 1?
    Independent answer
    On ∣z∣=1|z| = 1, ∣z5+1∣≤2<3=∣3z∣|z^5 + 1| \le 2 < 3 = |3z|, so by Rouché it has as many zeros as 3z3z: one.
    RatMath code
    complex.countZeros("z^5 + 3z + 1", complex.Contour.circle(0, 1))
    Output
    1
  18. 18.Möbius mapsAgrees
    Under T(z)=z−iz+iT(z) = \dfrac{z - i}{z + i}, find T(0)T(0), T(1)T(1) and T(i)T(i). Where does the real line go?
    Independent answer
    T(0)=−1T(0) = -1, T(1)=1−i1+i=−iT(1) = \dfrac{1 - i}{1 + i} = -i, T(i)=0T(i) = 0. Real xx has ∣x−i∣=∣x+i∣|x - i| = |x + i|, so the real line goes to the unit circle (and the upper half-plane to the disc).
    RatMath code
    const T = complex.mobius(1, "-i", 1, "i");
    [T.apply(0), T.apply(1), T.apply("i")]
    Output
    [-1, -i, 0]
  19. 19.Fixed points and typeAgrees
    Find the fixed points of T(z)=2z+1z+1T(z) = \dfrac{2z + 1}{z + 1} and classify the map.
    Independent answer
    z2+z=2z+1z^2 + z = 2z + 1: z2−z−1=0z^2 - z - 1 = 0, z=1±52z = \tfrac{1 \pm \sqrt5}2. tr⁡2/det⁡=9>4\operatorname{tr}^2/\det = 9 > 4 and real: hyperbolic.
    RatMath code
    const T = complex.mobius(2, 1, 1, 1);
    [T.classify(), ...T.fixedPoints().points]
    Output
    ["hyperbolic", 1.61803398875 + 0i ± 8.5e-22, -0.61803398875 + 0i ± 8.5e-22]
  20. 20.Gamma and zetaAgrees
    Give Γ(12)\Gamma(\tfrac12), ζ(2)\zeta(2) and ζ(−1)\zeta(-1).
    Independent answer
    Γ(12)=π≈1.7724539\Gamma(\tfrac12) = \sqrt\pi \approx 1.7724539; ζ(2)=π2/6≈1.6449341\zeta(2) = \pi^2/6 \approx 1.6449341; ζ(−1)=−112\zeta(-1) = -\tfrac1{12}.
    RatMath code
    [complex.gamma("1/2"), complex.zeta(2), complex.zeta(-1)]
    Output
    [1.7724538509 + 0i ± 1.7e-21, 1.64493406685 + 0i ± 1.7e-21, -0.083333333333 + 0i ± 5.3e-23]