0
$\begingroup$

It is something from Simplifying polynomials with conditions on variables, that intend to minimize the number of variables. The problem is the usage of ``Solve". I know how to solve equations, like

Solve[x^2 + a x + 1 == 0, x]

However, for

Solve[pol == p + q + r - b && a + b == p + q + r, pol, {b, q, p, r}]

I am confused about "pol" and its position ``Solve[pol == p + q + r - b && a + b == p + q + r, ? , {b, q, p, r}]". I can not find any similar examples like this in the help document. How does it work? Is "pol" an expression or a variable? May I have more examples?

It is also posted at https://community.wolfram.com/groups/-/m/t/3008281?p_p_auth=Lpw74FtJ

$\endgroup$
0

1 Answer 1

3
$\begingroup$

With two equations you can generally solve for one variable while eliminating one variable. However, you get the same result solving for pol irrespective of the variable chosen for elimination (b | q | p | r).

Solve[pol == p + q + r - b && a + b == p + q + r, pol, {#}][[1]] & /@ 
  {b, q, p, r}

(* {{pol -> a}, {pol -> a}, {pol -> a}, {pol -> a}} *)

Further, in this case, Solve doesn't care if you ask to eliminate one or more variables.

Solve[pol == p + q + r - b && a + b == p + q + r, pol, #][[1]] & /@ 
 Subsets[{b, q, p, r}, {1, 4}]

(* {{pol -> a}, {pol -> a}, {pol -> a}, {pol -> a}, {pol -> a}, 
    {pol -> a}, {pol -> a}, {pol -> a}, {pol -> a}, {pol -> a}, 
    {pol -> a}, {pol -> a}, {pol -> a}, {pol -> a}, {pol -> a}} *)
$\endgroup$
2
  • $\begingroup$ Thanks for your reply. Another query is about the usage of "[[1]]". I think it means "Flatten". However, I can not find any similar examples(without the head but only two square brackets) in the help document of MMA 13.3. May I have more examples about this? $\endgroup$
    – InFei
    Sep 9 at 1:58
  • $\begingroup$ Look at the documentation for Part $\endgroup$
    – Bob Hanlon
    Sep 9 at 2:50

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