MathGroup Archive 2009

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

Search the Archive

Re: When Wolfram's technical support cannot help

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105270] Re: When Wolfram's technical support cannot help
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Wed, 25 Nov 2009 23:01:04 -0500 (EST)
  • References: <hej3pj$d77$1@smc.vnet.net>

Hi Ant,

I'd say you're rather unkind to tech support. I'm amazed that they
took your question at all. I wouldn't have thought of offloading my
programming tasks to tech support, thinking that these guys would be
for bugs, installation issues etc.

Anyways, would

data2 /. {x___, Longest[Shortest[Repeated[y__, {2, Infinity}]]]} ->
{y}

suffice for you? It returns the smallest repeating subsequence, if
there is any, and otherwise returns the list unevaluated.

It's rather slow for longer lists. For that you should try cutting up
the list in sublists (Partition[data2, 3, 3, {-1, -1}, {}])  and
testing these for equality, and then repeat for all possible sublist
lengths etc. But you require a single function, for some mystical
reason, don't you? I don't think there is any built-in.

Cheers -- Sjoerd

On Nov 25, 1:18 pm, "Ant King" <mathstutor... at ntlworld.com> wrote:
> Hi
>
> I sent this email to technical support (as I hold a premier licence)
>
> I am looking for a single function that will extract the cyclic part of (a)
> a completely cyclic sequence and (b) an eventually cyclic sequence. So if
>
> data1={1,2,3,1,2,3,1,2,3,1,2,3} then cyclicpart[data1] should return {1,2,3}
>
> And if
>
> data2={5,9,11,8,1,2,3,1,2,3,1,2,3,1,2,3} then cyclicpart[data2] should also
> return {1,2,3}
>
> And this was the reply that I got
>
> Here is one way to extract out the cyclic part:
>
> lis = Flatten[Join[Table[{1, 2, 3}, {8}]]]
>
> p = Position[Table[BitXor[lis, RotateLeft[lis, i]], {i, 1, 10}],
>     ConstantArray[0, Length[lis]]][[1]] /. {a_} -> a
> lis[[1 ;; p]]
>
> The above however will only work for case where the list always contains
> the repeated pattern.
>
> There is no built-in function as such that will extract out the pattern
> automatically. I have filed a suggestion with our developers and you will
> be notified when this suggestion gets implemented. Again, my apologies for
> the delay and my thanks for your patience.
>
> Now I don't believe that. I think that it should be quite achievable. Anyone
> got any ideas
>
> Thanks a lot
>
> Ant



  • Prev by Date: Re: Re: Color depth - Wikipedia, the free
  • Next by Date: Re: Re: newbie q-n about FinancialData
  • Previous by thread: Re: When Wolfram's technical support cannot help
  • Next by thread: Re: When Wolfram's technical support cannot help