'Arrange "pretty form" in (R)yacas

I have this expression:

"98/25 * x1^3 * x2  +  28/5 * x1^2 * x2^2  +  98/25 * x1 * x2^3"

When I apply PrettyForm with Ryacas, I get:

cat(yac_str("PrettyForm(98/25 * x1^3 * x2  +  28/5 * x1^2 * x2^2  +  98/25 * x1 * x2^3)"))

            3     2          2     3          
x2 * 98 * x1    x2  * 28 * x1    x2  * 98 * x1
------------- + -------------- + -------------
     25               5               25      

I would prefer to have the numbers in each term at first position, and, if possible, to have x1 before x2.



Solution 1:[1]

If you are looking for a solution for this specific case, then the following code below works for me. I just changed the order of the variables in the equation.


cat(yac_str("PrettyForm(x1^3*x2*298/25  +  x1^2 * x2^2 * 28/5  +  x1*x2^3* 98/25)"))

enter image description here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharman