3
$\begingroup$

e.g. it doesn't notice

Sqrt[9 C^2 + 8 w^2 - 3 C Sqrt[9 C^2 + 16 w^2]] =
(-3 C +Sqrt[9*C^2 + 16*w^2])/Sqrt[2]

The only way I found so far was doing it myself via ReplaceAll. E.g. FullSimplify[expr,{w>0,C>0}], ExpandAll, PowerExpand, Refine with Assumptions didn't work out.

$\endgroup$
  • $\begingroup$ Reduce[Sqrt[ 9 c^2 + 8 w^2 - 3 c Sqrt[9 c^2 + 16 w^2]] == (-3 c + Sqrt[9*c^2 + 16*w^2])/ Sqrt[2], Reals] give True. $\endgroup$ – kglr May 24 at 10:10
  • $\begingroup$ @kglr right, but i want it to find the simplification itself, not to check if its true. (it was edited to consfusig ==) $\endgroup$ – Hannes May 24 at 10:31
1
$\begingroup$

You have found one of many expressions that Mathematica, by default, does not simplify. However, it is possible to construct your own simplification functions. Here is one function for your situation:

ClearAll[tran, doit];
tran[ex_, m_: +1] :=
   ex /. {Sqrt[u_ + (v_: 1) Sqrt[w_]] :> doit[u, v, w, m]};
doit[u_, v_, w_, m_: +1] := Module[{x, y, z},
   x = u/v // Factor;
   y = Sign[m] Sqrt[x^2 - w // Factor] // PowerExpand;
   x = x + y // Factor;
   z = 2 x/v // Simplify;
   Sign[m] (x + Sqrt[w])/Sqrt[z] // Simplify // PowerExpand];

A simple example of usage is

3 - Sqrt[2] == tran[Sqrt[11 - 6 Sqrt[2]]]

which returns True. In your case, the usage is

ex1 = Sqrt[9 C^2 + 8 w^2 - 3 C Sqrt[9 C^2 + 16 w^2]];
ex2 = (-3 C + Sqrt[9*C^2 + 16*w^2])/Sqrt[2];
ex2 == tran[ex1]

which returns True again, as it should. The purpose of the parameter m is that sometimes the negative of the square root should be taken in the y = ... line of the doit[] code.

$\endgroup$
1
$\begingroup$

Similar to the answer here, we can get the result from WolframAlpha. Though in this case we need to increase the TimeConstraint for "scantimeout" and post process the result with Refine.

generalres = WolframAlpha[
  "Simplify Sqrt[9 C^2 + 8 w^2 - 3 C Sqrt[9 C^2 + 16 w^2]]", 
  {{"Result", 1}, "Output"}, 
  TimeConstraint -> {30, 30}
]

enter image description here

Refine[generalres, C > 0 && w > 0]
(-3 C + Sqrt[9 C^2 + 16 w^2])/Sqrt[2]

Here's the general result in a less compact but more understandable form:

floorArgPiecewiseExpand[expr_] := Simplify[FixedPoint[iFloorArgPiecewiseExpand, expr]]

iFloorArgPiecewiseExpand[expr_] := 
  Module[{k, s, args, ks, newexpr},
    args = Union[Cases[expr, _Arg, {0, ∞}]];
    ks = k /@ Range[Length[args]];
    newexpr = expr /. {(-1)^g_Floor :> s (-1)^(g + 1)} /. Thread[args -> ks];
    PiecewiseExpand[newexpr, AllTrue[ks, -π < # <= π &]] /. {s -> -1} /. Thread[ks -> args]
  ]

floorArgPiecewiseExpand @@ generalres

enter image description here

$\endgroup$
0
$\begingroup$
expr = Sqrt[9 C^2 + 8 w^2 - 3 C Sqrt[9 C^2 + 16 w^2]];

Assuming C and w are real, let z^2 == 9 C^2 + 16 w^2 then

expr2 = Assuming[z > 0 && z^2 >= 9 C^2,
   expr /. w^2 -> (z^2 - 9 C^2)/16 // Simplify] /.
  z -> Sqrt[9 C^2 + 16 w^2]

(* (-3 C + Sqrt[9 C^2 + 16 w^2])/Sqrt[2] *)

Verifying,

expr == expr2 // Simplify[#, Element[{C, w}, Reals]] &

(* True *)
$\endgroup$
0
$\begingroup$

Hey somehow cant comment ur nice answers (reputation and guest acc things). So 1st: thank you all! Now @SOMOS Thats kinda high level for me, rly dont understand what u did there but it worked for the particular eq. however if i try it e.g.

ex1 = Sqrt[9 C^2 + 8 w^2 + 3 C Sqrt[9 C^2 + 16 w^2]];
ex2 = (+3 C + Sqrt[9*C^2 + 16*w^2])/Sqrt[2];

it wont work again, what would i have to change?

here is one of my matrix elements, perhaps u have other ideas for simplification?

(-(-3 coplC Sqrt[
      8 w1^2 + 3 coplC (3 coplC + Sqrt[9 coplC^2 + 16 w1^2])] + 
     Sqrt[(9 coplC^2 + 16 w1^2) (8 w1^2 + 
        3 coplC (3 coplC + Sqrt[9 coplC^2 + 16 w1^2]))]) Sin[(
   t Sqrt[9 coplC^2 + 8 w1^2 - 3 coplC Sqrt[9 coplC^2 + 16 w1^2]])/(
   2 Sqrt[2])] - (3 coplC Sqrt[
     9 coplC^2 + 8 w1^2 - 3 coplC Sqrt[9 coplC^2 + 16 w1^2]] + 
    Sqrt[-(9 coplC^2 + 16 w1^2) (-8 w1^2 + 
       3 coplC (-3 coplC + Sqrt[9 coplC^2 + 16 w1^2]))]) Sin[(
   t Sqrt[8 w1^2 + 3 coplC (3 coplC + Sqrt[9 coplC^2 + 16 w1^2])])/(
   2 Sqrt[2])])/(4 w1 Sqrt[18 coplC^2 + 32 w1^2])

@Chip Hurst

couldnt get it working, it just outputs crazy Arg[] things for me :(

@Bob Hanlon

i think this might need too much user input per equation

$\endgroup$
  • $\begingroup$ Or is there a way to do automated substitutions in long equations? like that mathematica recognizes certain parts that reappear in my equations? $\endgroup$ – Hannes May 29 at 12:59
  • $\begingroup$ See mathematica.stackexchange.com/questions/8787 $\endgroup$ – Coolwater May 29 at 14:32

Your Answer

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

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