Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | ATOMS
File : Details
Login with GitLab

COMBINATIONS

COMBINES A N SIZE SET TO K SIZE SUBSETS
(1594 downloads for this version - 1594 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.
Login with GitLab
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.