From: mokambo on
Dear Group:

Consider the following sequence {0,3,2,1} which can be related to the
reference k: {0,1,2,3} as 4-k (mod 4).

I've tried to use FindSequenceFunction on problems like the example
above without success.
I understand I'm working within the context of modular arithmetic...
Does anyone have a suggestion on how to use Mathematica to tackle this
problem?

Alex

From: Albert Retey on
Hi,

> Consider the following sequence {0,3,2,1} which can be related to the
> reference k: {0,1,2,3} as 4-k (mod 4).
>
> I've tried to use FindSequenceFunction on problems like the example
> above without success.
> I understand I'm working within the context of modular arithmetic...
> Does anyone have a suggestion on how to use Mathematica to tackle this
> problem?

I think you would just need to repeat your sequence to make Mathematica
understand, obviously the task for FindSequenceFunction is a easier when
the sequences you feed it are longer:

FindSequenceFunction[{0, 4, 3, 2, 1, 0, 4, 3, 2, 1}]

gives:

Mod[1 + 4 #1, 5] &


hth,

albert

From: Bob Hanlon on

You are looking for a solution of the form

f[a_, b_] = Mod[a + b*#, 4] &;

seqIn = {0, 3, 2, 1};

seqOut = {0, 1, 2, 3};

sol =
Reduce[
Thread[
f[a, b] /@ seqIn == seqOut],
{a, b}, Integers]

Element[C[1] | C[2], Integers] &&
a == 4*C[1] && b == 4*C[2] + 3

Picking values for the arbitrary constants

sol /. {C[1] -> 1, C[2] -> -1}

a == 4 && b == -1

Verifying

f[4, -1] /@ seqIn == seqOut

True


Bob Hanlon

---- mokambo <alexandrepassosalmeida(a)gmail.com> wrote:

=============
Dear Group:

Consider the following sequence {0,3,2,1} which can be related to the
reference k: {0,1,2,3} as 4-k (mod 4).

I've tried to use FindSequenceFunction on problems like the example
above without success.
I understand I'm working within the context of modular arithmetic...
Does anyone have a suggestion on how to use Mathematica to tackle this
problem?

Alex


From: mokambo on
On Apr 22, 11:44 am, Albert Retey <a...(a)gmx-topmail.de> wrote:
> Hi,
>
> > Consider the following sequence {0,3,2,1} which can be related to the
> > reference k: {0,1,2,3} as 4-k (mod 4).
>
> > I've tried to use FindSequenceFunction on problems like the example
> > above without success.
> > I understand I'm working within the context of modular arithmetic...
> > Does anyone have a suggestion on how to use Mathematica to tackle this
> > problem?
>
> I think you would just need to repeat your sequence to make Mathematica
> understand, obviously the task for FindSequenceFunction is a easier when
> the sequences you feed it are longer:
>
> FindSequenceFunction[{0, 4, 3, 2, 1, 0, 4, 3, 2, 1}]
>
> gives:
>
> Mod[1 + 4 #1, 5] &
>
> hth,
>
> albert

Ok, but

FindSequenceFunction[{0, 3, 2, 1, 0, 3, 2, 1}]

really gives:

Mod[1 + 3 #1 + 2 #1^2 + 2 #1^3, 4] &

because of 1-based indexing. The alternative is to specify

FindSequenceFunction[Table[{k, Mod[4 - k, 4]}, {k, 0, 7}]]

resulting in

Mod[#1 (13 + 2 #1^2), 4] &

Now, how is this reduced to the cleaner 4-k?

From: Albert Retey on
Hi,

>
> Ok, but
>
> FindSequenceFunction[{0, 3, 2, 1, 0, 3, 2, 1}]
>
> really gives:
>
> Mod[1 + 3 #1 + 2 #1^2 + 2 #1^3, 4] &
>
> because of 1-based indexing. The alternative is to specify
>
> FindSequenceFunction[Table[{k, Mod[4 - k, 4]}, {k, 0, 7}]]
>
> resulting in
>
> Mod[#1 (13 + 2 #1^2), 4] &
>
> Now, how is this reduced to the cleaner 4-k?

Honestly, I have no idea, and I have heard about the function only from
your first post. I think it is obvious that FindSequenceFunction can
only find one of infinitely many solutions to the problem. Of course it
will not always find exactly the same solution that you have in mind.

Unfortunatly, Simplify and FullSimplify don't help with proving that the
two are the same:

FullSimplify[
FindSequenceFunction[{0, 3, 2, 1, 0, 3, 2, 1}, x] - Mod[4 - x, 4]]

I really don't know what you try to achieve, but I think that
FindSequenceFunction is probably just not the right tool. It is like
Simplify or FindInstance, they will both also find _a_ solution but are
no good to find a exactly one or one form of solution.

hth,

albert