Usage: tet [--quiet|--silent|-q] tet [-q] --slog|--ate tet [-q] --sroot|--ssrt tet [-q] tet [-q] --slog|--ate tet [-q] --sroot|--ssrt Computes complex tetration F_b(h), where F_b(0) = 1 and F_b(z+1) = b^F_b(z). The three modes concern one equation, b^^h = value (that is, F_b(h) = value): give two of base, height and value, and the third is printed. Each of the two is written as two real numbers, its real part then its imaginary part, or as one complex number: tet 30 1.5 0.5 1 0.7 is tet 30 1.5+0.5i 1+0.7i. mode arguments (after digits) prints like no flag base b, height h value b^^h b^h --slog | --ate base b, value height h: b^^h = value log_b(value) --sroot | --ssrt value, height h base b: b^^h = value value^(1/h) --slog (alias --ate, arc-tetration): super-logarithm. --sroot (alias --ssrt): super-root; the value comes first, the height second. Both verify their answer by computing b^^h again, and fail when there is no solution they can find and verify. The flags may stand anywhere on the command line. Arguments: precision_digits positive integer; number of decimal digits of precision base_re, base_im the base b = base_re + i base_im height_re, height_im the height h = height_re + i height_im value_re, value_im the tetration value to invert, value_re + i value_im base, height, value the same three numbers, each as one complex argument Each of these is a decimal number or a constant expression (quote it for the shell), computed to the precision of the run: numbers 12, -0.5, 1e-30, and i (or j) for the imaginary unit constants the names listed below: pi, e, eta, ... operators + - * / ^ (or **), ^^ for tetration, and brackets products need no sign: 2pi, 3i, 2(1+i) functions the names listed below: sqrt(2), ln(3), tet(b, h), ... A leading sign binds less than ^, and ^ less than ^^; both group from the right: -2^2 = -4, 2^3^2 = 2^9, 2^^3^2 = (2^^3)^2. There are no variables. With four numbers each of them must be real, a complex one is an error: re(z) is the real part of anything. With two numbers each is complex, so 2 1 0.5 0 and 2+i 0.5 are the same base and height. The expression is evaluated twice, with every operation rounded down and with every operation rounded up, until both agree beyond the precision of the run; digits lost to cancellation are added. A value that cancels to nothing at every precision tried is refused, like sin(pi): write 0. A tetration inside an argument is computed by tet itself, to more digits than the run's. Constants (names, meaning): pi, π circle constant e Euler's number tau, τ 2 pi halfpi pi/2 deg, degree one degree in radians, pi/180 sqrtpi, √π square root of pi eta, η, towermax e^(1/e): the largest base whose infinite tower converges towermin e^(-e): the smallest base whose infinite tower converges einv 1/e gelfond Gelfond's constant e^pi gelfondschneider Gelfond-Schneider constant 2^sqrt(2) ramanujan Ramanujan's constant e^(pi sqrt 163) phi, φ, golden golden ratio (1 + sqrt 5)/2 silver silver ratio 1 + sqrt 2 plastic plastic number: x^3 = x + 1 supergolden supergolden ratio: x^3 = x^2 + 1 tribonacci tribonacci constant: x^3 = x^2 + x + 1 sqrt2, √2 square root of 2 sqrt3, √3 square root of 3 sqrt5, √5 square root of 5 ln2 natural logarithm of 2 ln10 natural logarithm of 10 gamma, γ, eulergamma Euler-Mascheroni constant catalan Catalan's constant apery, zeta3 Apery's constant zeta(3) zeta2, basel zeta(2) = pi^2/6 omega, Ω omega constant W(1): omega e^omega = 1 dottie Dottie number: cos x = x lemniscate, ϖ lemniscate constant Gamma(1/4)^2/(2 sqrt(2 pi)) gauss Gauss's constant 1/agm(1, sqrt 2) parabolic universal parabolic constant sqrt 2 + ln(1 + sqrt 2) levy Levy's constant e^(pi^2/(12 ln 2)) khinchin Khinchin's constant gompertz Euler-Gompertz constant soldner Ramanujan-Soldner constant: zero of the logarithmic integral laplace Laplace limit erdosborwein Erdos-Borwein constant: sum of 1/(2^n - 1) cahen Cahen's constant recfib reciprocal Fibonacci constant: sum of 1/F_n niven Niven's constant mertens Meissel-Mertens constant twinprime twin prime constant Functions (z, w complex; x, y real; names with the same meaning share a line): tet tet(b, h) = b^^h, tetration slog, ate slog(b, z): the height h with b^^h = z ssrt, sroot ssrt(z, h): the base b with b^^h = z sqrt square root cbrt cube root, principal value root root(z, n) = z^(1/n), principal value sqr, square square pow, powc pow(z, w) = z^w powf powf(z, x) = z^x, real x powi powi(z, n) = z^n, whole n powu powu(z, n) = z^n, whole n that is not negative exp exponential exp2 exp2(z) = 2^z expf expf(z, x) = x^z, real x ln natural logarithm log log(z) = ln z; log(z, b) = ln z / ln b log2 logarithm to the base 2 log10 logarithm to the base 10 sin sine cos cosine tan tangent cot cotangent sec secant csc cosecant asin, arcsin inverse sine acos, arccos inverse cosine atan, arctan inverse tangent atan2 atan2(y, x): the argument of x + iy, real x and y sinh hyperbolic sine cosh hyperbolic cosine tanh hyperbolic tangent coth hyperbolic cotangent sech hyperbolic secant csch hyperbolic cosecant asinh, arcsinh inverse hyperbolic sine acosh, arccosh inverse hyperbolic cosine atanh, arctanh inverse hyperbolic tangent abs, mag, mod, norm, polar_r, radius absolute value abs2, mag2, norm_sqr, normsq square of the absolute value l1_norm, l1, manhattan, taxicab |re z| + |im z| arg, phase, polar_theta, theta argument, in (-pi, pi] to_polar abs(z) + i arg(z) re, real real part im, imag imaginary part conj, conjugate complex conjugate inv, recip, inverse, finv 1/z sgn, sign, signum z/abs(z), and 0 for 0 cis cis(x) = cos x + i sin x, real x scale scale(z, x) = z x, real x unscale unscale(z, x) = z/x, real x fdiv fdiv(z, w) = z/w complex, rect, new complex(x, y) = x + iy, real x and y polar, from_polar polar(r, t) = r (cos t + i sin t), real r and t floor largest whole number not above, of each part ceil smallest whole number not below, of each part round nearest whole number, halves away from zero, of each part trunc whole number towards zero, of each part frac, fract what trunc leaves, of each part minabs the argument of the smaller absolute value maxabs the argument of the larger absolute value avg avg(z, w) = (z + w)/2 min the smaller of two real numbers max the larger of two real numbers hypot hypot(x, y) = sqrt(x^2 + y^2), real x and y agm arithmetic-geometric mean of two real numbers gamma, tgamma gamma function of a real number (without brackets, gamma is Euler's constant) lgamma logarithm of |gamma(x)|, real x fact, factorial fact(x) = gamma(x + 1), real x digamma logarithmic derivative of the gamma function, real x zeta Riemann zeta function of a real number erf error function of a real number erfc complementary error function of a real number ei exponential integral Ei of a real number li2 dilogarithm of a real number w, lambertw Lambert W, principal branch Output (on stdout): Two lines: real part on line 1, imaginary part on line 2, of the value (of the height with --slog, of the base with --sroot). Diagnostics: Algorithm choice and per-iteration diagnostics print to stderr by default. Use --quiet, --silent or -q, or set SILENT=1 (also t/true/y/yes/on), to suppress progress diagnostics. Fatal errors still print to stderr and exit with nonzero status. Examples: tet 50 2 0 3 0 # 2^^3 = 16, 50 digits tet 50 2 3 # the same, each number as one argument tet 100 e 0 0.5 0 # base e to 100 digits tet 30 1.5 0.5 1 0.7 # complex base, complex height tet 30 1.5+0.5i 1+0.7i # the same tet 30 'pi*e^e-pow(2, 0.5)' 0 '1/3' 0 tet 30 '2^^2' 're(ate(2+i, 1.5-0.5i))' 'pi/e' 'ssrt(16, 3)/4' tet 30 '2^^2 + i*ate(2+i, 1.5-0.5i)' 'pi/e + i*ssrt(16, 3)/4' tet --slog 30 2 0 16 0 # the height h with 2^^h = 16, i.e. 3 tet --slog 30 2 16 # the same tet --sroot 30 16 0 3 0 # the base b with b^^3 = 16, i.e. 2 tet --sroot 30 16 3 # the same