# How do I calculate the number of possible cases of polynomial equation (combinations) in Mathematica?

if I have the equation $$f(x_1,x_2,x_3,x_4)=x_1x_3+x_2x_4+x_1x_2x_4+x_1x_2x_3x_4$$

• How many equations are possible if two variables ?

when $x_1=x$ and the other four are y

when $x_2=x$ and the other four are y

when $x_3=x$ and the other four are y

when $x_4=x$ and the other four are y

I want to calculate the number of equations in each case

An example is if we have two variables. How many equation number we produce during compensation.

I suggest using combinations $C^2_4$ ... Is this true?

Can a program of work to calculate the number of possible cases if two variables

• And if three variables ....3 variables: if one variable is x, another is y and the other two are z, the we have .... possible cases; if one variable is x, the other two are y, and the other z, then we have ....possible cases.

• And the generalization of more than three.

For example: if I have

f[a_, b_, c_, d_, e_] := a d + b e + b c d - a b c d - a b d e - b c d e + a b c d e


2 variables: if one variable is x, and the other four are y, we have five polynomials;

f[x, y, y, y, y]

f[y, x, y, y, y]

f[y, y, x, y, y]

f[y, y, y, x, y]

f[y, y, y, y, x]


Account Functions. How many function is there because order of variables is necessary

if two variables are x and the other three are y, we have $C^2 _5$ = 10 polynomials.

f[x, x, y, y, y]

f[x,y , x, y, y]

f[x, y, y, x, y]

f[x, y, y, y, x]


. . . . . . . . . . . . .

 f[y, x, x, y, y]

f[y,x , y, x, y]

f[y, x, y, y, x]


.....................

f[y,y , x, x, y]

f[y, y, x, y, x]


.......................

f[y, y, y, x, x]


Is this possible?

thanks for the help.

• "the other four" - but you only have four. Apr 5, 2017 at 22:17
• @J.M. Thanks for the note See the new update Apr 5, 2017 at 22:23

I'm not quite sure what you need and I suspect your example is a reduced version of your actual problem, but a "brute force" approach is easily viable with only four parameters.

f[a_, b_, c_, d_] := a c + b d + a b d + a b c d

f2[a : {_, _, _, _}] := f @@@ Permutations[a] // Union

f2[{x, y, y, y}] // Column

x y + y^2 + x y^2 + x y^3
x y + y^2 + y^3 + x y^3

f2[{x, y, z, z}] // Column

x z + y z + x y z + x y z^2
x y + x y z + z^2 + x y z^2
x z + y z + x z^2 + x y z^2
x y + z^2 + x z^2 + x y z^2
x z + y z + y z^2 + x y z^2
x y + z^2 + y z^2 + x y z^2

f2[{w, x, y, z}] // Length

12

• I want to calculate the number of equations in each case An example is if we have two variables. How many equation number we produce during compensation Apr 5, 2017 at 22:34
• @Emadkareem Please edit your question to include explicit examples of what you mean. Apr 5, 2017 at 22:51
• See the new update Apr 5, 2017 at 23:00
• @Emad I don't understand. With your new example you seem to not want to eliminate equivalent polynomials (which is why I used Union) therefore I do not understand why the polynomial matters at all? Your values five and ten are directly computed with Multinomial[1, 4] and Multinomial[2, 3] -- is that all you want? Apr 5, 2017 at 23:04
• See the new update ...In the first case of the example you will understand the idea Apr 5, 2017 at 23:17