3
$\begingroup$

I know this is very simple but I couldn't find a reasonable solution for it in the archive. It seems that my Mathematica does not take into account the assumptions when it wants to simplify the expression. Here is the thing

I have the following expression for gs1

gs1=-((Sqrt[3] (1/(1 + \[Alpha]^3))^(1/3))/2^(
  2/3)) + (r^3 (1 + Cos[\[Theta]] Sin[\[Theta]])^(3/2) + (
   3 Sqrt[3]
     r^3 (-1 + \[Alpha]^3) (Cos[\[Theta]] + Sin[\[Theta]]) Sin[
     2 \[Theta]])/(4 (1 + \[Alpha]^3)))^(1/3)

If you copy and paste the above expression in your Mathematica notebook you will see that it contains the cube root of r^3, which upon assuming that r is positive must be simply r. So I simplify it using the following command

gs2 = Simplify[gs1, Assumptions -> r > 0]

However, it doesn't do anything. This is very trivial and it should easily take r^3 out of the cube root and make it r but it doesn't.

I was thinking that maybe this is not the correct way of doing it so I tested it with a very simple expression

Simplify[Surd[x^3, 3], Assumptions -> x > 0]

and it gives x as the result.

Following the answer of @Nasser, I found something strange.

ClearAll[a, b, r];
term = (r^3 b + (r^3)/2)^(1/3);
Simplify[term, Assumptions -> r > 0]

this does not simplify the term, however, when I edit the term and eliminate the denominator by multiplying by 0.5, instead of dividing by 2, I get what I am looking for

ClearAll[a, b, r];
term = (r^3 b + (r^3)*0.5)^(1/3);
Simplify[term, Assumptions -> r > 0]

Here is the screenshot also

enter image description here

$\endgroup$
  • 1
    $\begingroup$ You'll get an idea of the issue from this simple example ClearAll[a, b, r]; term = (r^3 b + (r^3) /2)^(1/3); Assuming[r > 0, Simplify[term]] and you can see it does not factor r as you wanted. Using ExpandAll does not help here Assuming[r > 0, ExpandAll[term]]. One way is to force Collect, like this ClearAll[a, b, r]; term = (r^3 b + (r^3) /2); term = Collect[term, r^3]^(1/3) Assuming[r > 0, Simplify@term] and now it works. !Mathematica graphics $\endgroup$ – Nasser Jul 10 at 7:14
  • $\begingroup$ It is strange. For me it worked and it factored r out. $\endgroup$ – KratosMath Jul 10 at 7:23
  • $\begingroup$ Yes, ExpandAll worked for your specific example. But ExpandAll will not works for all cases, as the above example shows. $\endgroup$ – Nasser Jul 10 at 7:32
  • $\begingroup$ No, what I mean is that following your example if I assume r>0 and simplify your term, I get r factored out without the need to use the Collect command. $\endgroup$ – KratosMath Jul 10 at 7:34
  • $\begingroup$ This is strange. Which version do you use? Could you please post a screen shot? Here is mine !Mathematica graphics $\endgroup$ – Nasser Jul 10 at 7:39
1
$\begingroup$

This is on version 12, windows 10.

Another workaround is to force collect on r^3 on the second term

term1 = -((Sqrt[3] (1/(1 + α^3))^(1/3))/2^(2/3));
term2 = (r^3 (1 + Cos[θ] Sin[θ])^(3/2) + (3 Sqrt[3] r^3 (-1 + α^3) (Cos[θ] + Sin[θ]) Sin[
        2 θ])/(4 (1 + α^3)));
gs1 = term1 + Collect[term2, r^3]^(1/3)

Mathematica graphics

Assuming[r > 0, Simplify[gs1]]

Mathematica graphics

A quick experiment shows that M does not collect factors out when one term has something in the denominator. Compare

ClearAll[a, b, r];
term = (r^3 b +  (r^3) /2)^(1/3);
Assuming[r > 0, Simplify@term]

Mathematica graphics

The above did not work. But this works

ClearAll[a, b, r];
term = (r^3 b + r^3 )^(1/3);
Assuming[r > 0, Simplify@term]

Mathematica graphics

So to force r^3 to be factored out, one can use Collect

ClearAll[a, b, r];
term = (r^3 b + r^3/2 );
term = Collect[term, r^3]^(1/3);
Assuming[r > 0, Simplify@term]

Mathematica graphics

And this is basically what I did for your more complicated example.

$\endgroup$
  • $\begingroup$ Nice, it works, but shouldn't it be treated as bug? I check LeafCount, there is no logical reason on why Simplifyworks in one case, but not in another. $\endgroup$ – yarchik Jul 10 at 15:21
1
$\begingroup$

Wrapping gs1 with ExpandAll:

Simplify[ExpandAll @ gs1, Assumptions -> r > 0]

(-Sqrt[3] (1/(1 + α^3))^(1/3) +
r ((6 Sqrt[3] (-1 + α^3) Cos[θ]^2 Sin[θ] +
6 Sqrt[3] (-1 + α^3) Cos[θ] Sin[θ]^2 + 4 (1 + α^3) (1 + Cos[θ] Sin[θ])^(3/2)) /
( 1 + α^3))^(1/3))/2^(2/3)

TeXForm[%]

$\frac{r \sqrt[3]{\frac{6 \sqrt{3} \left(\alpha ^3-1\right) \sin (\theta ) \cos ^2(\theta )+6 \sqrt{3} \left(\alpha ^3-1\right) \sin ^2(\theta ) \cos (\theta )+4 \left(\alpha ^3+1\right) (\sin (\theta ) \cos (\theta )+1)^{3/2}}{\alpha ^3+1}}-\sqrt{3} \sqrt[3]{\frac{1}{\alpha ^3+1}}}{2^{2/3}}$

You can also use ReplaceAll to force the transformations you want:

gs1  /. Power[a_. x_^k_ + b_. x_^k_, c_] :> x ^(k c) (a + b)^c

TeXForm @ %

$r \sqrt[3]{\frac{3 \sqrt{3} \left(\alpha ^3-1\right) \sin (2 \theta ) (\sin (\theta )+\cos (\theta ))}{4 \left(\alpha ^3+1\right)}+(\sin (\theta ) \cos (\theta )+1)^{3/2}}-\frac{\sqrt{3} \sqrt[3]{\frac{1}{\alpha ^3+1}}}{2^{2/3}}$

$\endgroup$
  • $\begingroup$ Thanks for the response. It works but why it shouldn't understand my assumption without ExapndAll command? $\endgroup$ – KratosMath Jul 10 at 7:02
  • $\begingroup$ @KratosMath, i am puzzled too. $\endgroup$ – kglr Jul 10 at 7:16

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.