This should be easy but I can't seem to find the right way to do it.
I have an equation of the form $a x + b x + c y + a z + d z = 0$, and I'd like to solve for relations between the parameters $a,b,c,d$, etc. such that the equation holds for all values of $x,y,z$, etc.
This is a very simplified example of the kind of equation I'm dealing with; there are actually 308 variables $x,y,\ldots$ and 42 parameters $a,b,\ldots$, making this nontrivial. As in the short sample equation, different variables could have the same parameter and could appear multiple times with different parameters.
So far my best attempt is:
Solve[ForAll[{x, y, ...}, a*x + b*y + ... == 0], {a, b, ...}]
This yields the correct solution on a smaller equation (about 20 variables and 9 parameters) but is far too slow for this one. Is there a more specific technique I could use that's more optimized for this kind of problem specifically? Leaving out ForAll
yields solutions in terms of the x-variables, which is kind of useless.
EDIT: nikie mentioned a much better way to do it (in the comments)! Thanks!
Answer
Coefficient[a x + b x + c y + a z + d z, #] == 0 & /@ {x, y, z} // Reduce[#, {a, b, c, d}] &
b == -a && c == 0 && d == -a
Comments
Post a Comment