0
$\begingroup$

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:

table explain

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

result

However I expect d = b % 4

  d = Mod[b, 4]
$\endgroup$
1
$\begingroup$
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[1] >= 0 && Element[C[1], 
       Integers] && a == 
       2 + 2*C[1] && b == 1 && 
      c == 1 + C[1]) || 
     (C[1] >= 0 && Element[C[1], 
       Integers] && c == 
       1 + C[1] && a == 
       1 + 2*C[1] && b == 5)]}, 
 {d -> ConditionalExpression[2, 
    (C[1] >= 0 && Element[C[1], 
       Integers] && a == 
       2 + 2*C[1] && 
      c == 1 + C[1] && b == 2) || 
     (C[1] >= 0 && Element[C[1], 
       Integers] && c == 
       1 + C[1] && a == 
       1 + 2*C[1] && b == 6)]}, 
 {d -> ConditionalExpression[3, 
    (C[1] >= 0 && Element[C[1], 
       Integers] && a == 
       2 + 2*C[1] && 
      c == 1 + C[1] && b == 3) || 
     (C[1] >= 0 && Element[C[1], 
       Integers] && c == 
       1 + C[1] && a == 
       1 + 2*C[1] && b == 7)]}} *)

Checking whether d == Mod[b, 4]

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

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

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

| improve this answer | |
$\endgroup$
  • $\begingroup$ Hi I update the questions, and correct the mistake in the left and right $\endgroup$ – worldterminator Aug 28 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.