-
Notifications
You must be signed in to change notification settings - Fork 61
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
Behavior of iszero(x::Sym) #542
Comments
Thanks, this seems like a bug to me. Let me look into it. |
Hmm, I can't seem to replicate this:
Can you share your error message? |
Here's a more complete log. There is also a deprecation warning included here that shows up on the first call. (jl_KLFI0z) pkg> st
Status `C:\Users\svens\AppData\Local\Temp\jl_KLFI0z\Project.toml`
[24249f21] SymPy v2.0.1
julia> iszero(x)
C:\Users\svens\.julia\conda\3\lib\site-packages\sympy\__init__.py:672: SymPyDeprecationWarning:
importing sympy.core.logic with 'from sympy import *' has been
deprecated since SymPy 1.6. Use import sympy.core.logic instead. See
https://github.com/sympy/sympy/issues/18245 for more info.
self.Warn(
ERROR: KeyError: key :boolalg not found
Stacktrace:
[1] __getproperty
@ PyCall C:\Users\svens\.julia\packages\PyCall\1gn3u\src\PyCall.jl:313 [inlined]
[2] getproperty(o::PyCall.PyObject, s::Symbol)
@ PyCall C:\Users\svens\.julia\packages\PyCall\1gn3u\src\PyCall.jl:318
[3] _convert(::Type{Bool}, x::PyCall.PyObject)
@ SymPy C:\Users\svens\.julia\packages\SymPy\NveHe\src\python_connection.jl:16
[4] convert(::Type{SymPyCore.Bool3}, x::Sym{PyCall.PyObject})
@ SymPyCore C:\Users\svens\.julia\packages\SymPyCore\PayoX\src\equality.jl:51
[5] ==(x::Sym{PyCall.PyObject}, y::Sym{PyCall.PyObject})
@ SymPyCore C:\Users\svens\.julia\packages\SymPyCore\PayoX\src\equality.jl:35
[6] iszero(x::Sym{PyCall.PyObject})
@ Base .\number.jl:42
[7] top-level scope
@ REPL[5]:1 |
Sorry, one more check. Can you run
My guess is I need to update |
julia> sympy.__version__
1.6.2 |
Ohh, that is quite old, I believe. Any chance you can update? |
I see, I wasn't aware that the versioning was decoupled like this. This solves the problem with iszero. julia> @syms x
julia> x * sprand(2,.5) # multiplying by a sparse vector works fine
2-element SparseVector{Sym{PyCall.PyObject}, Int64} with 2 stored entries:
[1] = 0.455062571762008*x
[2] = 0.356216018302708*x
julia> m = x * sprand(2,2,.5);
julia> typeof(m)
SparseMatrixCSC{Any, Int64}
julia> m
2×2 SparseMatrixCSC{Any, Int64} with 2 stored entries:
Error showing value of type SparseMatrixCSC{Any, Int64}:
ERROR: MethodError: no method matching zero(::Type{Any}) |
In SymPy.jl v1.2.1, iszero(x::Sym) returns false. In v2.0.1, it throws
ERROR: KeyError: key :boolalg not found
.Is this change intended? One consequence of this is that multiplying variables with sparse matrices also errors in v2.
The text was updated successfully, but these errors were encountered: