Group Abstract Group Abstract

Message Boards Message Boards

0
|
67 Views
|
5 Replies
|
5 Total Likes
View groups...
Share
Share this post:

How to output letter case relations based on size relations?

Posted 1 day ago
{a, b, c} = {Log[2, Sqrt[3]], Log[4, Sqrt[6]], Log[6, 3]}
Sort[%, Greater]

Based on the above code, we can obtain the size relationships of the three numerical values, which are assigned to the letters a, b, and c. How can we manipulate them so that the final result is in the form

a > b > c?

POSTED BY: Jim Clinton
5 Replies

Here is a way:

Clear[a, b, c];
numbers = {Log[2, Sqrt[3]], Log[4, Sqrt[6]], Log[6, 3]};
letters = {a, b, c};
Inactive[Greater] @@ Sort[numbers, Greater] /.
  Thread[numbers -> letters] // Activate
POSTED BY: Gianluca Gorni

Perhaps it wasn't clear what you meant. I thought something like the following:

{a, b, c} = Reverse@NumericalSort@{Log[2, Sqrt[3]], Log[4, Sqrt[6]], Log[6, 3]};
a > b > c
(*  True  *)
POSTED BY: Michael Rogers

Perhaps NumericalSort[list]? Or Reverse@NumericalSort[list].

POSTED BY: Michael Rogers
Posted 1 day ago

Perfect! Exactly what I needed.

POSTED BY: Jim Clinton
Posted 1 day ago

In the end, it's not the three numerical values that are displayed in order, but the assigned letters corresponding to the three values that are sorted, i.e., a > b > c.

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