-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nthroot and rational power #533
Conversation
Codecov Report
@@ Coverage Diff @@
## 1.0-dev #533 +/- ##
===========================================
- Coverage 85.44% 85.22% -0.23%
===========================================
Files 34 34
Lines 1814 1793 -21
===========================================
- Hits 1550 1528 -22
- Misses 264 265 +1
Continue to review full report at Codecov.
|
What differences? I think nthroot and |
I agree with the comment, indeed, they should behave the same. Yet, we are speaking about the power function, which means the possibility to different interpretations related to the actual julia> nthroot( -27 .. 27, 3)
[-3, 3]
julia> (-27 .. 27)^(1//3)
[0, 3] This PR doesn't (yet) address these differences, but tries to ensure that the results are the same when they should be. |
Very good example! Now I actually think they should not be the same, as they have different domains and codomains. This is also highlighted comparing the definition of |
Thanks for pointing out those tables; I'll check them. I also think that we can now reduce the code duplication. |
260b4eb
to
e99f547
Compare
This should fix the problems in JuliaIntervals/IntervalContractors.jl#55; once this is merged to 1.0-dev branch, tests should pass there... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lbenet in general LGTM. I left two very minor comments.
As a more general comment, have you looked at the current tests for nthroot and rational power? Are there some corner cases which this PR fixes that should be added to the tests?
I checked in IntervalContractors
and with this branch there are "only" 233 broken tests in pow_rev, which are presumably some tricky cases.
Could you tell me which tests are still not passing? I admit that I did not checked where are the broken tests, though I saw the 233... |
The ones marked as |
but that's very likely to be an inssue in function pow_rev1(b, c, x) # c = x^b
return x ∩ c^(1/b)
end
function pow_rev2(a, c, x) # c = a^x
return x ∩ (log(c) / log(a))
end my point simply being that this PR can be merged with clean consciousness even if tests in IntervalContractors still fail |
I agree to merge this, at least to make it easier to see what's going on in IntervalContractors... Incidentally, I did not touch |
Going ahead and merging! |
The idea behind this PR is to get the same results for
a^(1//n)
andnthroot(a, n)
forn::Integer
, when the comparison makes sense (there are small differences, which are related toa
). This allows to pass a bunch of tests inIntervalContractors.jl
, after some tweeks (see JuliaIntervals/IntervalContractors.jl#55).