Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2763 > unrolled thread

how to calculate an index and vice versa

Started byferradini <gianmarco.ferradini@email.it>
First post2011-05-28 11:20 +0000
Last post2011-05-29 11:36 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  how to calculate an index and vice versa ferradini <gianmarco.ferradini@email.it> - 2011-05-28 11:20 +0000
    Re: how to calculate an index and vice versa Ray Koopman <koopman@sfu.ca> - 2011-05-29 11:36 +0000

#2763 — how to calculate an index and vice versa

Fromferradini <gianmarco.ferradini@email.it>
Date2011-05-28 11:20 +0000
Subjecthow to calculate an index and vice versa
Message-ID<irqlpg$e9a$1@smc.vnet.net>
given n numbers (eg. 1 to 90)
I can build the following list of numbers k (in this case 4)

1, 2, 3, 4 associated index -> 0
1, 2, 3, 5 associated index -> 1
1, 2, 3, 6 associated index -> 2
1, 2, 3, 7 associated index -> 3
1, 2, 3, 8 ................... ....
1, 2, 3, 9 .......................
.......................
.......................
10, 41, 60, 61 associated index -> 954722
.......................
.......................
87, 88, 89, 90 associated index -> 2555190
I need to build an algorithm to assign eg 4 elemnti can obtain its index 
in the list
(1, 2, 3, 7 return 3)

The second algorithm is 'inverse: given a number such as 954722 I get 
the four elements 87; 88, 89, 90.
The elemnti in the list are always sorted values.

I thank those who will send me information on the subject to follow
Thank ferradini

[toc] | [next] | [standalone]


#2772

FromRay Koopman <koopman@sfu.ca>
Date2011-05-29 11:36 +0000
Message-ID<irtb3n$pim$1@smc.vnet.net>
In reply to#2763
On May 28, 4:20 am, ferradini <gianmarco.ferrad...@email.it> wrote:
> given n numbers (eg. 1 to 90)
> I can build the following list of numbers k (in this case 4)
>
> 1, 2, 3, 4 associated index -> 0
> 1, 2, 3, 5 associated index -> 1
> 1, 2, 3, 6 associated index -> 2
> 1, 2, 3, 7 associated index -> 3
> 1, 2, 3, 8 ................... ....
> 1, 2, 3, 9 .......................
> .......................
> .......................
> 10, 41, 60, 61 associated index -> 954722
> .......................
> .......................
> 87, 88, 89, 90 associated index -> 2555190
> I need to build an algorithm to assign eg 4 elemnti can obtain its index
> in the list
> (1, 2, 3, 7 return 3)
>
> The second algorithm is 'inverse: given a number such as 954722 I get
> the four elements 87; 88, 89, 90.
> The elemnti in the list are always sorted values.
>
> I thank those who will send me information on the subject to follow
> Thank ferradini

You want RankKSubset and UnrankKSubset, in Combinatorica.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web