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.ArithmeticAgreesCompute and .Independent answer. .RatMath code
[complex.complex("(1 + 2i)*(3 - i)"), complex.complex("(1 + 2i)/(3 - i)")]Output[5 + 5i, 1/10 + 7/10i]
- 2.Polar formAgreesWrite in polar form.Independent answer, (second quadrant), i.e. of a full turn: .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.RootsAgreesFind the three cube roots of .Independent answer: roots , i.e. , , .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.ExponentialAgreesCompute .Independent answer.RatMath code
complex.exp("1 + i")Output1.4686939399 + 2.2873552872i ± 1.7e-21
exp("pi i")is refused: the text parser reads exact complex rationals only, so cannot be asked for directly. - 5.Principal logarithmAgreesFind the principal value .Independent answer.RatMath code
complex.log("-1 - i")Output0.3465735903 - 2.3561944902i ± 1.7e-21
- 6.Complex powersAgreesFind the principal value of .Independent answer, a real number.RatMath code
complex.pow("i", "i")Output0.20787957635 + 0i ± 1.1e-22
- 7.Trigonometric functionsAgreesCompute .Independent answer.RatMath code
complex.sin("i")Output0 + 1.17520119364i ± 8.5e-22
- 8.Cauchy–Riemann equationsAgreesCheck that satisfies the Cauchy–Riemann equations.Independent answerand . (It is .)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"]
cauchyRiemanndifferentiates both parts and reduces the two residuals to 0; it also returns .Fix: ratmath/complex#7,cauchyRiemann(u, v) - 9.Contour integralAgreesCompute , counter-clockwise.Independent answer: .RatMath code
complex.contourIntegral("1/z", complex.Contour.circle(0, 1))Output0 + 6.2831853072i ± 7.9e-17
- 10.Cauchy's integral formulaAgreesCompute .Independent answer.RatMath code
complex.contourIntegral("exp(z)/(z - 1)", complex.Contour.circle(0, 2))Output0 + 17.0794684453i ± 4.8e-14
- 11.Residue at a simple poleAgreesFind .Independent answer.RatMath code
complex.residue("1/(z^2 + 1)", "i")Output0 - 0.5i ± 5.7e-14
- 12.Residue at a higher-order poleAgreesFind .Independent answerThe coefficient of in : .RatMath code
complex.residue("exp(z)/z^3", 0)Output0.5 + 0i ± 3.1e-14
- 13.Real integral by residuesAgreesEvaluate .Independent answerDouble pole at in the upper half-plane: . Integral .RatMath code
complex.realLineIntegral("1/(x^2 + 1)^2").realOutput{ lo: 28976077832308491369/18446744073709551616, hi: 14488038916154245685/9223372036854775808 } - 14.Trigonometric integralAgreesEvaluate .Independent answerWith it becomes ; the pole inside is with residue . Total .RatMath code
complex.trigIntegral("1/(2 + cos(t))").realOutput{ lo: 33458692673085710589/9223372036854775808, hi: 16729346336542855295/4611686018427387904 } - 15.Laurent seriesAgreesFind the Laurent series of in , up to .Independent answer: every coefficient from 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.Classifying singularitiesAgreesLocate and classify the singularities of in the square .Independent answerat only in the square ( lie outside): a simple pole. vanishes to order 2 at : double poles. 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.Counting zerosAgreesHow many zeros does have in ?Independent answerOn , , so by Rouché it has as many zeros as : one.RatMath code
complex.countZeros("z^5 + 3z + 1", complex.Contour.circle(0, 1))Output1
- 18.Möbius mapsAgreesUnder , find , and . Where does the real line go?Independent answer, , . Real has , 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.Fixed points and typeAgreesFind the fixed points of and classify the map.Independent answer: , . 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.Gamma and zetaAgreesGive , and .Independent answer; ; .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]