Group Abstract Group Abstract

Message Boards Message Boards

0
|
82 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Transforming Equal Output to Include Inequality in Mathematica

Posted 3 days ago
set = {{2, a, 2 + a}, {1, 1, a}}
Equal @@ Divide @@ %

Execute the code to generate this equation.

2 == a == (2 + a)/a

However, I need the output in this specific form as follows. How can I adjust the code to achieve it?

2 != a == (2 + a)/a
POSTED BY: Wen Dao
2 Replies

Most likely there are more elegant versions, but this should work:

#1 @@ #2 & @@@ Transpose[{{Unequal, Equal}, Partition[Divide @@ set, 2, 1]}]

EDIT: Special requirements need special solutions, I guess ...

#1 != #2 == #3 & @@ (Divide @@ set)
POSTED BY: Henrik Schachner
Posted 1 day ago

Thank you! This approach can resolve this issue.

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