4
$\begingroup$

I want to get my output in the form that I would write by hand. I have tried with TraditionalForm, but it did not work.

I've looked at several answers in this SE group, but I can't find any that help me.

enter image description here

a^(2/3) - a^(1/3) b^(1/3) + b^(2/3)
Power[a^2, (3)^-1] - Power[ab, (3)^-1] + Power[b^2, (3)^-1]
a^(3/4) - Sqrt[a] b^(1/4) + a^(1/4) Sqrt[b] - b^(3/4) 
Power[a^3, (4)^-1] - Power[a^2 b, (4)^-1] + Power[ab^2, (4)^-1] - 
  Power[b^3, (4)^-1]
a^(4/5) - a^(3/5) b^(1/5) + a^(2/5) b^(2/5) - a^(1/5) b^(3/5) + b^(4/5) 
Power[a^4, (5)^-1] - Power[a^3 b, (5)^-1] + Power[a^2 b^2, (5)^-1] -  
   Power[ab^3, (5)^-1] + Power[b^4, (5)^-1]
$\endgroup$
2
  • 1
    $\begingroup$ Use TraditionalForm; however, do not include the wrapper in the definitions. For example, (expr1 = a^(2/3) - a^(1/3) b^(1/3) + b^(2/3)) // TraditionalForm $\endgroup$ – Bob Hanlon Nov 22 '20 at 21:58
  • 1
    $\begingroup$ I recommend this question be reopened because the is no simple mistake and a solution is certainly not easy to find in the docs. The question as originally posted was just a little unclear. I hope my editing has fixed that. $\endgroup$ – m_goldberg Nov 23 '20 at 7:06
6
$\begingroup$

Name your expressions and end them with a semicolon ( ; ), so that naming assignment doesn't display. Then display the named expression with TraditionalForm. Like so;

expr = a^(4/5) - a^(3/5) b^(1/5) + a^(2/5) b^(2/5) - a^(1/5) b^(3/5) + b^(4/5);
expr // TraditionalForm

expr

Update

Taking Michael E2's comment as pointing out that my 1st solution isn't good enough, I offer this:

xf1[u_^(p_Rational)] := Surd[u^Numerator[p], Denominator[p]]
xf2[Times[u_., Surd[a_^i_., n_], Surd[b_^j_., n_]]] := u Surd[Times[a^i, b^j], n]
xexpr = Simplify[expr, TransformationFunctions -> {xf1, xf2}]

expr

Note that

Simplify[expr == xexpr, a > 0 && b > 0]
True
$\endgroup$
2
  • 2
    $\begingroup$ I think Simplify[expr, a > 0 && b > 0] // TraditionalForm gets closer to the OPs goal. $\endgroup$ – Michael E2 Nov 22 '20 at 23:03
  • $\begingroup$ @m_goldberg Thank you, it works perfectly, and thank you to others for answering $\endgroup$ – juan muñoz Nov 23 '20 at 14:57

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