# How to write the product identity in Mathematica?

Posted 10 years ago
9128 Views
|
8 Replies
|
11 Total Likes
|
 Is there anybody can help me to write and excute the following product identity in Mathematica?Thanks a lot for your support
8 Replies
Sort By:
Posted 10 years ago
 You can also take advantage of the relatively new iterator conventions:Product[1 - x[l], {l, 1, k}] ==  Sum[(-1)^l*Product[x[t], {t, n}], {l, 0, k}, {n, Subsets[Range[k], {l}]}]This is another way to implement index restrictions, with programming constructs, e.g.,Product[1 - x[l], {l, 1, k}] ==Sum[(-1)^l/l! Product[x[t], {t, n}], {l, 0, k}, {n, Select[Tuples[Range[k], l], UnsameQ @@ # &]}]
Posted 10 years ago
 Thanks!
Posted 10 years ago
 Hi Yahia,if you are inclined to implement the formula as it stands, then you might type Remove[args, cond, X, prod, iter, Y, alghoraniLHS, alghoraniRHS] args[l_Integer] :=   ToExpression[StringJoin["o", ToString[#]] & /@ Range[l]] prod[l_Integer] := Times @@ Thread[x[args[l]]] cond[l_Integer] :=   If[And @@ (X @@@ Union[Sort /@ Permutations[args[l], {2}]]), 1, 0] iter [m_Integer, l_Integer] := {#, 1, m} & /@ args[l] /; m >= l alghoraniLHS[K_Integer?Positive] := Product[(1 - x[o]), {o, 1, K}] alghoraniRHS[K_Integer?Positive] := 1 + Sum[(-1)^l/l! Y[cond[l] prod[l], Sequence @@ iter[K, l]], {l, 1,      K}] /. {Y :> Sum, X :> Unequal}into your keyboard. The args function ensures that all functions have the same variables in use. See an exampleIn[94]:= alghoraniRHS[4]Out[94]= 1 - x[1] - x[2] - x[3] - x[4] + x[1] x[2] x[3] x[4] + 1/2 (2 x[1] x[2] + 2 x[1] x[3] + 2 x[2] x[3] + 2 x[1] x[4] +     2 x[2] x[4] + 2 x[3] x[4]) + 1/6 (-6 x[1] x[2] x[3] - 6 x[1] x[2] x[4] - 6 x[1] x[3] x[4] -     6 x[2] x[3] x[4])Check a case - it runs considerably longer than the SymmetricPolynomial[], of course - all the permutations have to be sorted outIn[100]:= Expand[alghoraniLHS[7]] - alghoraniRHS[7] // SimplifyOut[100]= 0The  multiple sums to find terms one knows in advance are computing time wastersIn[109]:= Expand[alghoraniLHS[9]] - alghoraniRHS[9] // SimplifyOut[109]= 0Please note that even alghoraniRHS[] doesn't go the whole nine yards of implementing the formula because it has the l = 0 term, the 1, in front of it. Can you find a solution without that?Pleaso note also, that Union[Sort /@ Permutations[...]] is bad style, because it filters out ... permutations. RegardsUdo.
Posted 10 years ago
Posted 10 years ago
 Thanks for your interest. In fact, the target of my question how to put condition or exclusions to Sum or product when you have such equations?..regards,Yahia
Posted 10 years ago
 To put conditions on terms in Sums and Products you have many possibilities, the simplest isIn[18]:= Sum[If[o1 != o2 && o1 != o3 && o1 != o4              && o2 != o3 && o2 != o4              && o3 != o4, 1, 0] x[o1] x[o2] x[o3] x[o4],              {o1, 1, 2}, {o2, 1, 3}, {o3, 1, 4}, {o4, 1, 5}]Out[18]= 8 x[1] x[2] x[3] x[4] + 4 x[1] x[2] x[3] x[5] + 2 x[1] x[2] x[4] x[5] + x[1] x[3] x[4] x[5] + x[2] x[3] x[4] x[5]You must not necessarily write such an ulgy If[], there is the KroneckerDelta[], there are totally antisymmetric tensors built-in for some of the standard cases in filtered sums and/or products.RegardsUdo.
Posted 10 years ago
 However, I have assume that K=2, and have got a result as follows In[82]:= Sum[(-1)^l/l!* Sum[Product[Subscript[x, Subscript[n, t]], {t, 1, l}] Boole[ Subscript[n, 1] != Subscript[n, 2]], {Subscript[n, 1], 1, 2}, {Subscript[n, 2], 1, 2}], {l, 0, 2}]                         Out[82]= 2 - Subscript[x, 1] - Subscript[x, 2] + Subscript[x, 1] Subscript[x, 2]Which is not match with the fact that In[83]:= Product[1 - Subscript[x, l], {l, 1, 2}]Out[83]=1 - Subscript[x, 1] - Subscript[x, 2] + Subscript[x, 1] Subscript[x, 2]I think there is something wrong with the method of putting exclusions such as Boole on the above Sum. I will be happy to get your suggestions.Thanks a lotRegards,Yahia
Posted 10 years ago
 Hi Yahia,what you have to do here on the right hand side is - given in utterly ugly notation in the exercise - simply to sum up the symmetric functions of {x1, x2, ..., xl}of 1, 2, ..., l arguments augmented with the right sign. So you have for K = 11 - x1 = 1 - x1and for K = 2(1 - x1) (1 - x2) == 1 - x1 - x2 + x1 x2x1 and x2 are the both symmetric functions of 1 argument, x1 x2 is the single symmteric function of two arguments in {x1,x2}. Please note that using the SymmetricPolynomial allows you to get rid of the Factorial[] because ofx1 x2 = 1/2 (x1 x2 + x2 x1)and in general you have an expression as simple asIn[14]:= With[{K = 19},   Product[1 - x[o], {o, 1, K}] ==    Sum[(-1)^l SymmetricPolynomial[l, Array[x, K]], {l, 0, K}]  ] // FullSimplifyOut[14]= TrueInstead of Subscript[x,1] one used x[1] with advantage, as you see.RegardsUdo.