Repository navigation
Integrate of c·sinᵐ(u)·cosⁿ(u) for a linear u and integers m, n integrates by the odd-power substitution and the even-even reduction formulas, as it does the secant and tangent powers - #579
Open
enumeratio wants to merge 1 commit into
Conversation
…rates by the odd-power substitution and the even-even reduction formulas, as it does the secant and tangent powers; add regression tests. Fix cortex-js#578
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.
∫ sin³x dxiscos³x/3 − cos x,∫ sin³x cos²x dxiscos⁵x/5 − cos³x/3,∫ sin⁴x dxis3x/8 − 3/16·sin 2x − ¼·cos x·sin³x; they wereIntegrate. Fixes #578Rules (
symbolic/antiderivative.ts):integrateSinCosPower(fn, index)reads the integrand asc·sinᵐ(u)·cosⁿ(u)(a constant factor, aNegate, aDivideby a constant, one linear argumentu = a·x + bwithafromlinearIndexCoefficient, integer powers1…SIN_COS_POWER_LIMIT = 40) and returns the primitive divided bya. Form = 2k + 1it is−Σⱼ C(k, j)(−1)ʲ cosⁿ⁺²ʲ⁺¹u/(n + 2j + 1), forn = 2k + 1it isΣⱼ C(k, j)(−1)ʲ sinᵐ⁺²ʲ⁺¹u/(m + 2j + 1)(sin² + cos² = 1).sinCosEvenPower(u, m, n), both even andm + n ≥ 4(sin²,cos²stay the table's): A&S 4.3.127–4.3.128 as a loop, not a recursion, then∫du = u.antiderivativeCandidateafter the established antiderivative left anIntegrateand beforelogarithmicPrimitive, so no result that already resolved changes (∫ sin x cos x,∫ sin²x,∫ sin x · cos xcomposites, the table entries).sin³(x²)) and different arguments in the two factors (sin³x·cos 2x) are not read, and the call stays as it was.Definite integrals are unchanged (
∫₀^π sin³x dxgave4/3already, by another route); the degree angular unit scales by180/πthroughwithRadianConvention. Not compiled (Integrateis not).Wolfram agrees (its indefinite forms are multiple-angle spellings of the same functions up to a constant).
Tests:
test/compute-engine/trig-power-integrals.test.ts(new): seven exact primitives by string (sin³,cos³,sin³cos²,sin²cos³,sin³cos³,3 sin³(2x + 1),cos³/2); for sixteen(m, n, u)(odd, even and mixed,u = x, 2x + 1, 3x, x − 1) the derivative of the result equals the integrand at three points (central difference, 1e-6); definite values (4/3,3π/16,π/8) underevaluate()and.N()(sin³was already4/3); degree mode; and six shapes that are not read and stayIntegrate. No existing test changed; the 160-odd test files that nameIntegrateor\inttogether withSinorCospass.Overlap with the open PRs. None; it adds a function and one call in
antiderivativeCandidate.Open question: the even-even case adds a
sin(2x)spelling throughevaluate()ofsin x cos x(∫sin⁴xprints withsin(2x)andcos x·sin³x); a primitive in thesin(kx)multiple-angle form (as Wolfram's) is also possible, and needsTrigReduceon the result.