# Accuracy of Computing Determinants

**URL:** <https://discourse.julialang.org/t/accuracy-of-computing-determinants/6782>\
**Category:** Numerics\
**Created:** [October 30, 2017, 6:04pm UTC](https://discourse.julialang.org/t/accuracy-of-computing-determinants/6782 "2017-10-30T18:04:14Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![andreasnoack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andreasnoack/32/27_2.png) [@andreasnoack](https://discourse.julialang.org/u/andreasnoack)\
**Post date:** [October 30, 2017, 7:35pm UTC](https://discourse.julialang.org/t/accuracy-of-computing-determinants/6782/3 "2017-10-30T19:35:26Z")

</div>

Notice that there are two different matrices considered here. There is the actual Hilbert matrix

```julia-auto
A = Rational{BigInt}[1//(i+j-1) for i in 1:12, j in 1:12]

```

and the floating point representation of this matrix `Float64.(A)`. These two matrices have slightly different determinants even when computed exactly

```julia-auto
julia> Float64(det(A))
2.6377806512535473e-78

julia> Float64(det(Rational{BigInt}.(Float64.(A))))
2.687225581661903e-78

```

Furthermore, since the matrix is so ill conditioned, different ways of computing the determinant in floating point arithmetic give quite deifferent results.

#### LU

```julia-auto
julia> det(lufact(Float64.(A)))
2.550554736789249e-78

```

#### Bunch-Kaufman using upper and lower triangle for storage

```julia-auto
julia> det(Symmetric(Float64.(A), :L))
2.8930243994501074e-78

julia> det(Symmetric(Float64.(A), :U))
2.557691999626182e-78

```

#### Cholesky using uppler and lower triangle for storage

```julia-auto
julia> det(cholfact(Symmetric(Float64.(A), :L)))
2.6834441543359152e-78

julia> det(cholfact(Symmetric(Float64.(A), :U)))
2.8372335715728185e-78

```

---

_[View the full topic](https://discourse.julialang.org/t/accuracy-of-computing-determinants/6782)._
