JuliaPy / SymPy.jl

Julia interface to SymPy via PyCall
http://juliapy.github.io/SymPy.jl/
MIT License
269 stars 61 forks source link

eigvecs returns wrong result. zero testing issue? #427

Closed jamblejoe closed 3 years ago

jamblejoe commented 3 years ago

See the following code. The eigenvectors calculated by SymPy are not correct. They are pretty off. SymPy verions is SymPy v1.0.46.

julia> A = Sym[0 3//2 0; 3//2 0 1; 0 1 0]
3×3 Matrix{Sym}:
   0  3/2  0
 3/2    0  1
   0    1  0

julia> eigvecs(A)
3×3 Matrix{Sym}:
 -2/3          3/2         3/2
    0  -sqrt(13)/2  sqrt(13)/2
    1            1           1

julia> eigvecs(float.(A))
3×3 Matrix{Float64}:
 -0.588348  -0.5547       0.588348
  0.707107  -4.92673e-16  0.707107
 -0.392232   0.83205      0.392232
julia> versioninfo()
Julia Version 1.6.1
Commit 6aaedecc44 (2021-04-23 05:59 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)

julia>
jverzani commented 3 years ago

It looks like the floating point values are just normalized to have norm 1, the SymPy ones not.

jamblejoe commented 3 years ago

@jverzani Thank you. You are right. This can be closed.