# Ticket #7406: trac_7406-power_latex.patch

File trac_7406-power_latex.patch, 3.7 KB (added by burcin, 13 years ago)

• ## sage/functions/log.py

# HG changeset patch
# User Burcin Erocal <burcin@erocal.org>
# Date 1258905769 -3600
# Node ID d77158ce767db9622617fa018d882469d19fd358
# Parent  47497fd0ffd4b30dedbb920317ab270b2954db7d
Add doctests for latex typesetting changes in pynac. #7406

diff --git a/sage/functions/log.py b/sage/functions/log.py
 a TEST:: sage: latex(exp(x)) e^{x} sage: latex(exp(sqrt(x))) e^{\sqrt{x}} sage: latex(exp) \exp sage: latex(exp(sqrt(x))^x) \left(e^{\sqrt{x}}\right)^{x} sage: latex(exp(sqrt(x)^x)) e^{\left(\sqrt{x}^{x}\right)} Test simplifications when taking powers of exp, #7264::
• ## sage/functions/piecewise.py

diff --git a/sage/functions/piecewise.py b/sage/functions/piecewise.py
 a sage: latex(P) \begin{cases} x \ {\mapsto}\ \sin\left(\frac{1}{2} \, \pi x\right) &\text{on $(0, 1)$}\cr x \ {\mapsto}\ -{(x - 1)}^{2} + 1 &\text{on $(1, 3)$}\cr x \ {\mapsto}\ -{\left(x - 1\right)}^{2} + 1 &\text{on $(1, 3)$}\cr x \ {\mapsto}\ -x &\text{on $(3, 5)$}\cr \end{cases} """
• ## sage/symbolic/expression.pyx

diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
 a sage: latex(y + 3*(x^(-1))) y + 3 \, \frac{1}{x} sage: latex(x^(y+z^(1/y))) x^{z^{\frac{1}{y}} + y} x^{z^{\left(\frac{1}{y}\right)} + y} sage: latex(1/sqrt(x+y)) \frac{1}{\sqrt{x + y}} sage: latex(sin(x*(z+y)^x)) \sin\left({(y + z)}^{x} x\right) \sin\left({\left(y + z\right)}^{x} x\right) sage: latex(3/2*(x+y)/z/y) \frac{3}{2} \, \frac{{(x + y)}}{y z} \frac{3}{2} \, \frac{{\left(x + y\right)}}{y z} sage: latex((2^(x^y))) 2^{x^{y}} 2^{\left(x^{y}\right)} sage: latex(abs(x)) {\left| x \right|} sage: latex((x*y).conjugate()) \overline{x} \overline{y} sage: latex(x*(1/(x^2)+sqrt(x^7))) {\left(\sqrt{x^{7}} + \frac{1}{x^{2}}\right)} x Check spacing of coefficients of mul expressions (#3202):: sage: _ = var('A,B,n') sage: latex((n+A/B)^(n+1)) {(n + \frac{A}{B})}^{n + 1} {\left(n + \frac{A}{B}\right)}^{n + 1} sage: latex((A*B)^n) {(A B)}^{n} {\left(A B\right)}^{n} sage: latex((A*B)^(n-1)) {(A B)}^{n - 1} {\left(A B\right)}^{n - 1} Powers where the base or exponent is a Python object:: sage: latex((2/3)^(2/3)) \left(\frac{2}{3}\right)^{\frac{2}{3}} sage: latex((-x)^(1/4)) {(-x)}^{\frac{1}{4}} {\left(-x\right)}^{\frac{1}{4}} sage: k. = GF(9) sage: latex(SR(a+1)^x) \left(a + 1\right)^{x} More powers, #7406:: sage: latex((x^pi)^e) {\left(x^{\pi}\right)}^{e} sage: latex((x^(pi+1))^e) {\left(x^{{\left(\pi + 1\right)}}\right)}^{e} sage: a,b,c = var('a b c') sage: latex(a^(b^c)) a^{\left(b^{c}\right)} sage: latex((a^b)^c) {\left(a^{b}\right)}^{c} """ return self._parent._latex_element_(self)