How to order a set of real numbers?

Cinitiator
Messages
66
Reaction score
0

Homework Statement


How to order a set of real numbers, from the smallest to the largest, without knowing any members of the set, but knowing that there are finite members, and that these members are all real numbers?


Homework Equations


-

The Attempt at a Solution


Tried Googling without any success.
 
Physics news on Phys.org
Cinitiator said:

Homework Statement


How to order a set of real numbers, from the smallest to the largest, without knowing any members of the set, but knowing that there are finite members, and that these members are all real numbers?

Homework Equations


-

The Attempt at a Solution


Tried Googling without any success.

Is this for a computer science class? In other words are they after a sorting algorithm?

Otherwise, what does the question mean? You go through the numbers and pick the smallest; then you go through the remaining numbers and pick the smallest; etc.

If you're in an algorithms class they'll be interested in variations of that basic idea. Look up Bubble Sort if you're in a computer science class. But if it's a math class, I don't think I understand the question. Mathematically, the only aspect of this problem that's of interest is that if there are finitely many real numbers, there must be a smallest one. That's not necessarily true for an infinite collection.

(edit)
Is this a notation question? Something like {x_1, ..., x_n in R: i < j => x_i < x_j} ?

I noticed you had another set notation question in a different thread.
 
Last edited:
SteveL27 said:
Is this for a computer science class? In other words are they after a sorting algorithm?

Otherwise, what does the question mean? You go through the numbers and pick the smallest; then you go through the remaining numbers and pick the smallest; etc.

If you're in an algorithms class they'll be interested in variations of that basic idea. Look up Bubble Sort if you're in a computer science class. But if it's a math class, I don't think I understand the question. Mathematically, the only aspect of this problem that's of interest is that if there are finitely many real numbers, there must be a smallest one. That's not necessarily true for an infinite collection.

(edit)
Is this a notation question? Something like {x_1, ..., x_n in R: i < j => x_i < x_j} ?

I noticed you had another set notation question in a different thread.

Thanks for your input.

Let's say that A = {1, 7, 3, 5, 2}

I'm searching for a mathematical operation which would allow me to sort A from the smallest to the largest:

Asorted = {1, 2, 3, 5, 7}

I need this to be able to apply the order statistics operation "max" and "min" on a set, which outputs maximum and minimum extremes of a set, in order to be able to find out the largest number of a set.

To do this, I first need to sort the set, then to apply the max algorithm.

So to find the largest value of the A set, one would write max Asorted, or max{1, 2, 3, 5, 7}.
 
Cinitiator said:
Thanks for your input.

Let's say that A = {1, 7, 3, 5, 2}

I'm searching for a mathematical operation which would allow me to sort A from the smallest to the largest:

Asorted = {1, 2, 3, 5, 7}

I need this to be able to apply the order statistics operation "max" and "min" on a set, which outputs maximum and minimum extremes of a set, in order to be able to find out the largest number of a set.

To do this, I first need to sort the set, then to apply the max algorithm.

So to find the largest value of the A set, one would write max Asorted, or max{1, 2, 3, 5, 7}.

The max is the max no matter what order you present the elements of the set.

max {1, 2, 3, 4} is the same number (namely 4) as max {3, 1, 4, 2}.

And for that matter, the sets {1, 2, 3, 4} and {3, 1, 4, 2} are the same set. Set notation does not imply anything about the order of the elements.
 
Cinitiator said:

Homework Statement


How to order a set of real numbers, from the smallest to the largest, without knowing any members of the set, but knowing that there are finite members, and that these members are all real numbers?
Unless the set of real numbers is a finite set, there is no smallest member and there is no largest member.

Cinitiator said:
Thanks for your input.

Let's say that A = {1, 7, 3, 5, 2}

I'm searching for a mathematical operation which would allow me to sort A from the smallest to the largest:

Asorted = {1, 2, 3, 5, 7}

I need this to be able to apply the order statistics operation "max" and "min" on a set, which outputs maximum and minimum extremes of a set, in order to be able to find out the largest number of a set.

To do this, I first need to sort the set, then to apply the max algorithm.

So to find the largest value of the A set, one would write max Asorted, or max{1, 2, 3, 5, 7}.

You don't need to sort the set. You can make one pass through the unsorted set to pick out the largest. Here is some C code that would find the largest value of an array.
Code:
#include <stdio.h>
int A[] = {1, 7, 3, 5, 2};

int findMax(int []);  // prototype for the findMax function

int main(void)
{
   int max = findMax(A, sizeof(A));
   printf("The largest value is %d", max);
   return 0;
}

int findMax(int [] list, int size)
{
   // Choose a value that is certain to be smaller than any element in the list.
   int max = -1000000;  
   for (int i = 0; i < size; i++)
   {
      if (list[i] >= max)
      {
         max = list[i];
      }
   }
   return max;
}
 
There are two things I don't understand about this problem. First, when finding the nth root of a number, there should in theory be n solutions. However, the formula produces n+1 roots. Here is how. The first root is simply ##\left(r\right)^{\left(\frac{1}{n}\right)}##. Then you multiply this first root by n additional expressions given by the formula, as you go through k=0,1,...n-1. So you end up with n+1 roots, which cannot be correct. Let me illustrate what I mean. For this...
Back
Top