Piecewise Lagrange Interpolation Polynomial with n Nodes
1. Piecewise Lagrange interpolation polynomial method using n nodes; 2. Function call format: y = lagrange(x0, y0, x, k); 3. Input parameters: x0 (n-dimensional vector of interpolation nodes), y0 (n-dimensional vector of function values at nodes); 4. x (m-dimensional vector of evaluation points), k (degree of piecewise polynomial, maximum 3, default k=1); 5. Output y contains function values at interpolation points x; The implementation constructs local Lagrange polynomials between adjacent nodes for improved numerical stability compared to global interpolation.