complex-le.le · output · proof · check · playground
The question
Given complex numbers as pairs, how do we calculate their sums, products, powers and logarithms? Can sine, cosine and tangent recover the inputs of their corresponding inverse functions?
Historical background
Rafael Bombelli’s 1572 Algebra gave rules for working with quantities involving square roots of negative numbers. The component rules here likewise derive a negative real result by multiplying imaginary terms. University of St Andrews, extracts from Bombelli’s Algebra
What we tell eyemind
The list [A, B] denotes A + Bi. The product’s real part is
A * C - B * D and its imaginary part is A * D + B * C. The
conjugate reverses the sign of the imaginary part. Multiplication by
the conjugate gives the norm, which makes the divisor real. Even
powers square the base and halve the exponent. Odd powers use one
more multiplication.
The polar rules find the modulus and an angle in [0, 2π). A complex
power uses that angle and the real exponential, logarithm, sine and
cosine. A logarithm in a complex base divides two natural logarithms.
The inverse sine and cosine use the same pair of half axes. The inverse
tangent uses a complex logarithm.
What eyemind concludes
For z = 3 + 4i and w = 1 + 2i, the sum is 4 + 6i, the product is −5 + 10i and the ratio is 2.2 − 0.4i. Dividing the product by w recovers z. The norm of the product is 125, the product of the two norms. The program derives i² = −1 and (1+i)⁸ = 16. The principal square root of the real input −1 lies on the imaginary axis. The polar calculation produces the same root up to rounding.
| Polar or inverse calculation | Result, rounded for display |
|---|---|
| e to the power iπ | −1 |
| i to the power i | 0.20787957635 |
| e to the power −π/2 | 0.20787957635 |
| Natural logarithm of −1 | iπ |
| Logarithm of i to base i | 1 |
| Arcsine of 2 | 1.570796 + 1.316958i |
| Arccosine of 2 | −1.316958i |
| Arctangent of 1 + 2i | 1.338973 + 0.402359i |
The answers show each operation with its actual arguments. The quotient takes the earlier product as its first argument. The round-trip answers show the nesting of the two calls.
the computation of divide([-5, 10], [1, 2]) gives [3.0, 4.0].
the computation of sin(asin([2, 0])) gives [1.9999999999999998, 1.0605752387249067e-16].
struct('le:answer', 'binary', 'component arithmetic', 'multiply', [0, 1], [0, 1], [-1, 0])
struct('le:answer', 'binary', 'component arithmetic', 'integer_power', [1, 1], 8, [16, 0])
struct('le:answer', 'unary', 'component arithmetic', 'log', [-1, 0], [0.0, 3.141592653589793])
What the proof establishes
The proof is checked against the compiled Logic Script program. Integer operations stay exact. True division, square roots and elementary functions use floating-point values, so the saved polar and round-trip answers include small rounding residuals.
Try it
node bin/eyemind.js examples/complex-le.le
node bin/eyemind.js --check-proof examples/proof/complex-le.js examples/complex-le.le
Change the base of the eighth power to [0, 1]. The answer becomes
[1, 0].
