Repository navigation
D gains closed-form partials for ErfInv, HurwitzZeta and LerchPhi in a, Beta, BarnesG, LogBarnesG, EllipticK, EllipticE and ClausenCl, and D(f, [x, n]) is the n-th derivative as D(f, {x, n}) is - #575
Open
enumeratio wants to merge 1 commit into
Conversation
…a, Beta, BarnesG, LogBarnesG, EllipticK, EllipticE and ClausenCl (inert for an operand with no closed form), and D(f, [x, n]) is the n-th derivative as D(f, {x, n}) is; add regression tests. Fix cortex-js#574
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
D(ErfInv(x), x),D(HurwitzZeta(s, x), x),D(Beta(a, b), a)and the other heads below evaluate to a closed form on every route instead of an inertApply(Derivative(…)), andD(x^5, [x, 3])is60x². Fixes #574Rules (
symbolic/derivative.ts,SPECIAL_FUNCTION_PARTIALS, consulted just beforeDERIVATIVES_TABLE; each entry is one closed form per operand andundefinedfor an operand with none, which keeps that slot'sApply(Derivative(f, eᵢ), …)with the chain rule over the others, as thePolyLogandGamma(s, z)arms do):ErfInv(x)′ = (√π/2)·e^(ErfInv(x)²)(DLMF 7.2.1, inverse-function rule).HurwitzZeta(s, a)ina:−s·HurwitzZeta(s + 1, a)(DLMF 25.11.17).LerchPhi(z, s, a)ina:−s·Φ(z, s + 1, a); inz:(Φ(z, s − 1, a) − a·Φ(z, s, a))/z. None ins.Beta(a, b):B(a, b)(ψ(a) − ψ(a + b))ina, and inbwithψ(b).LogBarnesG(z)′ = (z − 1)ψ(z) − z + ½(1 + ln 2π);BarnesGis that timesBarnesG(z).EllipticK(m)′ = (E(m) − (1 − m)K(m))/(2m(1 − m)),EllipticE(m)′ = (E(m) − K(m))/(2m), the one-operand forms only (DLMF 19.4.1).ClausenCl(n, θ)for a literaln ≥ 1:Cl₁′ = −½cot(θ/2),Clₙ′ = Clₙ₋₁for an evenn,−Clₙ₋₁for an odd one. A symbolic order stays inert.The same rules answer
Derivative(f, …)and, through it, the coefficients ofSeries:Series(ErfInv(x), x, 0, 5)is½√π x + π^(3/2) x³/24 + 7π^(5/2) x⁵/960 + O(x⁷)(Wolfram's series).Left inert on purpose (no closed form, Wolfram leaves
Derivative[…]too):∂ₛofHurwitzZeta,LerchPhiandClausenCl,Zeta'(s). The two-operandZeta(s, a)is not given the shift rule: it isΣ|n + a|^(−s)here, for which−s·ζ(s + 1, a)is wrong at a negativea.D(f, [x, n])(library/calculus.ts,isOrderSpec): thecanonicalhandler read only aSetpair as the order spec; it now reads aListof a symbol and a number too, with every rule of theSetpair (order 0 removes the pair, a negative order is an error, a fractional or symbolic order and an order pastMAX_DERIVATIVE_ORDERstay as written).Tests:
test/compute-engine/derivative-special-functions.test.ts(new): each function at points of its domain,D(…)underevaluate()and.N()against a central difference of the function, the same compiled (BarnesGhas no JavaScript lowering, before or after), the chain rule (EllipticK(2x),Beta(x, x)), exact forms, the inert slots (including a closed-form slot added to an inert one), a variable-free operand, theSeriesofErfInvandHurwitzZeta, andD(f, [x, n])against{x, n}and againstD(f, x, x, …)(orders 0, 3, 5, 7, a compound function, a negative, fractional, symbolic and past-the-cap order, and a list of two variables). Pinned tests changed (two):measurement-apply.test.tslistedBeta(2.5 ± 0.1, 3)among the operators "with no known derivative" that stay unevaluated; it now has one and is aMeasurement, so the row moves to a test of its own.compile-references.test.tsusedD(ErfInv(x), x)as the derivative that glsl cannot lower although it lowersErfInv; it is a closed form now (glsl lowers it), and the test usesD(Zeta(x), x), which stays anApply(Derivative(Zeta, 1), x). The rest of theD,DerivativeandSeriesrows onmainpass unchanged. Compilation: a compiledD(…)of each head is the compiled value of its closed form; theDlowering is unchanged.Overlap with the open PRs. #519 (
HarmonicNumber) adds its derivative toDERIVATIVES_TABLE, a hunk away fromSPECIAL_FUNCTION_PARTIALS;HarmonicNumberis not repeated here.series-decline(the other PR of this pair) touchessymbolic/series.tsand oneexportinsymbolic/derivative.ts; no shared lines. #567 (ErfInv(z0, z), the two-operand form) and #560/#562 (kernels) do not editderivative.ts: with #567 the two-operandErfInvkeeps the inert derivative, as the rule answers one operand only.Not in this PR: the orthogonal polynomials and
Gudermannianare not heads of the engine, andHarmonicNumberis #519;EllipticE(φ|m),EllipticF,EllipticPiand the hypergeometric heads are larger and would go separately.