5
$\begingroup$

I'm at Day 1 of using Mathematica and I'm having trouble understanding why Solve behaves in certain ways. I'm considering the following equations:

EQ1 =  y^(-1 + a) - (c - y)^(-1 + a)  == 0
EQ2 =  b*y^(-1 + a) - (c - y)^(-1 + a)  == 0

and don't understand why Solve[EQ1,y] successfully solves for y but Solve[EQ2, y] fails. Certainly the values taken by {a,b,c} matter here, but I'm not sure how adding b makes the task impossible, given that I'm not making any assumptions about a and still getting a solution for Solve[EQ1, y].

Finally, why does Solve[{EQ1, a > 1}, y] fail as well?

Thanks for any help!

$\endgroup$
11
  • $\begingroup$ Capital letters can be reserved variables (i.e I, C) ... K::usage "K is a default generic name for a summation index in a symbolic sum." ... this may be part of your problem $\endgroup$
    – Young
    Commented Jan 31, 2017 at 18:24
  • $\begingroup$ @Young Good to know, thanks for the suggestion - just changed K to c and am experiencing same issues. $\endgroup$
    – Vlad
    Commented Jan 31, 2017 at 18:30
  • 3
    $\begingroup$ If you make the slight change of replacing both -1+a with aminus1 then solve is happy to solve both of them $\endgroup$
    – Bill
    Commented Jan 31, 2017 at 19:04
  • 3
    $\begingroup$ @Feyre I disagree. The question is not due to a simple mistake. Additionally, the workaround is simple when you know it, but it had certainly not occurred to me. Finally, I'd say that this may help future visitors, at least in that it provides them an extra trick to try on gnarly problems. $\endgroup$
    – MarcoB
    Commented Jan 31, 2017 at 21:03
  • 1
    $\begingroup$ @Feyre I agree with Marco. The existence of a workaround is not grounds for closing. Also an answer from someone who understands why Solve behaves this way would be very useful. $\endgroup$ Commented Jan 31, 2017 at 21:20

1 Answer 1

6
$\begingroup$

Sometimes if you simplify a problem, without changing the essence of the problem, you can get Solve or Reduce to much more quickly find a solution, or in this case to find a solution at all.

This tactic typically applies when an expression is used more than once and consists of one or more variables and or constants, but none of those variables are ever used outside those expressions and the problem would simpler, but effectively unchanged if those expressions were replaced by a single new variable.

When this trick applies, particularly for gnarly multivariate problems, this can be a powerful trick and can sometimes speed up the solution by orders of magnitude.

In this problem, since the variable a always appears as (-1+a), I tried replacing that with a simple variable, call it Z. Then

{Solve[y^Z - (c - y)^Z == 0, y], Solve[b*y^Z - (c - y)^Z == 0, y]}

instantly returns solutions for both, with the usual warning that Solve will sometimes use an inverse function.

But even this doesn't seem to be enough to enable Reduce to find all solutions in any reasonable amount of time.

$\endgroup$
2
  • $\begingroup$ It seems like it should be possible to look for such simplifications automatically, which would make a neat wrapper for Solve $\endgroup$ Commented Jan 31, 2017 at 21:30
  • $\begingroup$ Thanks @Bill ! The equations I posted here were actually much simpler versions of the ones I initially encountered problems with. Using multiple substitution tricks like you proposed made it work. $\endgroup$
    – Vlad
    Commented Jan 31, 2017 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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