Message Boards Message Boards

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

Solve equations with Mod/Abs?

Posted 6 years ago

Hi,

I have a huge number of equation systems like this:

Abs[Mod[-P1 - P2, 360] - Mod[P3, 360]] + 
  Abs[Mod[P1 + P2, 360] - Mod[P3, 360]] == 0, 
Abs[Mod[P1 - P2, 360] - Mod[P3, 360]] + 
  Abs[Mod[-P1 + P2, 360] - Mod[P3, 360]] == 0, 
Abs[Mod[P1 - P2, 360] - Mod[-P3, 360]] + 
  Abs[Mod[-P1 + P2, 360] - Mod[-P3, 360]] == 0, 
Abs[Mod[-P1 - P2, 360] - Mod[-P3, 360]] + 
  Abs[Mod[P1 + P2, 360] - 
    Mod[-P3, 360]] == 0, 
0 <= P1 <= 180, 0 <= P2 <= 180, 0 <= P3 <= 180

I would like to know if there is a solution at all and - of cause - the solution if it exist. However - most of the equation systems do not have a solution. Unfortunately Solve took forever to solve that example - other work better but require quite long. Is there is a way to speed up the process?

Thank you, Martin

POSTED BY: Martin Laabs
In[2]:= Reduce[{Abs[Mod[-P1 - P2, 360] - Mod[P3, 360]] + 
    Abs[Mod[P1 + P2, 360] - Mod[P3, 360]] == 0, 
  Abs[Mod[P1 - P2, 360] - Mod[P3, 360]] + 
    Abs[Mod[-P1 + P2, 360] - Mod[P3, 360]] == 0, 
  Abs[Mod[P1 - P2, 360] - Mod[-P3, 360]] + 
    Abs[Mod[-P1 + P2, 360] - Mod[-P3, 360]] == 0, 
  Abs[Mod[-P1 - P2, 360] - Mod[-P3, 360]] + 
    Abs[Mod[P1 + P2, 360] - Mod[-P3, 360]] == 0, 0 <= P1 <= 180, 
  0 <= P2 <= 180, 0 <= P3 <= 180}, {P1, P2, P3}, Integers]

Out[2]= (P1 == 0 && P2 == 0 && P3 == 0) || (P1 == 0 && P2 == 180 && 
   P3 == 180) || (P1 == 180 && P2 == 0 && P3 == 180) || (P1 == 180 && 
   P2 == 180 && P3 == 0)
POSTED BY: Frank Kampas
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