0

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

InFei
  • 115
  • 4

1 Answers1

3

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}} *)

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198
  • 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? – InFei Sep 09 '23 at 01:58
  • Look at the documentation for Part – Bob Hanlon Sep 09 '23 at 02:50