Re: Analyzing sequences of fractions in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg93712] Re: Analyzing sequences of fractions in Mathematica
- From: "Steve Luttrell" <steve at _removemefirst_luttrell.org.uk>
- Date: Mon, 24 Nov 2008 04:10:29 -0500 (EST)
- References: <200811200955.EAA20567@smc.vnet.net> <gg62qp$580$1@smc.vnet.net>
You were a little coy about exactly how you did it without using Mathematica
7 (perhaps you do these things every day - I don't), so I had a brief think
and here is what I guess you might have done:
mysequence = {1/8, 3/16, 11/32, 17/64, 25/128, 59/256, 147/512,
265/1024, 465/2048, 995/4096, 2171/8192, 4161/16384, 7881/32768,
16203/65536, 33571/131072, 65977/262144, 129025/524288,
260979/1048576, 529547/2097152, 1051505/4194304, 2083705/8388608,
4186715/16777216, 8423091/33554432, 16796521/67108864,
33466161/134217728, 67059203/268435456, 134443931/536870912};
Partition the numerator sequence using a sliding window of width n (choose
n=6, or whatever span you propose for the recurrence relation).
mat = Partition[Numerator[mysequence], 6, 1];
Solve for the vector of weights that linearly maps the first n-1 elements of
each window onto its last element - this vector defines a linear recurrence
relation.
LinearSolve[mat[[All, 1 ;; -2]], mat[[All, -1]]]
{-8, 4, 2, -1, 2}
QED
--
Stephen Luttrell
West Malvern, UK
"Eric W. Weisstein" <eww at wolfram.com> wrote in message
news:gg62qp$580$1 at smc.vnet.net...
> Steve Luttrell wrote:
>> Is your nice solution obtained using the "Integer Sequence Analysis"
>> methods
>> that have just been added to Mathematica 7
>> (http://www.wolfram.com/products/mathematica/newin7/content/IntegerSequenceAnalysis/)?
>
> I actually did it by finding the nice recurrence for the denominator
> myself, then using RSolve and simplifying a bit by hand.
>
> But yes, in V7, you can use FindLinearRecurrence[Numerator[mysequence]]
> out of the box.
>
> In[2]:= mysequence = {1/8, 3/16, 11/32, 17/64, 25/128, 59/256,
> 147/512, 265/1024, 465/2048, 995/4096, 2171/8192, 4161/16384,
> 7881/32768, 16203/65536, 33571/131072, 65977/262144, 129025/524288,
> 260979/1048576, 529547/2097152, 1051505/4194304, 2083705/8388608,
> 4186715/16777216, 8423091/33554432, 16796521/67108864,
> 33466161/134217728, 67059203/268435456, 134443931/536870912};
>
> In[3]:= FindLinearRecurrence[Numerator[mysequence]]
> Out[3]= {2, -1, 2, 4, -8}
>
> and then call RSolve on the linear recurrence generated from that kernel.
>
> Or you can just use FindSequenceFunction directly:
>
> In[6]:= FullSimplify[FindSequenceFunction[Numerator[mysequence]][n],
> n \[Element] Integers]
>
> Out[6]= (2^(
> 1 - n/2) (17 2^(3 n/2) Sqrt[1 + Sqrt[17]] (13 + 5 Sqrt[17]) +
> Sqrt[1 + Sqrt[
> 17]] (85 +
> 13 Sqrt[17]) (-I^n (-1 + Sqrt[17])^(n/2) + (1 + Sqrt[17])^(
> n/2)) Cos[(n \[Pi])/2] +
> Sqrt[2] (-I I^n (-1 + Sqrt[17])^(
> n/2) (-17 + 23 Sqrt[17]) - (1 + Sqrt[17])^(
> n/2) (323 + 75 Sqrt[17])) Sin[(n \[Pi])/2]))/(17 (1 + Sqrt[
> 17])^(3/2) (9 + Sqrt[17]))
>
> and with a bit of hand simplification, you get the result I posted.
>
> So you can see that indeed V7 has some nice new functionality which can
> be quite useful for analyzing integer (and even polynomial in some
> cases) sequences. I'm sure I will be using it quite often.
>
> Eric
>
- References:
- Re: Analyzing sequences of fractions in Mathematica
- From: "Steve Luttrell" <steve@_removemefirst_luttrell.org.uk>
- Re: Analyzing sequences of fractions in Mathematica