1
$\begingroup$

Why I have this behaviour?

R /: Greater[R, 0] = True
R > 0
  => True
Simplify[Sqrt[R^2]]
  => Sqrt[R^2]

I expect R as last result.

$\endgroup$
  • $\begingroup$ You have to use assumptions: Simplify[Sqrt[R^2], Assumptions :> R > 0]. $\endgroup$ – Leonid Shifrin Mar 16 '13 at 15:14
  • $\begingroup$ @LeonidShifrin: No way to say that R is positive once for all? $\endgroup$ – enzotib Mar 16 '13 at 15:26
  • $\begingroup$ @LeonidShifrin: thanks for pointing to that question $\endgroup$ – enzotib Mar 16 '13 at 15:31
  • $\begingroup$ It's definitely best to work with $Assumptions, but if for some reason you don't want that, and want to avoid Simplify, then you could also just define R = Abs[r]. $\endgroup$ – Jens Mar 16 '13 at 15:42
2
$\begingroup$

One way to do this would be to keep a list of assumptions for your system, i.e.

assumptions = {R >= 0};
Simplify[Sqrt[R^2], Assumptions -> assumptions]

which returns R as expected.

$\endgroup$
  • $\begingroup$ There is no way to attach that information to R, so to avoid to recall the Assumptions option each time? $\endgroup$ – enzotib Mar 16 '13 at 15:19

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