Message Boards Message Boards

1
|
1609 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Solve equations that involve Mod?

Posted 1 year ago

I try to solve the following equations but failed:

In[641]:= Solve[{Mod[{1/s,1/s,1/s}, 1] == {0,0,0}}, {s},Rationals]

During evaluation of In[641]:= Solve::nsmet: This system cannot be solved with the methods available to Solve.

Out[641]= Solve[{{Mod[1/s, 1], Mod[1/s, 1], Mod[1/s, 1]} == {0, 0, 
0}}, {s}, Rationals]

I'm not sure whether there are available methods to tackle this problem.

Regards,
Zhao

POSTED BY: Hongyi Zhao
2 Replies
Posted 1 year ago

Based on your suggestion, I further modified the method as follows:

In[69]:= Solve[Mod[{1/s, 1/s, 1/s}, 1] == {0, 0, 0}, s,Reals, Assumptions -> Abs[s] >= 1]//RepeatedTiming
Solve[Mod[{1/s, 1/s, 1/s}//Abs, 1] == {0, 0, 0}, s,Integers]//RepeatedTiming

Out[69]= {0.0776961, {{s -> -1}, {s -> 1}}}

Out[70]= {0.458132, {{s -> -1}, {s -> 1}}}

To my surprise, the first method is more efficient.

Regards, Zhao

POSTED BY: Hongyi Zhao
Posted 1 year ago
In[1]:= Solve[Mod[{1/s, 1/s, 1/s}, 1] == {0, 0, 0}, s, Rationals, Assumptions -> s >= 1]
Out[1]= {{s -> 1}}

Another, including -1:

In[2]:= Solve[Mod[{1/Abs@s, 1/Abs@s, 1/Abs@s}, 1] == {0, 0, 0}, s, Integers]
Out[2]= {{s -> -1}, {s -> 1}}
POSTED BY: Hans Milton
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