Chapter 2

j_02_02.jl

Gaussian elimination using LU factorization

Other versions: f_02_02.jl, nm22.jl


In [1]:
using NMfE

In [2]:
A=[10. 1. -5.;-20. 3. 20.;5. 3. 5.]


Out[2]:
3x3 Array{Float64,2}:
  10.0  1.0  -5.0
 -20.0  3.0  20.0
   5.0  3.0   5.0

In [3]:
b=[1., 2., 6.]


Out[3]:
3-element Array{Float64,1}:
 1.0
 2.0
 6.0

In [4]:
c = A\b


Out[4]:
3-element Array{Float64,1}:
  1.0
 -2.0
  1.4

In [5]:
round(A * c, 14) == b


Out[5]:
true