Not a duplicate question. I already tried all the Answers offered for this Question and they failed, so I believe this is a different problem with Solve[]
.
I have a solveable, consistent system of linear equations. The complete system is zAll, and {z1,z2,z3}
are subsets of it.
zAll = {};
y[x] := Sum[c[i]*x^i, {i, 1, 4}];
Do[
poly = Expand[D[(x^j)*Exp[y[x]], {x, i}]/Exp[y[x]]];
If[Exponent[poly, x] <= 8,
zAll = Append[zAll, (poly /. x^q_ -> m[q] /. x -> m[1])]],
{j, 0, 5}, {i, 1, 3}];
z1 = zAll[[{1, 3}]];
z2 = zAll[[{5, 7, 8, 9}]];
z3 = zAll[[{2, 4, 6}]];
I need to solve for {m[5],m[6],m[7],m[8]}
in terms of {m[1],m[2],m[3],m[4],c[1],c[2],c[3],c[4]}
This can be done with just the subset z2
:
m5678=Solve[z2 == 0, {m[5], m[6], m[7], m[8]}]
That the system zAll
is consistent can be proven by showing that the solutions to z1
and z2
reduce z3
to zeroes:
m34 = Solve[z1 == 0, {m[3], m[4]}];
z3 /. m5678 /. m34 // Expand // Together
(* {{{0, 0, 0}}} *)
My problem is that in related linear system problems, it's not really possible to hand-pick the subset that does the trick. So how can I make MMa solve this solveable problem starting with the entire system zAll
?
This fails, returning an empty set solution:
Solve[zAll == 0, {m[5], m[6], m[7], m[8]}]
This hack sort of works, but it returns ugly, ugly solution because of the undesired elimination of m[3]
and m[4]
as variables:
Solve[zAll == 0, {m[3], m[4], m[5], m[6], m[7], m[8]}]
I don't want to Eliminate m[3]
and m[4]
, I want them in a tidy solution like the m5678
above, but without having to hand-pick a subset.
ADDENDUM TO QUESTION
@bbgodfrey gave a very helpful Answer below that partly fixed my problem but raised a new mystery. He suggested using this instruction:
s = Solve[zAll == 0, {m[5], m[6], m[7], m[8]}, MaxExtraConditions -> Automatic]
This returns exactly the result I want, but as a ConditionalExpression, with conditions on the values of m[1] and m[2]. But those "conditional" values of m[1] and m[2] are verifiably true in this linear system. In fact, the hack with ugly results (that I complained about in my Question) returns values of m[1] and m[2] equivalent to these "conditional" values.
So, why is MMa correctly solving for those values in my hack, but lists them as conditions when you apply @bbgodfrey's method?
And how can I fix this. I am cautious about just accepting that conditions are true, because some similar problem might return additional conditions that aren't true.
documentation section for
Solve` contains this important bullet item: "Solve gives generic solutions only. Solutions that are valid only when continuous parameters satisfy equations are removed. Other solutions that are only conditionally valid are expressed as ConditionalExpression objects." This may address your question regardingSOlve
behavior. $\endgroup$