# Find relationship between values within finate range of integer domain

Update:

There are some misakes in the coefficient of left and right. But still get similar result.

I understand the mathematica gives me the result in sort of detailed expression. However I want the result simplified in the condition of left == right && 0<=b<8 && 0<=d<4, NonNegativeIntergers.

Assume a<4 && c < 2 we have: Apprently As long as right == left, then d == b %4. So I want to get simplified d = Mod[b, 4]. The condition right == left should already eliminate the assumption of a and c.

In the general case of a, c the conclusion still holds in the condition of that "As long as" above.

P.S. I tried to use the following, still not get what I want.

Reduce[left == right && 0 <= b < 8 && 0 <= d < 4 && a<2 && c < 4, d,  NonNegativeIntegers]


A simple question of calculation coordinates of axis align tensor.

left = 8 a + b
right = 4 c + d
Reduce[left == right && 0<=b<8 && 0<=d<4,d,NonNegativeIntegers ]


Got However I expect d = b % 4

  d = Mod[b, 4]


left = 4 a + b;
right = 8 c + d;

(sol = Solve[left == right && 0 <= b < 8 && 0 <= d < 4, d,
PositiveIntegers]) // InputForm

(* {{d -> ConditionalExpression[1,
(C >= 0 && Element[C,
Integers] && a ==
2 + 2*C && b == 1 &&
c == 1 + C) ||
(C >= 0 && Element[C,
Integers] && c ==
1 + C && a ==
1 + 2*C && b == 5)]},
{d -> ConditionalExpression[2,
(C >= 0 && Element[C,
Integers] && a ==
2 + 2*C &&
c == 1 + C && b == 2) ||
(C >= 0 && Element[C,
Integers] && c ==
1 + C && a ==
1 + 2*C && b == 6)]},
{d -> ConditionalExpression[3,
(C >= 0 && Element[C,
Integers] && a ==
2 + 2*C &&
c == 1 + C && b == 3) ||
(C >= 0 && Element[C,
Integers] && c ==
1 + C && a ==
1 + 2*C && b == 7)]}} *)


Checking whether d == Mod[b, 4]

(d == Mod[b, 4] /. sol //
FullSimplify[#, Element[C, NonNegativeIntegers]] &) //
InputForm

(* {ConditionalExpression[True,
c == 1 + C &&
((a == 1 + 2*C && b == 5) ||
(a == 2 + 2*C && b == 1))],
ConditionalExpression[True,
c == 1 + C &&
((a == 1 + 2*C && b == 6) ||
(a == 2 + 2*C && b == 2))],
ConditionalExpression[True,
c == 1 + C &&
((a == 1 + 2*C && b == 7) ||
(a == 2 + 2*C && b == 3))]} *)


d == Mod[b, 4]is only conditionally True; a, b, and c need to have appropriate values.

• Hi I update the questions, and correct the mistake in the left and right Aug 28 '20 at 5:52