I want to display (a**x + b)**3 descending order about x using sympy.latex by LaTeX, however it becomes inverse order only in case of a==-1. The minimum code as follows:
import sympy
x, y, z = sympy.symbols('x, y, z', var = True)
a, b = -1, 5
def f(x):
return (a*x + b)**3
print('Notation after processed by definition of f(x)')
print(f(x))
print('Notation after processed by sympy.latex')
print(sympy.latex(f(x)))
I get following results processed by this code:
Notation after processed by definition of f(x)
(5 - x)**3
Notation after processed by sympy.latex
\left(5 - x\right)^{3}
However, I want to get following notation:
Notation after processed by definition of f(x)
(- x + 5)**3
Notation after processed by sympy.latex
\left(- x + 5 \right)^{3}
I guess that I have to solve problems both of sympy and LaTeX.
Can anyone have solution this problem?