leftimage for poohprod.ru

Permutations and Combinations

When we talk of permutations and combinations we often use the two terms interchangeably.

In statistics, the two each have very specific meanings.

The permutation of a number of objects is the number of different ways they can be ordered: the position is important. With combinations, one does not consider the order in which objects were placed.

This algorithm (program in Matlab) calculates the number of permutations and combinations of N objects taken D at a time.

The full Matlab code is:

% Clears variables and screen
clear; clc

% Asks user for input
n = input('Total number of objects: ');
d = input(
'Size of subgroup: ');

% Computes and displays permut. according to basic formulas
p = 1;
for i = n - d + 1 : n
p = p*i;

end
str1 = [num2str(p) ' permutations'];
disp(str1)

% Computes and displays combin. according to basic formulas
str2 = [num2str(p/factorial(d)) ' combinations'];
disp(str2)

Example 1:


How many permut. and combin. can be made of the 26 letters of the alphabet, taking five at a time?

We run the code above and enter:

Total number of objects: 26
Size of subgroup: 5

The answer is:

7893600 permutations
65780 combinations


Example 2:


How many different ways can 12 computers be repaired if the workshop can only support 2 at a time?

We run the Matlab m-file above and enter:

Total number of objects: 12
Size of subgroup: 2

The answer (with no doubt) is:

132 permutations

66 combinations


From 'Permutations and Combinations' to home

From 'Permutations and Combinations' to 'Probability and Stats' Menu

Top



footer for permutations and combinations page



Related pages


compute compound interestslope and point calculatorhow to graph functions in matlabinverse of matrix in matlabsurface plot in matlabsquare feet inches calculatorlinespace matlab5 band resistance calculatorbabylonian square rootnominal interest rate formula3d surface plot matlablu decomposition matlab codeoctal to decimal conversion examplesexample of a piecewise functionhow to find factorialsbuilt in functions matlabfactorial formulaseries of trigonometric functionsprograming in matlablinear algebra in matlabkvl and kcl solved problemsmatlab bisection methodhow to calculate fibonacci sequencebisection method calculatorwap to calculate factorial of a numberlinear fitting matlabinterpolation using matlabbinary to decimal conversion programlagrange polynomial examplecapacitor calculation for power factor correctionmatlab cosinedelta di diracdepreciation formula excelcurve fitting matlab commandhow to solve piecewise functionwrite a program of fibonacci seriespascal for loopsimpson's rule matlabrem matlabroots and zerosauto scrap valuematlab script tutorialsolve matrices in matlabprogram to convert binary to decimalmatlab handlesevaluate the definite integral calculatorbinary hexadecimal tablehow to solve polynomial equation in matlabmatlab chartfibonacci constantstring in matlabexamples of piecewise functionsexample of bisection methodexponential curve fitting matlabmatrix exponential calculatorconverter binary to octalalphabet to asciisolve quadratic equation matlabmatlab floormatlab surf examplesum harmonic seriessalvage value formulastd matlabmatlab programming exercisesmatlab switch casekcl circuithow to create an amortization tablematlab random number generationconvert polar to cartesian coordinatesperiodic function examplehypotenuse calculatorhow to graph a piecewise functionconvert octal to binarydefinition of impulse functionmatlab plot polynomialinverse of a matrix by gauss jordan method