Re: Program to calculate rational function with imbedded continued fraction

• To: mathgroup at smc.vnet.net
• Subject: [mg69932] Re: [mg69875] Program to calculate rational function with imbedded continued fraction
• From: "Diana Mecum" <diana.mecum at gmail.com>
• Date: Wed, 27 Sep 2006 06:06:24 -0400 (EDT)

```I apologize if my example was not clear. I was trying to keep it simple.

I have an exponential function e(z), where z might equal 1, which is a
continued fraction defined as follows:

e(1) = [0, [1], [2], [1], [3], [1], [2], [1], [4], [1], [2], [1], [3], [1],
[2], [1], [5], ...]

[i] = T^2^i - T in characteristic 2.

I am trying to learn how to evaluate

(xe(1) + y)(ze(1) + w), where x, y, z, and w are polynomials in T, and xw -
yz != 0.

So, for any given example, such as

(e(1) + 1)(T^2e(1), I am trying to determine what the continued fraction for
it would be.

I see your program. Thanks for forwarding it.

To implement it, do I plug (e(1) + 1)(T^2e(1) in for k?

When I run the routine, I get an error saying that the tags in In[50] and
In[51] are protected.

Diana M.

On 9/26/06, Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote:
>
> On 26 Sep 2006, at 18:21, Diana wrote:
>
> > Hello all,
> >
> > Would someone be able to help me write a program to calculate the
> > rational function of (2x + 3)/(2x + 4), for example?
>
> I have once already posted such a program and so did Daniel
> Lichtblau. (Search the archive for the subject "How to do Continued
> fraction of polynomials" and compare our posts. (I can't remember any
> more what the difference between them was).
>
> Here is my version:
>
> F[f_, g_] :=
>       If[PolynomialReduce[f, g][[1, 1]] =!= 0, PolynomialReduce[f,
> g][[
>          1, 1]] + F[PolynomialReduce[f,
>       g][[2]], g], Module[{u = g, v = f, p, ls}, ls = Flatten[Last[
>        Reap[While[u =!= 0, p = PolynomialReduce[u, v]; u = v; v =
> p[[2]]; Sow[
>      p[[1]]]]]]]; 1/Fold[Function[{x, y}, y + 1/x], Infinity,
> Reverse[ls]]]]
>
> In the case of your example above you need to evaluate:
>
> In[50]:=
> k=(2x+3)/(2x+4);
>
> In[51]:=
> F[Numerator[k],Denominator[k]]
>
> Out[51]=
> 1 + 1/(-2*x - 4)
>
>
>
>
> >
> > Also, (tx + 2t)(3t^2x + t), for example.
>
>
> What exactly do you mean? This does not make sense to me; is that a
> quotient? If so why did't you cancel the t's? I think the case of
> rational functions in several variables will be much harder, and I
> would have to think more about it, for which I do not have the time
> at this moment, and in any case it might not be what you are asking for.
>
>
> >
> > x is actually an infinite continued fraction, and I am trying to
> > figure
> > out how to divide one infinite continued fraction by another.
> >
> > (t [0, 1, 2, 1, 3, 1, 2, 1, 4, ...] + 2t)/(3t^2 [0, 1, 2, 1, 3, 1, 2,
> > 1, 4, ...] +t)
> >
>
>
> I think this can be done combining the built in function
> FromContinuedFraction with the function F defined above.
>
> Andrzej Kozlowski
>
> Tokyo, Japan
>

```

• Prev by Date: Re: problem evaluating a function on a list
• Next by Date: Re: Re: why does not the Mathematica kernel seem to 'multi-task' between computations in different windows?
• Previous by thread: Re: Program to calculate rational function with imbedded continued fraction
• Next by thread: Re: Program to calculate rational function with imbedded continued fraction