Some new computational algorithms for analysis of linear systems with applications to optimal control