Summary: | This study shows how to obtain least-squares solutions to initial value problems (IVPs), boundary value problems (BVPs), and multi-value problems (MVPs) for nonhomogeneous linear differential equations (DEs) with nonconstant coefficients of any order. However, without loss of generality, the approach has been applied to second-order DEs. The proposed method has two steps. The first step consists of writing a constrained expression, that has the DE constraints embedded. These kind of expressions are given in terms of a new unknown function, g ( t ) , and they satisfy the constraints, no matter what g ( t ) is. The second step consists of expressing g ( t ) as a linear combination of m independent known basis functions. Specifically, orthogonal polynomials are adopted for the basis functions. This choice requires rewriting the DE and the constraints in terms of a new independent variable, x ∈ [ − 1 , + 1 ] . The procedure leads to a set of linear equations in terms of the unknown coefficients of the basis functions that are then computed by least-squares. Numerical examples are provided to quantify the solutions’ accuracy for IVPs, BVPs and MVPs. In all the examples provided, the least-squares solution is obtained with machine error accuracy.
|