Skip to content

A trigonometric function times its reciprocal is integrated - #1768

Merged
Rafael-SOWNet merged 5 commits into
masterfrom
a-trigonometric-function-times-its-reciprocal-is-integrated
Oct 5, 2026
Merged

Rafael-SOWNet merged 5 commits into
masterfrom
a-trigonometric-function-times-its-reciprocal-is-integrated

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Part of #718.

sin(x) csc(x) was declined, and so, on master, were cos(x)^2 sec(x)^2 and Rubi's 4.7.7 (1 + cos(x)^2) sec(x)^2, which 2.5.0 answered at length:

integrand 2.5.0 master 763f7bae this
sin(x) csc(x) declined declined x
cos(x)^2 sec(x)^2 cos(x)^2 tan(x) + x - sin(2x)/2 declined x
tan(x) cot(x) declined arctan(tan(x)) x
(1 + cos(x)^2) sec(x)^2 cos(x)^2 tan(x) + x - sin(2x)/2 + tan(x) declined x + tan(x)
csc(x)^2 (1 + sin(x)^2) -sin(x)^2 cot(x) + x + sin(2x)/2 - cot(x) declined x - cot(x)

Each answer is differentiated back and compared with the integrand at six points from 0.31 to 2.41, either side of pi/2; with that check, this branch takes 21 to 660 ms a row.

What changes. The rule for products of powers of the six functions reads them as sin^p cos^q and refused a product whose powers cancel, p = q = 0. That product is the constant wherever it is defined, and its integral the constant times x. The reader takes such a product now where that rule asks for it; its other readers, which go on to divide by a power, still decline it, having nothing to divide.

Tests: TrigonometricTimesItsReciprocalIntegralTest, five rows differentiated back on both sides of the zeros and poles, and the three bare products answered as exactly x.

Measured first on all of Rubi's 4.7.7 and 4.7.1, 1,045 problems, at the corpus's 5-second budget, against master 287c69a7, the branch's base:

master this
solved 861 861
wrong 0 0
past the budget 23 25

Measured then on the Rubi corpus against master 287c69a7:

master this
family 0, independent suites (1814) 1772 1772
family 1, 40 a file (1381) 1308 1307
families 2 to 8, sampled (2410) 2301 2302

The harness counts no answer wrong in the pocket or the sample on either build. The figures were measured with three other corpus runs on the machine. In the pocket the two answers gained are matched by two that master answered at twenty-four seconds and this ran past the harness's patience on; run again alone, both builds answer one of those. Of the 6 problems the two builds disagreed on, pocket and sample together, run again one build at a time, master answers 2 and this 4: (1 + cos(x)^2) sec(x)^2 and csc(x)^2 (1 + sin(x)^2), in a third of a second and less, and a 1.1.2.4 rational function at twenty-three seconds, at the edge of the harness's patience, which master ran past. Master answers one that ran past it here, (A + B cos(x) + C sin(x))/(a + b cos(x) + c sin(x))^2, at twenty-four seconds, a row that has run past that edge on one build or the other in every measurement this week.

The suite on the commit measured, 68278034, passed, 14,829 tests, and the allocation gate passed. The calculus and corpus tests pass on its merge with master bf5d1a18, 4,204 of them, and the library builds for netstandard2.0. The head here, 86f447d4, merges master 18038b0d, and gives every row of the first table the answer it says.

🤖 Generated with Claude Code

https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura

Rafael-SOWNet and others added 4 commits October 4, 2026 18:00
The rule for products of powers of the six trigonometric functions
reads them as sin^p cos^q, and refused a product whose powers cancel:
sin(x) csc(x), cos(x)^2 sec(x)^2 and tan(x) cot(x) were declined. That
product is the constant wherever it is defined, and its integral the
constant times x. The reader takes such a product where the rule asks
for it; its other readers, which divide by a power, still decline it.
(1 + cos(x)^2) sec(x)^2, Rubi's 4.7.7, is answered again.

Part of #718.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
2.5.0 answered cos(x)^2 sec(x)^2, csc(x)^2 (1 + sin(x)^2) and
(1 + cos(x)^2) sec(x)^2 at length, and declined only sin(x) csc(x) and
tan(x) cot(x); the unreleased master declined all five.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
@Rafael-SOWNet Rafael-SOWNet added this to the 2.6.0 milestone Oct 4, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit 9d8662d into master Oct 5, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant