1

Solve is an amazing tool, but sometimes it doesn't work in the way I expect it to. The particular instance that is confusing me right now is this:

Solve[a==b&&c==d,a]

I expect it to tell me that a->b, but instead it gives no solutions. I am using version 9, if this makes a difference.

To be clear, my question is not how do I fix this example (e.g. "Ian, just do Solve[a==b&&c==d,{a,c}]"), but rather, why does it think there are no solutions. Bonus if you can provide a tool that does think a->b is a solution.

Update:

Thanks to @MichaelE2 in the comments for the illustrative example -- it made obvious what was not obvious to me before; Solve performs a task which is only an approximation to the everyday meaning of the word "solve". When I think of the expression Solve[expr,vars], what I want it to do is treat every symbol not in the list vars as "known" and solve for the "unknown" symbols in vars. What it actually does is try to find a set of replacements for the symbols in vars such that expr/.soln is True.

This slight difference in meaning is usually not an issue, but for examples like the one above, and also ones like

Solve[{a==b,b==c},c]

these two meanings give very different, but respectively correct, answers.

I guess the updated question is just the bonus: is there a function which does a better job of approximating the "usual" definition of solve.

Ian Hincks
  • 1,859
  • 13
  • 21
  • It seems that the number of variables has to equal the number of equations, although I couldn't find this in the documentation for Solve. Try Solve[a==b&&c==d,{a, c}] – Jason B. Nov 06 '13 at 19:45
  • 2
    Compare with Solve[a == b || c == d, a], and note that c == d does not evaluate to True, unless c and d have values. – Michael E2 Nov 06 '13 at 19:46
  • 1
    @MichaelE2 I see, so an explanation for Solve better than the documentations "Solve[expr,vars]attempts to solve the systemexprof equations or inequalities for the variablesvars." would be "Solve[expr,vars]attempts to find replacement rules for the symbol(s in)varswhich cause the statementexprto beTrue`". – Ian Hincks Nov 06 '13 at 20:10
  • 1
    You don't have to specify all the variables. Solve provides generic solutions, to get the full solution set you should add this option MaxExtraConditions -> All or sometimes you'd better use Reduce. See What is the difference between Reduce and Solve?. – Artes Nov 06 '13 at 22:19

0 Answers0