Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10612 > unrolled thread
| Started by | dr DanW <dmaxwarren@gmail.com> |
|---|---|
| First post | 2012-06-23 08:24 +0000 |
| Last post | 2012-06-23 08:24 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Continued fraction from rational polynomial? dr DanW <dmaxwarren@gmail.com> - 2012-06-23 08:24 +0000
| From | dr DanW <dmaxwarren@gmail.com> |
|---|---|
| Date | 2012-06-23 08:24 +0000 |
| Subject | Continued fraction from rational polynomial? |
| Message-ID | <js3uf9$vf$1@smc.vnet.net> |
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
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web