Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Smarter way to calculate middle-right terms of continued fraction partial sums

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70080] Re: Smarter way to calculate middle-right terms of continued fraction partial sums
  • From: ab_def at prontomail.com
  • Date: Mon, 2 Oct 2006 00:34:11 -0400 (EDT)
  • References: <eflefm$dg8$1@smc.vnet.net><efnui4$7m8$1@smc.vnet.net>

Diana wrote:
> > Note that the signs of a1 alternate between positive and positive.
> Likewise, all the variables alternate in sign.
>
> That would be "the signs of a1 alternate between positive and
> negative."
>
>
> Diana M.

I think you forgot to mention that d[n] was defined as

d[n_] := Product[a[k]^2^(n - k), {k, n}]

You can generate the polynomial convergents automatically, as was
discussed on this list quite recently:

pcf[e_] := Drop[#, -2]&@ NestWhile[
  Flatten@ {Drop[#, -2], PolynomialReduce @@ #[[{-1, -2}]], #[[-2]]}&,
  {Denominator@ #, Numerator@ #}&@ Together@ e,
  !TrueQ[#[[-2]] == 0]&]

In[3]:= pcf[Sum[1/d[k], {k, 4}]]

Out[3]= {0, a[1], -a[2], -a[1], -a[3], a[1], a[2], -a[1], -a[4], a[1],
-a[2], -a[1], a[3], a[1], a[2], -a[1]}

Then you can extract the indices and look up the sequence, e.g., in
Sloane's Encyclopedia of Integer Sequences:

In[4]:= % /. a -> (#&)

Out[4]= {0, 1, -2, -1, -3, 1, 2, -1, -4, 1, -2, -1, 3, 1, 2, -1}

Without the signs this is the ruler function. To account for signs,
consider that +/-n appears at positions (2*k + 1)*2^(n - 1) + 1 and the
signs are alternating (between positive and...well, not positive), so
the sign depends on Mod[k, 2]:

lcf[n_] := Module[
  {L = Range[2^n - 1], Lpow},
  Lpow = IntegerExponent[L, 2];
  Prepend[(-1)^(Quotient[Quotient[L, 2^Lpow] - 1, 2] + Mod[L, 2] + 1)*
    a /@ (Lpow + 1),
   0]
]

In[6]:= lcf[6] === pcf[Sum[1/d[k], {k, 6}]]

Out[6]= True

Note that the 33rd term is -a[6], not +a[6].

Maxim Rytin
m.r at inbox.ru
***********************************


  • Prev by Date: BesselJ integrals
  • Next by Date: Re: HoldPattern question
  • Previous by thread: Re: Smarter way to calculate middle-right terms of continued fraction partial sums
  • Next by thread: Re: Smarter way to calculate middle-right terms of continued fraction partial sums