# How to simplify the formula under the quadratic root sign? [duplicate]

The following formula is given：

Clear["Global*"]
expr = EuclideanDistance[{m, 2 Sqrt[m]}, {5, 0}]
eqn = Assuming[Element[{x, y, m}, Reals], Simplify[expr]]


Where m>=0,

1. How to make the calculated (sqrt (m)) ^ 2==m, and display the results in Abs (m) after the software calculation.The result should be:
Sqrt[(-5 + m)^2 + 4 m]

1. How to formula the polynomial in the quadratic root of the final result to get the final result:
Sqrt[16 + (-3 + m)^2]


Update 1:

Clear["Global*"]
"The expression is not quadratic in the variables 1";
CompleteTheSquare[expr_] := CompleteTheSquare[expr, Variables[expr]]
CompleteTheSquare[expr_, Vars_Symbol] :=
CompleteTheSquare[expr, {Vars}]
CompleteTheSquare[expr_, Vars : {__Symbol}] :=
Module[{array, A, B, C, s, vars, sVars},
vars = Intersection[Vars, Variables[expr]];
Check[array = CoefficientArrays[expr, vars], Return[expr],
CoefficientArrays::poly];
Return[expr]];
{C, B, A} = array; A = Symmetrize[A];
s = Simplify[1/2 Inverse[A] . B, Trig -> False];
sVars = Hold /@ (vars + s); A = Map[Hold, A, {2}];
Expand[A . sVars . sVars] + Simplify[C - s . A . s, Trig -> False] //
ReleaseHold]
Sqrt[25 - 6 m + m^2] /.   Sqrt[e_] :> Sqrt[CompleteTheSquare[e, m]]


Update 2:

Clear["Global*"]
expr = EuclideanDistance[{m, 2 Sqrt[m]}, {5, 0}]
eqn = Refine[Simplify[expr], Assumptions -> {m >= 0}]
"The expression is not quadratic in the variables 1";
CompleteTheSquare[expr_] := CompleteTheSquare[expr, Variables[expr]]
CompleteTheSquare[expr_, Vars_Symbol] :=
CompleteTheSquare[expr, {Vars}]
CompleteTheSquare[expr_, Vars : {__Symbol}] :=
Module[{array, A, B, C, s, vars, sVars},
vars = Intersection[Vars, Variables[expr]];
Check[array = CoefficientArrays[expr, vars], Return[expr],
CoefficientArrays::poly];

• If you can assume $m>0$, then use depress or ResourceFunction["CompleteTheSquare"] from here. E.g. Sqrt[25 - 6 m + m^2] /. Sqrt[e_] :> Sqrt[ResourceFunction["CompleteTheSquare"][e, m]] Commented Mar 14, 2023 at 23:56
• Refine[Expand[Sqrt[x^2] + Sqrt[y^2]], Assumptions -> x >= 0, Assumptions -> y >= 0]How to set the range of multiple parameters? The result of y after this setting is incorrect. How to set it? Commented Mar 15, 2023 at 0:34
• Sqrt[25 - 6 m + m^2] /. Sqrt[e_] :> Sqrt`This is mainly the replacement Commented Mar 15, 2023 at 7:01