It appears the Mathematica doesn't have a function to automatically Simplify
a relational expression by squaring both sides.
However, one can accomplish this by providing a TransformationFunction
to Simplify.
For example:
tf1[a_ < b_] := a^2 < b^2
Simplify[Sqrt[x^2 + y^2] < 2, TransformationFunctions ->{tf1, Automatic}]
(* x^2 + y^2 < 4 *)
However, tf1
only works for a LessThan
relation.
Simplify[Sqrt[x^2 + y^2] > 2, TransformationFunctions -> {tf1, Automatic}]
(* Sqrt[x^2 + y^2] > 2 *)
But this can be fixed by adding an Alternatives
pattern of relations. (Learned from Simplify equations with pattern assumptions )
relationOperators = Equal | Unequal | Greater | Less | GreaterEqual | LessEqual
tf2[l_~(relOp : relationOperators)~r_] := (l^2)~relOp~(r^2)
Table[Simplify[Sqrt[x^2 + y^2]~op~ 2, TransformationFunctions -> {tf2, Automatic}], {op, Level[relationOperators, -1]}]
(* {x^2 + y^2 == 4, x^2 + y^2 != 4, x^2 + y^2 > 4, x^2 + y^2 < 4, x^2 + y^2 >= 4, x^2 + y^2 <= 4} *)
Additionally, TransformationFunction can be expanded to only apply under the Condition
that operands are Reals
or relation is Equal
or Unequal
. (Learned from How to select TransformationFunctions based on Assumptions made when using Simplify? )
tf3[l_~(relOp : relationOperators)~r_] /; Simplify[(l \[Element] Reals) && (r \[Element] Reals) || relOp == Equal || relOp == Unequal] := (l^2)~relOp~(r^2)
Table[Simplify[Sqrt[x^2 + y^2]~i~ 2, TransformationFunctions -> {tf3, Automatic}], {i, Level[relationOperators, -1]}]
(* {x^2 + y^2 == 4, x^2 + y^2 != 4, Sqrt[x^2 + y^2] > 2, Sqrt[x^2 + y^2] < 2, Sqrt[x^2 + y^2] >= 2, Sqrt[x^2 + y^2] <= 2} *)
Assuming[{x, y} \[Element] Reals, Table[Simplify[Sqrt[x^2 + y^2]~i~ 2, TransformationFunctions -> {tf3, Automatic}], {i, Level[relationOperators, -1]}]]
(* {x^2 + y^2 == 4, x^2 + y^2 != 4, x^2 + y^2 > 4, x^2 + y^2 < 4, x^2 + y^2 >= 4, x^2 + y^2 <= 4} *)
Simplify[]
is unlikely to do this for you. $\endgroup$x
andy
are real, just square both sides:expr = Sqrt[x^2 + y^2] < 2; expr2 = #^2 & /@ expr
$\endgroup$