A = Float64[
2 3
4 5
]
2×2 Matrix{Float64}: 2.0 3.0 4.0 5.0
B = Float64[
6 7
8 9
]
2×2 Matrix{Float64}: 6.0 7.0 8.0 9.0
A*B
2×2 Matrix{Float64}: 36.0 41.0 64.0 73.0
inv(A)*B
2×2 Matrix{Float64}: -3.0 -4.0 4.0 5.0
A\B
2×2 Matrix{Float64}: -3.0 -4.0 4.0 5.0
using Plots
n, d = 20, 3
x = range(-π, π; length=n)
X = x .^ (0:d)'
y = sin.(x) + 0.3randn(n)
b = X\y
f(x) = evalpoly(x, b)
xs = range((extrema(x) .* 1.1)...; length=1000)
plot(xs, f; label="degree-$d polynomial")
plot!(xs, sin; label="sin(x)", ls=:dash)
scatter!(x, y; label="sample", color=:red)
plot!(; legend=:topleft)