# nteract - one way I like this
function solve_linsys(A::Matrix, b::Vector)
  x = A\b # this is calling Julia's built in "Gaussian Elimination with pivoting" 
end
solve_linsys(rand(5,5),rand(5))
function mult_alg(x::Vector)
  p = x[1]
  for i=2:length(x)
    p = p*x[i]
  end
  return p
end
x = 1:25
mult_alg(x)
xx = 1:25
2 .*(xx .+ 5)
collect(2 .*(xx .+ 5))
function mult_alg(x::AbstractVector)
  p = x[1]
  for i=2:length(x)
    p = p*x[i]
  end
  return p
end
x = 1:10
mult_alg(x)
# collect ranges into vectors... to get specific data...
# watch out for types!
mult_alg(1:25)
mult_alg(1.0:25.0)
# Let's see what happens..
for i=1:25
  @show mult_alg(1:i)
  @show mult_alg(1:Float64(i))
end
0x01 # this is one!
UInt256(1)
using LinearAlgebra
function bad_growth(n)
    A = Matrix(1.0I,n,n)
    A = A .- tril(ones(n,n),-1)
    A[:,end] .= 1
    return A
end
##
using Printf
function example(n)
    xtrue = (2*(rand(n,1) .< 0.5).-1)./10
    A = bad_growth(n)
    b = A*xtrue
    xcomp = A\b
    @printf("\n  n = %i\n\n", n);
    @printf("    [ %25s %25s ]\n", "x true", "x computed");
    for i=1:n
        @printf("    [ %25.17f %25.17f ]\n", xtrue[i], xcomp[i]);
    end
    @printf("norm(A*x - b) = %.18e", norm(A*xcomp - b))
end
example(10)
bad_growth(10)
example(60)
using Printf
function example2(n)
    xtrue = (2*(rand(n,1) .< 0.5).-1)./10
    A = bad_growth(n).+eps(1.0)*randn(n,n)
    b = A*xtrue
    xcomp = A\b
    @printf("\n  n = %i\n\n", n);
    @printf("    [ %25s %25s ]\n", "x true", "x computed");
    for i=1:n
        @printf("    [ %25.17f %25.17f ]\n", xtrue[i], xcomp[i]);
    end
    @printf("norm(A*x - b) = %.18e", norm(A*xcomp - b))
end
example2(60)