x = {0, 0.5, 1, 1.5, 2, 2.5, 3} y = {} for i = 1, #x do y[i] = math.exp(-x[i]) end f = InterpolatingFunction.Spline(x, y) g = InterpolatingFunction.BSpline(x, y, 3) function List(t) local s = {} for i = 1, #t do s[i] = string.format("%.4f", t[i]) end return "{" .. table.concat(s, ", ") .. "}" end print("Spline x = " .. List(f.x)) print("Spline knots = " .. List(f.knots) .. ", degree " .. f.degree) print("BSpline x = " .. List(g.x)) print("BSpline y = " .. List(g.y)) print("BSpline knots = " .. List(g.knots) .. ", degree " .. g.degree) print("BSpline coefficients = " .. List(g.coefficients)) print("type: " .. f.type .. " and " .. g.type)