Group Abstract Group Abstract

Message Boards Message Boards

0
|
8.7K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

Turning Inequalities into Equalities/Equations

Posted 11 years ago
POSTED BY: Conor Nelson
2 Replies

What about this?

eq = {2 x >= y, 2 z >= y, 2 x + y <= 4, 2 z + y <= 4}

FullForm@eq
(*List[GreaterEqual[Times[2,x],y],GreaterEqual[Times[2,z],y],LessEqual[Plus[Times[2,x],y],4],LessEqual[Plus[y,Times[2,z]],4]]*)
MapAt[(# /. {LessEqual :> Equal, GreaterEqual :> Equal}) &, eq, {{1}, {3}}]
(*{2 x == y, 2 z >= y, 2 x + y == 4, y + 2 z <= 4}*)
Posted 11 years ago

This is exactly what I needed. Thank you very much!

POSTED BY: Conor Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard