Skip to content

Argument of a complex value carries the requested digits under N() - #440

Closed
enumeratio wants to merge 1 commit into
cortex-js:mainfrom
enumeratio:argument-precision
Closed

enumeratio wants to merge 1 commit into
cortex-js:mainfrom
enumeratio:argument-precision

Conversation

@enumeratio

Copy link
Copy Markdown
Contributor

Fix #439.

N(Argument(e + iπ), 25) was 0.8575117863558462702910252, wrong from the 17th digit because the angle was the double atan2 of the parts. We now pass the bignum parts to Arctan2, so it is 0.8575117863558462650068678 (true 0.857511786355846265006867751).
Argument(2 + iπ) at 25 digits was 1.003884821853887179762058 and is 1.003884821853887214148424. Arg is the same operator.
Exact operands, Argument(∞·i) and the compiled JavaScript lane (doubles) are unchanged.

…r N(), as Arctan2 does, so N(Argument(e + iπ), 25) carries 25 digits; add regression tests against mpmath. Fix cortex-js#439
enumeratio added a commit to enumeratio/enumeratio that referenced this pull request Oct 15, 2026
…Argument; settle the remaining rows (#925)

BigDecimal power-series kernels answer N(f, d) for AiryAi/Bi, Ei, li and integer-order Bessel I/J/K/Y once d exceeds a double's digits; a run with 10 more digits must agree, otherwise they decline to the native evaluation. A ce-patch carries Argument of a complex literal through bignum Arctan2 under N (upstream: cortex-js/compute-engine#440). Simplify folds rational expressions in GoldenRatio; fromWolfram reads Range with step 1. The remaining Wolfram triage rows are settled toward Wolfram or classified, none dropped; our-side bugs go to #911.
arnog added a commit that referenced this pull request Oct 15, 2026
… precision, integration gaps

PR #436 (enumeratio, fix #434): the JavaScript target lowers HurwitzZeta,
LerchPhi, PolyLog, EllipticK, the complete EllipticE, Hypergeometric2F1 and
LambertW to the interpreter's complex kernel in `auto` and `complex` mode
where the operand facts do not prove the value real; `strict` keeps the real
kernel and its NaN; a complex operand takes the complex kernel in every mode.
The verdict lives in one place (`complexContinuation`), read by both
`isComplexValued` and the emitters. The GLSL and WGSL targets decline a
provably complex value, now including a positive integer order on the cut
`z > 1` (`PolyLog(2, 3)`, `LerchPhi(3, 2, 1)`). `Arcsec` and `Arccsc` of an
operand of unknown magnitude type `complex | infinity | nan` instead of
`number`, so the compiled lanes read the complex value.

PR #440 (enumeratio, fix #439): `Argument` of a complex value passes the
bignum parts to `Arctan2`, so `N(Argument(e + iπ), 25)` carries 25 digits.
Also from #439: `Transpose` of an operand with no known shape is typed
`unknown` (a union such as `matrix | vector` is transposed member by
member), so `MatrixMultiply(q, Transpose(q))` with a free `q` stays
unevaluated instead of an `incompatible-type` error.

PR #441 (KingArth0r): definite integrals of more families evaluate in
closed form — an absolute value or sign of a non-affine argument is split at
its exact roots; integer-cell sums (Floor, Ceil, Fract with an affine
weight) and `|sin(kx + m)|` over many periods no longer grow with the cell
count; `∫₀¹ {1/x} dx = 1 − γ` and `∫₀¹ ⌊1/x⌋ dx = +∞`; primitives for Erf,
Erfc, BesselJ(1, ·), BesselI(1, ·), Digamma, Trigamma and PolyGamma of an
affine argument (and `d/dx LogGamma = Digamma`); the nested exponential
`∫ e^{x + e^x} dx`; the Bose moments `∫₀^∞ xⁿ/(e^{ax} − 1) dx`. With the Rubi
rules loaded, a provider antiderivative with no value at a bound falls back
to the built-in one. Loading the rules compiles each distinct pattern once,
and an invalid `stepBudget` is rejected before compilation. The PR's
profiling script and JSON record are not included.

Review fixes on top of the PRs: a user definition with its own `compile`
handler keeps its own lane; compiled `HurwitzZeta(1, z)` for a non-real `z`
is the pole; the period shortcut declines outside radian mode; exact
coefficients in the cell sums stay exact; a polygamma integral between two
consecutive poles evaluates; the infinite-bound inert decision reads the
heads that contain the variable.

ROADMAP: the antiderivative of Sin and Cos ignores the degree angular unit
(found by the review; pre-existing).

Fix #434
Fix #439

Co-authored-by: enumeratio <314378874+enumeratio@users.noreply.github.com>
Co-authored-by: KingArthur <118565558+KingArth0r@users.noreply.github.com>
@arnog

arnog commented Oct 15, 2026

Copy link
Copy Markdown
Member

Merged by hand onto main as 403a216. For item 2 of #439: Transpose of an operand with no known shape is now typed unknown (a union is transposed member by member), so MatrixMultiply(q, Transpose(q)) stays unevaluated. Thank you.

@arnog arnog closed this Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Argument of a complex value computes in doubles under N(x, p); MatrixMultiply(q, Transpose(q)) with a free q is a type error

2 participants