1 | initial version |
This is an idea: with
latex_formula = latex(g); latex_formula
you get x \ {\mapsto}\ \sin\left(x\right)^{5}
.
Doing
new_formula = LatexExpr(latex_formula.replace('\\sin\\left(x\\right)^{5}', '\\sin^{5}\\left(x\\right)'))
pretty_print(new_formula)
returns the display you want. Further string manipulations should do the job in general. It may be useful to note that dir(sage.functions.trig)
returns a list with all trig functions (and other things).
2 | No.2 Revision |
This is an idea: with
latex_formula = latex(g); latex_formula
you get x \ {\mapsto}\ \sin\left(x\right)^{5}
.
Doing
new_formula new_latex_formula = LatexExpr(latex_formula.replace('\\sin\\left(x\\right)^{5}', '\\sin^{5}\\left(x\\right)'))
pretty_print(new_formula)
pretty_print(new_latex_formula)
returns the display you want. Further string manipulations should do the job in general. It may be useful to note that dir(sage.functions.trig)
returns a list with all trig functions (and other things).
3 | No.3 Revision |
This is an idea: with
latex_formula = latex(g); latex_formula
you get x \ {\mapsto}\ \sin\left(x\right)^{5}
.
Doing
new_latex_formula = LatexExpr(latex_formula.replace('\\sin\\left(x\\right)^{5}', '\\sin^{5}\\left(x\\right)'))
pretty_print(new_latex_formula)
returns the display you want. Further string manipulations should do the job in general. It may be useful to note that dir(sage.functions.trig)
returns a list of strings with all trig functions (and other things).
4 | No.4 Revision |
This is an idea: with
latex_formula = latex(g); latex_formula
you get x \ {\mapsto}\ \sin\left(x\right)^{5}
.
Doing
new_latex_formula = LatexExpr(latex_formula.replace('\\sin\\left(x\\right)^{5}', '\\sin^{5}\\left(x\\right)'))
pretty_print(new_latex_formula)
returns the display you want. Further string manipulations should do the job in general. It may be useful to note that dir(sage.functions.trig)
returns a list of strings with all trig functions (and other things).
Also relevant: Sage, LaTeX and Friends.