JuliaAcademy / JuliaTutorials

Learn Julia via interactive tutorials!
https://julialang.org/learning/
MIT License
1.26k stars 657 forks source link

Assertion error in introductory-tutorials/intro-to-julia 12. Factorizations and other fun exercise #69

Closed ShaoxiongYao closed 2 years ago

ShaoxiongYao commented 4 years ago

I am using Julia version 1.5.0 In exercise 11.2, when I run @assert A_eigv == [-128.49322764802145, -55.887784553056875, 42.7521672793189, 87.16111477514521, 542.4677301466143]

is true. But when I run the solution of exercise eigdec = eigen(A) eigdec.values A_diag = Diagonal(eigdec.values) @assert A_diag == [-128.493 0.0 0.0 0.0 0.0; 0.0 -55.8878 0.0 0.0 0.0; 0.0 0.0 42.7522 0.0 0.0; 0.0 0.0 0.0 87.1611 0.0; 0.0 0.0 0.0 0.0 542.468] ther output is `AssertionError: A_diag == [-128.493 0.0 0.0 0.0 0.0; 0.0 -55.8878 0.0 0.0 0.0; 0.0 0.0 42.7522 0.0 0.0; 0.0 0.0 0.0 87.1611 0.0; 0.0 0.0 0.0 0.0 542.468] Stacktrace:

[2] include_string(::Function, ::Module, ::String, ::String) at ./loading.jl:1091` I think the implementation is correct but want to confirm. I am thinking if we need to increase the accuracy of the result or use other numbers.

jonas-eschle commented 2 years ago

Duplicate of #84, fixed in #87