1
$\begingroup$

I'm trying to use the following rule:

x[b,c,d]+x[a,c,d]+x[a,b,d]+x[a,b,c]->0

for all distinct integers a,b,c,d to simplify a messy expression with terms like

(x[b,c,d]+x[a,c,d]+x[a,b,d]+x[a,b,c])(x[i,j,k]+x[l,m,n])

but less recognizable.

I hope to find a way to define the rule so that I can use

FullSimplify[expression]/.r

However, it seems like I can only define r with a specific {a,b,c,d}. Is there a way to get a generic r that covers all {a,b,c,d}s?

Any help would be appreciated:D

$\endgroup$
3
  • $\begingroup$ Can you show what code you have tried so far? $\endgroup$
    – MarcoB
    Mar 4, 2020 at 15:13
  • $\begingroup$ What do you mean by "impose rules". You are going to solve an equation subject to that constraint? You are trying to simplify an expression according to that rule? Etc.? Each different thing you might do requires a different implementation in Mathematica, so can you be more specific? As an example: include a sample input with the desired output. $\endgroup$
    – march
    Mar 4, 2020 at 16:34
  • $\begingroup$ Thank you for your reply. I updated my question. Hope it is more clear now. $\endgroup$
    – TKS
    Mar 5, 2020 at 11:41

1 Answer 1

4
$\begingroup$

You can use Subsets and Total as follows:

Total[Subsets[x[a, b, c, d], {3}]] == 0

x[a, b, c] + x[a, b, d] + x[a, c, d] + x[b, c, d] == 0

Update: A function that constructs the desired expression:

ClearAll[f]
f[a_: x] := EqualTo[0] @* Total @* Map[Apply[a]] @* Subsets

Examples:

f[][{a, b, c, d}, {3}]

x[a, b, c] + x[a, b, d] + x[a, c, d] + x[b, c, d] == 0

f[z][{a, b, c, d}, {2}]

z[a, b] + z[a, c] + z[a, d] + z[b, c] + z[b, d] + z[c, d] == 0

f[w][{a, b, c, d}, {1, 2}]

w[a] + w[b] + w[c] + w[d] + w[a, b] + w[a, c] + w[a, d] + w[b, c] + w[b, d] + w[c, d] == 0

Update 2: You can use the expression produced by f as the second argument of FullSimplify:

expression = (x[b, c, d] + x[a, c, d] + x[a, b, d] +  x[a, b, c]) (x[i, j, k] + x[l, m, n]);

FullSimplify[expression, f[][{a, b, c, d}, {3}]]

0

Update 3: Similarly you can define a function that generates the desired Rule which can be used with ReplaceAll:

ClearAll[f2]
f2[a_: x] := Rule[#, 0] &@*Total@*Map[Apply[a]]@*Subsets

Examples:

rule = f2[][{a, b, c, d}, {3}]

x[a, b, c] + x[a, b, d] + x[a, c, d] + x[b, c, d] -> 0

expression /. rule

0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.