0
$\begingroup$

I'm using Reduce to solve some equations and then simplify to eliminate some undesired results. The problem is that, when I apply Simplify, it messes with my output from reduce. As an example:

    eq = Cos[x] + Sin[x] == y
    Reduce[eq, x]
    Simplify[Reduce[eq, x]]

My outputs are

    (C[1] \[Element] Integers && y == -1 && (x == -(\[Pi]/2) + 2 \[Pi] C[1] || x == \[Pi] + 2 \[Pi] C[1])) || (C[1] \[Element] Integers && 1 + y != 0 && (x == 2 ArcTan[(1 - Sqrt[2 - y^2])/(1 + y)] + 2 \[Pi] C[1] ||x == 2 ArcTan[(1 + Sqrt[2 - y^2])/(1 + y)] + 2 \[Pi] C[1]))

And with Simplify:

    (C[1] \[Element] Integers && y == -1 && (\[Pi] + 2 x == 4 \[Pi] C[1] || \[Pi] + 2 \[Pi] C[1] ==x)) || (C[1] \[Element] Integers && 1 + y != 0 && (x == 2 (ArcTan[(1 - Sqrt[2 - y^2])/(1 + y)] + \[Pi] C[1]) || x == 2 (ArcTan[(1 + Sqrt[2 - y^2])/(1 + y)] + \[Pi] C[1])))

Of course, Simplify here is not necessary, but my real equations are rather long to put here. My point is, when I use simplify, I get x to the lhs, so I can't use ToRules to make a list of rules from my output. I sounds like a silly question, but I've tried a lot of different things and I cant figure it out how to do it...

Thank you so much

$\endgroup$
  • $\begingroup$ I can make it work for some cases: ToRules[x - a == b + c + d] /. ((x + lhs_) -> rhs_) :> (x -> (-lhs + rhs)) will produce the desired result, but if my lhs is (-x+a) it won't work... $\endgroup$ – Fábio Sep 5 at 1:22
  • $\begingroup$ Sometimes you get x==complicated and you would like x==simple but Simplify thinks the result is simpler if it pushes things across the ==. For those cases try x==complicated/.Equal[left_,right_]:>Equal[Simplify[left],Simplify[right]]` For x+complicated==morecomplicated try x+complicated==morecomplicated /.Equal[left_,right_]:>Solve[Equal[left,right],x] or even replace that Solve with Reduce and see if that works for you. If you can show more specific examples that still don't work then perhaps someone can show a general method that works for you. $\endgroup$ – Bill Sep 5 at 4:43
  • $\begingroup$ Well, it's working so far. I'll try to come with a more general method if someone comes with the same issue. Thank you! $\endgroup$ – Fábio Sep 6 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.