Continued fraction from rational polynomial?

*To*: mathgroup at smc.vnet.net*Subject*: [mg127007] Continued fraction from rational polynomial?*From*: dr DanW <dmaxwarren at gmail.com>*Date*: Sat, 23 Jun 2012 04:16:27 -0400 (EDT)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com

Does Mathematica have a function to develop a continued fraction from a rational polynomial? I have managed to implement the Euclidian Algorithm for polynomials as below: PolynomialContinuedFraction[a_, b_, s_Symbol] /; PolynomialQ[a, s] && PolynomialQ[b, s] := Block[{q, r}, Flatten[Reap[NestWhile[Function[ab, {q, r} = PolynomialQuotientRemainder[ab[[1]], ab[[2]], s]; Sow[q]; {ab[[2]], r}], {a, b}, Function[ab, ab[[2]] =!= 0]]; ][[2]]]] but I cannot shake the feeling that this is something the Mathematica can already do and I just don't know what it is called. ContinuedFraction[] only works with numbers. Interestingly, FromContinuedFraction[] works just fine with the symbolic output of my function. Daniel