Message Boards Message Boards

0
|
1485 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Using Simplify for FractionalPart[x] and Mod[x,1] gives different results

Posted 1 year ago

See my following code snippet:

In[544]:= gensSG141ITA1={
 {{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0,0,0,1}},
 {{-1, 0, 0, 1/2}, {0, -1, 0, 1/2}, {0, 0, 1, 1/2}, {0,0,0, 1}},
 {{0, -1, 0, 0}, {1, 0, 0, 1/2}, {0, 0, 1, 1/4}, {0,0,0, 1}},
 {{-1, 0, 0, 1/2}, {0,  1, 0,  0}, {0,  0,  -1, 3/4}, {0,0,0, 1}},
 {{-1, 0, 0, 0}, {0, -1, 0, 1/2}, {0, 0, -1, 1/4}, {0,0,0, 1}},
 {{1, 0, 0, n1+1/2}, {0, 1, 0, n2+1/2}, {0, 0, 1, n3+1/2}, {0,0,0, 1}}
}; 
TransformationMatrix/@(AffineTransform[{#[[1;;3,1;;3]],#[[1;;3,4]]//FractionalPart//Simplify[#,Element[n1 | n2 | n3, Integers]]&}]&/@gensSG141ITA1)
TransformationMatrix/@(AffineTransform[{#[[1;;3,1;;3]],Mod[#[[1;;3,4]],1]//Simplify[#,Element[n1 | n2 | n3, Integers]]&}]&/@gensSG141ITA1)

Out[545]= {{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 
   1}}, {{-1, 0, 0, 1/2}, {0, -1, 0, 1/2}, {0, 0, 1, 1/2}, {0, 0, 0, 
   1}}, {{0, -1, 0, 0}, {1, 0, 0, 1/2}, {0, 0, 1, 1/4}, {0, 0, 0, 
   1}}, {{-1, 0, 0, 1/2}, {0, 1, 0, 0}, {0, 0, -1, 3/4}, {0, 0, 0, 
   1}}, {{-1, 0, 0, 0}, {0, -1, 0, 1/2}, {0, 0, -1, 1/4}, {0, 0, 0, 
   1}}, {{1, 0, 0, FractionalPart[1/2 + n1]}, {0, 1, 0, 
   FractionalPart[1/2 + n2]}, {0, 0, 1, FractionalPart[1/2 + n3]}, {0,
    0, 0, 1}}}

Out[546]= {{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 
   1}}, {{-1, 0, 0, 1/2}, {0, -1, 0, 1/2}, {0, 0, 1, 1/2}, {0, 0, 0, 
   1}}, {{0, -1, 0, 0}, {1, 0, 0, 1/2}, {0, 0, 1, 1/4}, {0, 0, 0, 
   1}}, {{-1, 0, 0, 1/2}, {0, 1, 0, 0}, {0, 0, -1, 3/4}, {0, 0, 0, 
   1}}, {{-1, 0, 0, 0}, {0, -1, 0, 1/2}, {0, 0, -1, 1/4}, {0, 0, 0, 
   1}}, {{1, 0, 0, 1/2}, {0, 1, 0, 1/2}, {0, 0, 1, 1/2}, {0, 0, 0, 
   1}}}

As you can see, using Simplify for FractionalPart[x] and Mod[x,1] gives different results. In this example, Simplify doesn't work in the former case.

Any hints for this subtle behavior?

Regards, Zhao

POSTED BY: Hongyi Zhao

Because is only True for: x>=0 :

    FullSimplify[FractionalPart[x] == Mod[x, 1], Assumptions -> x >= 0]
   (*True*)
   Plot[{FractionalPart[x], Mod[x, 1]}, {x, -2, 2}, 
    PlotStyle -> {Red, {Black, Dashed}}]
POSTED BY: Mariusz Iwaniuk
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract