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
residue: mathematically wrong output #20084
Comments
comment:1
The most elegant solution would of course be the automatic simplification of expressions like
However, I'm not sure if that can be achieved so easily. A second suggestion would be something like diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
index 3a5c864..175bcad 100644
--- a/src/sage/symbolic/expression.pyx
+++ b/src/sage/symbolic/expression.pyx
@@ -4076,7 +4076,7 @@ cdef class Expression(CommutativeRingElement):
a = 0
if a == infinity:
return (-self.subs({x: 1/x}) / x**2).residue(x == 0)
- return self.subs({x: x+a}).series(x == 0, 0).coefficient(x, -1)
+ return self.subs({x: x+a}).canonicalize_radical().series(x == 0, 0).coefficient(x, -1)
def taylor(self, *args):
r""" where there are several ways to refine this approach:
and so on. Thoughts? |
comment:2
This is just the quick workaround from above. New commits:
|
Author: Benjamin Hackl |
Commit: |
comment:3
Please add an example doctest to illustrate what you're fixing. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:5
Is it ready for review? |
comment:6
update from the future:
some updates in |
comment:7
Yes, I have faint memory of improving something with Actually, there are more problems with
(Note that this is, in some sense, a pathological example.) The ideal fix in this case (IMHO) would be to throw an error that the residue could not be computed as the "correct" branch of the root could not be chosen automatically. I think that just applying In any case: the original problem reported with this ticket is solved, so this is probably just wontfix. Other opinions? Replying to @mforets:
|
comment:8
Replying to @behackl:
cool. for what i've been told from other tickets, i suppose this one should should still provide the test (not wontfix):
yes. one could come up with other examples (e.g. examples involving log(z)). i agree that just applying |
comment:9
@behackl : if you remove the wrt handling pathological examples, yes IMO it is a relevant future task, although as pointed out before i cannot help right now, since i'm not visualizing a workaround :/ |
Changed branch from u/behackl/symbolics/residue/exp-complex-poles to public/20084 |
Reviewer: Frédéric Chapoton |
Changed branch from public/20084 to |
The complex function
f(s) = 1/(1 - 2^(-s))
has poles of residue1/log(2)
ats = 2*k*pi*I/log(2)
for all integersk
.Currently sage recognize these poles just at
s=0
:In essence, this happens because the
series
-method does not recognize the pole. The priority is critical because mathematically wrong output is produced.CC: @rwst @cheuberg
Component: symbolics
Author: Benjamin Hackl
Branch/Commit:
68fea61
Reviewer: Frédéric Chapoton
Issue created by migration from https://trac.sagemath.org/ticket/20084
The text was updated successfully, but these errors were encountered: