Given the constant-coefficient boundary value problem
y(b) = yb
we can solve such a system in Maple as follows:
c[2] := 1.0; c[1] := 4.0; c[0] := 2.0; f := 0.0; n := 10; a := 1.0; b := 3.0; ya := 4.0; yb := 2.0; h := (b - a) / n; low := 2*c[2] - h*c[1]; diag := 2*h^2*c[0] - 4*c[2]; up := 2*c[2] + h*c[1]; vec := 2*h^2*f; M := Matrix( n - 1, n - 1 ); v := Vector( n - 1 ); M[1, 1] := diag; M[1, 2] := up; v[1] := vec - ya*low; for i from 2 to n - 2 do M[i, i - 1] := low; M[i, i] := diag; M[i, i + 1] := up; v[i] := vec; end do: M[n - 1, n - 2] := low; M[n - 1, n - 1] := diag; v[n - 1] := vec - yb*up; y := LinearAlgebra[LinearSolve]( M, v );
Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.