Repository navigation
Keep ln and the inverse trigonometric functions in their range when inverting them, and (e^a)^c = e^(ac) for a real a only - #2750
Open
Rafael-SOWNet wants to merge 1 commit into
Conversation
…nverting them, and (e^a)^c = e^(ac) for a real a only ln(x) = w has a root only where Im(w) is in (-pi, pi], and arctan(x) = w only where w is a value of arctan: Re in (-pi/2, pi/2), or pi/2 above the real line and -pi/2 below it, where the cuts land (arctan(2i) = pi/2 + 0.549i). The inversions answered e^w and tan(w) for every w, so e^(ln(x)^2) = 1 listed e^sqrt(10 pi i), where e^(ln(x)^2) - 1 is 27337 + 13573i, and abs(arctan(x)) = 2 listed tan(2 e^(i r)) at r = 0.3, where |arctan| is 1.365. A value that is not a number now carries the condition. On a line a n + b in a parameter the strip is decided once where it does not depend on n (sin(ln(x)) = 0 is unchanged); a line through an inverse trigonometric function is #2711's and is left as it was. arcsin, arccos and arccotan carry their ranges the same way, measured on the evaluator. (a^b)^c = a^(bc) holds for a whole c, or where ln(a^b) is b ln(a), which needs a positive and b real. It was applied for any b, so sqrt(e^(2x)) was e^x, the negative of the value at x = 2.1 - 1.7i. Both spellings of the rule and the factor reader ask one predicate now; over the reals it fires as before. Two tests pinned the old answers: log(b, x) = 2 was { b ^ 2 }, which is wrong at b = -1 (log(-1, 1) is 0), and the agreement test listed (2^x)^(1/2) as firing. Fixes #2713 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2750 +/- ##
==========================================
- Coverage 86.65% 86.65% -0.01%
==========================================
Files 346 346
Lines 76959 76943 -16
Branches 22644 22637 -7
==========================================
- Hits 66692 66678 -14
Misses 5534 5534
+ Partials 4733 4731 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Inverting
lnandarctanignored their range off the real line, and(a^b)^c = a^(bc)was applied for a positiveaand anyb. Every real answer was right. The wrong members were complex.What changed
ln(x) = w(andlog(a, x),log(x, a)): the root now carries-pi < Im(w) <= pi. On a linea n + bin a solve parameter, the condition is decided once where it does not depend onn: a real slope givesIm(b), and a slope that divides2 pi irepeats one member. Sosin(ln(x)) = 0ande^(ln(x)) = 2are unchanged.arctan,arccotan,arcsin,arccos: a non-numeric value carries the range, measured on the evaluator.arctan(2i) = pi/2 + 0.549i,arctan(-2i) = -pi/2 - 0.549i,arccotan(0.5i) = -pi/2 - 0.549i,arccotan(0) = pi/2,arcsin(±2) = ±pi/2 - 1.317i,arccos(2) = 1.317i,arccos(-2) = pi + 1.317i. A value that is a line in a solve parameter (pi/4 + pi n) is left as it was, because that case is Solving f(arcsin(x)), f(arccos(x)) or f(arctan(x)) = c keeps roots outside the inverse function's range: tan(arcsin(x)) = 1 gives sin(pi/4 + pi n) #2711.(a^b)^c = a^(bc): now needs a wholec, ora > 0withbreal.MayMultiplyExponentssits inPatterns.Power.cs, and the switch arm, bothMatchedRulesspellings and the factor readerDecomposeall ask it. Over the reals (Codomain = Real) it fires as before.Before/after, checked with mpmath (dps 50)
e^(ln(x)^2) = 1e^(±sqrt(2 pi i n))provided -pi < Im(…) <= pie^(ln(x)^2) - 1 = 27337.4 + 13573.5i; n = 1: 0 (kept)abs(arctan(x)) = 2tan(2 e^(i r))… and (-pi/2 < 2 Re(e^(i r)) < pi/2 or edges)ln(x) = ae^ae^a provided -pi < Im(a) <= piln(e^a) = 1 - 2.283ilog(b, x) = 2b^2b^2 provided -pi < 2 Im(ln b) <= pilog(-1, 1) = 0sqrt(e^(2x))e^x1.052 + 8.098ivse^x = -1.052 - 8.098i(e^(2x))^(1/4)e^(x/2)2.147 + 1.886ivs1.886 - 2.147isqrt(2^x)2^(x/2)1.341 + 0.450ivs the negationThe sweep checker (class F of the solve sweep, plus 106 variants:
ln(x)^k,ln(x+1),ln(2x),log(2,x),abs(arc…),e^(arctan(x)^2), simplify of powers of exponentials)x = 1(n = 0), which is Solving a periodic function of 1/x, sqrt(x) or x^(1/3) drops the branch through n = 0: tan(1/x) = 0 and cos(sqrt(x)) = 1 give { } #2710/Keep a family of roots through n = 0, and leave its undefined member out #2718 and the same on master.Across the sweep's 5933 solve and simplify rows, 64 answers changed. All of them are the added conditions or the 9 power-of-power simplifications listed above. No real root changed.
Harnesses, before → after: RootCheck 596/596 clean → same; CasBench 120/121, 0 wrong → same; SimpSweep 10463/10463 agree → same; CanonCheck findings match the baseline (2040) → same. The reports are identical apart from timings.
Unit suite: 22349 passed, 0 failed. Two pinned answers changed, and both were wrong:
log(b, x) = 2and the agreement test's(2^x)^(1/2)"fires".Overlap with #2711: both edit the
Arc*f.InvertNodelines. Here eachArgument.Invert(...)is wrapped inWithinItsValues(...), and #2711 putsInvertWithin(...) ??in front. The conflict is mechanical: keep both.Fixes #2713
🤖 Generated with Claude Code