Repository navigation
Commit 4e302c2
A repeated quadratic denominator is integrated (#1155)
A repeated quadratic denominator is integrated
`1/(x^2 + 1)^2` had no antiderivative, while `1/(x^2 - 1)^2` and
`1/(x^2 + 2x + 1)^2` both did: a denominator with real roots comes apart into
linear factors and never reached the gap. What was missing was the irreducible
case.
Writing Q for the quadratic, u for its derivative 2ax + b and D for 4ac - b^2,
the identity u^2 = 4aQ - D turns the derivative of u/Q^(m-1) into an equation
for the integral of 1/Q^m:
J_m = (u / Q^(m-1) + 2a(2m - 3) J_(m-1)) / ((m - 1) D)
unrolled down to J_1, which the table already answered. It is an identity in a,
b and c rather than a fact about signs, so one line serves both signs of the
discriminant; D = 0 is the sole exclusion, and the division by D is why. The two
shapes the reduction cannot speak for get their own arms -- a zero leading
coefficient leaves a linear power, a zero discriminant leaves a power of u --
which is what lets a symbolic quadratic be answered as a piecewise instead of
carrying a division by zero.
A numerator of higher degree is divided by the quadratic first: N = qQ + r takes
one power off the denominator and two degrees off the numerator, and ends. An
improper fraction is declined rather than divided out here, since the recursion
bottoms out at a single power with a numerator of degree two or more -- exactly
the case SolveByPartialFractions already opens with a long division.
The remainder is computed as N - qQ rather than read from the division, which
reports it already divided by the divisor: x^2 over x^2 + 2 answers
(1, -2/(x^2 + 2)), and taking that as a polynomial gives a numerator that is not
one, so every polynomial-numerator case declined.
A numerator already along the denominator's derivative leaves no second integral
and the term is dropped rather than multiplied by zero. That is not tidiness:
0 * (2x/(x^2 + 1)) is `0 provided not 1 + x^2 = 0` and not 0, so multiplying
would attach a condition to x/(x^2 + 1)^2, which had none and is owed none.
A denominator with real roots now takes this route rather than partial
fractions. The value is unchanged and the form is shorter -- one logarithm where
there were two -- which is why the metric that ranks candidates selects it.
Measured, both arms on one machine, the same way. Where the integrand is
rational this is 26 to 165 times faster, because TryStandardIntegrals runs
before every search and a shape answered outright never enters the candidate
exploration: 1/(x^2 + 1)^2 goes from 2879 ms unevaluated to 111 ms answered, and
x^2/(x^2 + 2)^2 from 92,990 ms unevaluated to 565 ms answered. Where the
integrand is a transcendental function over a repeated quadratic, none of which
has an elementary antiderivative, the same search takes 3.4 to 10.8 times longer
to conclude nothing -- e^x/(x^2 + 1)^2 from 7944 ms to 85,683 ms. That is growth
in integration by parts, which those integrands reach and this rule never
matches; it is filed separately rather than bounded here, since by-parts is
machinery every integral goes through.
Full suite 9515 passed, 0 failed. 26 new tests, each answer differentiated back
and compared with the integrand.
Part of #180.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura1 parent 0e643f3 commit 4e302c2
4 files changed
Lines changed: 390 additions & 0 deletions
File tree
- Sources
- AngouriMath/Functions/Continuous/Integration
- Tests/UnitTests/Calculus
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
114 | 169 | | |
115 | 170 | | |
116 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
226 | 238 | | |
227 | 239 | | |
228 | 240 | | |
| |||
529 | 541 | | |
530 | 542 | | |
531 | 543 | | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
532 | 709 | | |
533 | 710 | | |
0 commit comments