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
find_local_maximum/minimum() fails with expressions containing complex numbers #24536
Comments
This comment has been minimized.
This comment has been minimized.
comment:2
Apparently "Float" literally means Python (real) "float" not floating-point. Of course then expressions containing |
This comment has been minimized.
This comment has been minimized.
comment:4
The documentation of
but
gives the ticket error. |
comment:6
Note that changing the call from
Then everything works fine. |
Dependencies: #32234 |
comment:8
The fix for this will be similar to the one in #8450. After #32234, we're using |
comment:9
I'll deal with it once the prereqs start to settle. |
Branch: u/mjo/ticket/24536 |
comment:13
As promised, I've factored out a superclass of the Those two functions (and the "maximum" alias) have been updated, but I'm sure there are others where the same strategy can easily be applied. New commits:
|
Changed dependencies from #32234 to none |
Commit: |
Author: Michael Orlitzky |
comment:28
Replying to @mkoeppe:
In spirit, but with a tolerance, so that the the underlying routine doesn't crash when numerical issues cause a |
comment:29
Yes, so we would have a signaling and a non-signaling version of it |
comment:30
Some more random facts:
:( |
comment:31
Replying to @mkoeppe:
That would basically work here, although I think it might be slower to go from CDF through numpy and back. The main downside to that though is that the error message will be thrown deep in some plotting or optimization routine when it receives a complex number. In the current branch I've chosen to raise an error immediately, in the wrapper, "ValueError: complex fast-callable function result..." that is usually going to better explain the problem. |
comment:32
I didn't mean to say that we should use this numpy function. Just collecting existing idioms and interfaces. I was looking for a name for this operation ("convert to float if close to a real number, NaN otherwise) - and so far haven't found anything in Python, NumPy, C++ reference, ... |
comment:33
I guess one would need to figure out what complex infinities should convert to. |
comment:34
Also relevant: https://docs.python.org/3/library/cmath.html#cmath.isclose (which accepts both |
comment:35
Not sure how well developed the built-in
?? |
comment:36
OK that's https://bugs.python.org/issue25453, open since 2015 |
comment:37
Here's another one:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:39
Replying to @orlitzky:
Let's postpone this to another ticket. The current branch certainly does what it promises, the implementation looks fine, and tests pass. |
Reviewer: Matthias Koeppe |
comment:40
On OSX:
|
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:42
Untested (no macOS), but that should take care of it. |
Changed branch from u/mjo/ticket/24536 to |
The rethrown error comes from an attempt to do
float(I)
.The find_local functions use
FastFloatConverter
to compute values.CC: @orlitzky
Component: symbolics
Author: Michael Orlitzky
Branch/Commit:
1fe5795
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/24536
The text was updated successfully, but these errors were encountered: