Algorithms For Trigonometric Polynomial And Rational Approximation