Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | ATOMS
File : Details
Please login or create an account
Dear visitors/customers, we are migrating most of Scilab services into a new data center.
Note that login/registration will not be available for the moment.

COMBINATIONS

COMBINES A N SIZE SET TO K SIZE SUBSETS
(381 downloads for this version - 381 downloads for all versions)
Details
Version
1.0
Author
JFER GIRJ
Maintainer
JFER Girj
Category
License
Supported Scilab Version
5.4
Creation Date
April 16, 2012
Description
            //THIS FUNCTION COMBINES A N SIZE SET TO K SIZE SUBSETS 
//WITH OR WITHOUT REPETITION
//JOSE-FERNANDO GIRALDO-J
//2012

//NOTICE THAT THIS FUNCTION IS RECURSIVE AND DOES NOT NEED TO CALCULATE
FACTORIALS


Use:

combine(set,size,repeat)

set: a column vector with elements to combine

size: integer. Defines the size of subsets

repeat: boolean. Defines if elements repetition is allowed in each combination

i.e:

elements=['dog';'cat';'bird';'mouse']

combinations=combine(elements,3,%F)

combinations  =
 
!dog  cat   bird     !
!                    !
!dog  cat   mouse    !
!                    !
!dog  bird  mouse    !
!                    !
!cat  bird  mouse    !


combinations=combine(elements,2,%T)

combinations  =
 
!dog    dog      !
!                !
!dog    cat      !
!                !
!dog    bird     !
!                !
!dog    mouse    !
!                !
!cat    cat      !
!                !
!cat    bird     !
!                !
!cat    mouse    !
!                !
!bird   bird     !
!                !
!bird   mouse    !
!                !
!mouse  mouse    !            
Files (1)
[1.24 kB]
Miscellaneous file

News (0)
Comments (4)     Leave a comment 
Comment from JFER Girj -- April 17, 2012, 11:59:23 PM    
Hello SAMUEL

means this is not useful?

thanks for your response

JF
Comment from Samuel Gougeon -- July 9, 2012, 01:43:34 PM    
Hello JF,

My remark meant that now we are at least two to convince
the operational team to include into Scilab this "basic" 
function available on most of scientific pocket calculators.
That is to say: That it is common, because it is useful.

Regards
Samuel
Comment from JFER Girj -- July 9, 2012, 02:58:40 PM    
Hello SAMUEL

Thank you for your explanation

regards

JF

Leave a comment
You must register and log in before leaving a comment.
Email notifications
Send me email when this toolbox has changes, new files or a new release.
You must register and log in before setting up notifications.