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
Fix issue 3503 #1662
Fix issue 3503 #1662
Conversation
@@ -669,6 +676,8 @@ class Ci(TrigonometricIntegral): | |||
|
|||
_trigfunc = C.cos | |||
_atzero = S.ComplexInfinity | |||
_atinf = 0 |
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.
0->S.Zero
Other than the small change indicated, this looks fine (assuming the values are correct). |
I checked them with MMA (Wolfram Alpha and Tables) and Fricas (Axiom). The only issue is http://functions.wolfram.com/GammaBetaErf/CoshIntegral/03/02/ say it's |
This is obviously unrelated to this PR, but at some point, we should refactor these class-level definitions into @Property methods. The reason is that they are run at import time, and the creation of objects like But good work here. If you're confident that these values are correct, this can be merged. |
I never used the
But this does not seem to work.
The only one I'd like to get a second opinion is
Thanks. |
Is Chi defined by an integral for negative x? If so, what does meijerint give? |
The general definition is: http://upload.wikimedia.org/math/9/0/3/9036287a03d2334c8db2af61b1b83300.png The issues may arise from the log(x) in there. Sympy, Fricas as well as MMA/WA all give: In [12]: limit(log(x), x, -oo) http://www.wolframalpha.com/input/?i=limit%28log%28x%29%2C%20x%2C%20-oo%29&dataset= In contrast numerical evaluations (Maxima, Fricas, mpmath, MMA/WA) show: In [6]: mpmath.log(-1000) and in Maxima log(-1000), bfloat; and Fricas (6) -> log(-1000::Complex(Float)) Therefore we have the very same problem with the more common log(x) To me it seems that numerics add a +I*pi and symbolics
As strange as it may sound: the only useful solution In [13]: integrate((cosh(t)-1)/t, (t, 0, x), meijerg=True) In [14]: integrate((cosh(t)-1)/t, (t, 0, oo), meijerg=True) In [15]: integrate((cosh(t)-1)/t, (t, 0, oo)) In [16]: integrate((cosh(t)-1)/t, (t, 0, x)) |
According to the docstring, that's the definition for positive z. For negative z, we have to use analytic continuation, or the second formula at http://docs.sympy.org/0.7.2/modules/functions/special.html?highlight=chi#sympy.functions.special.error_functions.Chi. I guess there's a branch cut on the negative axis, so Chi(-oo) is not well-defined. @ness01 any thoughts? |
OTOH Wolfram functions (who seem to be very concerned about branch cuts and such things) do And there is also this one: yielding In [9]: mpmath.ci(-1000_1.0j) + mpmath.log(-1000) - mpmath.log(-1000_1.0j)
Yes. This is probably the source of all confusion. |
Not using MeijerG is not helpful, because we aren't as assured of correctness in these corner cases then. By the way, the graph of http://www.wolframalpha.com/input/?i=Chi%28z%29 seems to agree with -oo + pi. |
All others are unambiguous manual table lookups.
But the point is that we have the same behavior for log: http://www.wolframalpha.com/input/?i=log%28z%29 and return oo as limit for log(-oo). |
I don't see how log(-oo) can be oo, given: In [15]: log(-1e10000 - 0.00000001*I).evalf()
Out[15]: -+inf - 3.14159265358979⋅ⅈ
In [16]: log(-1e10000 + 0.00000001*I).evalf()
Out[16]: -+inf + 3.14159265358979⋅ⅈ So below the branch, it is oo + pi_I and above it it is oo - pi_I. Actually, it appears to actually be computing this as -oo, not oo (the -+ is a printing bug I guess). In [17]: log(-1e10000 + 0.00000001*I).evalf().args
Out[17]: (-inf, 3.14159265358979⋅ⅈ)
In [19]: log(-1e10000 + 0.00000001*I).evalf().args[0] == oo
Out[19]: False
In [20]: log(-1e10000 + 0.00000001*I).evalf().args[0] == -oo
Out[20]: True |
I was referring to the symbolic values:
This is what sympy returns. Independently of the question if this is |
The symbolic values and numerical values should agree. Maybe the real answer is zoo, as at 0 (the other branch point of log). |
They should. But compare to: http://www.wolframalpha.com/input/?i=log%28-oo%29&dataset= http://www.wolframalpha.com/input/?i=N[log%28-100000000%29]
At least these tables say otherwise: http://functions.wolfram.com/ElementaryFunctions/Log/03/ShowAll.html There is no complex infinity in the values. |
I rather see zoo as the identification of all complex numbers of infinite magnitude. Like zero, the magnitude of zoo is meaningless. And by the way, wouldn't |
Anyway, lets go ahead and agree with Wolfram on the symbolic values. But I would still like to understand better why log(-oo) is evaluated this way. |
In other words, I'm +1 to this branch, but I'm still curious. Maybe someone has written a paper on this? |
I would remove the symbolic values
It depends where you put your branch cut. |
What is the state of this PR now? To what can we agree in order to merge this? |
I stand by what I said above. I'm running the sympy-bot tests now. When they come in, let's merge this, unless they show errors, or if someone feels that we should go a different way and discuss this further. |
Then let's merge, no? |
SymPy Bot Summary: 🔴 Failed after merging raoulb/fix_issue_3503 (a961b1c) into master (2abef4f). |
That are plotting failures. I think this is not related to my changes, is it? |
Yeah let's merge. |
Fix Issue 3503: Special values for Si are not implemented.
This fix adds values for Si, Ci, Shi, Chi at oo and -oo.