本文整理汇总了Python中sage.misc.latex.latex函数的典型用法代码示例。如果您正苦于以下问题:Python latex函数的具体用法?Python latex怎么用?Python latex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了latex函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _latex_
def _latex_(self):
r"""
Return a latex representation of ``self``.
EXAMPLES::
sage: B = crystals.infinity.PBW(['F', 4])
sage: u = B.highest_weight_vector()
sage: b = u.f_string([1,2,3,4,2,3,2,3,4,1,2])
sage: latex(b)
f_{\alpha_{4}}^{2}
f_{\alpha_{3}}
f_{\alpha_{1} + \alpha_{2} + 2\alpha_{3}}
f_{\alpha_{1} + \alpha_{2}}
f_{\alpha_{2}}^{2}
"""
pbw_datum = self._pbw_datum.convert_to_new_long_word(self.parent()._default_word)
lusztig_datum = list(pbw_datum.lusztig_datum)
al = self.parent()._pbw_datum_parent._root_list_from(self.parent()._default_word)
from sage.misc.latex import latex
ret_str = ' '.join("f_{%s}%s"%(latex(al[i]), "^{%s}"%latex(exp) if exp > 1 else "")
for i, exp in enumerate(lusztig_datum) if exp)
if ret_str == '':
return '1'
return ret_str
开发者ID:sagemath,项目名称:sage,代码行数:25,代码来源:pbw_crystal.py
示例2: _latex_
def _latex_(self):
r"""
Return a latex representation of ``self``.
EXAMPLES::
sage: ct = CartanType(['A',4]).marked_nodes([1, 3])
sage: latex(ct)
A_{4} \text{ with nodes $\left(1, 3\right)$ marked}
A more compact, but potentially confusing, representation can
be obtained using the ``latex_marked`` global option::
sage: CartanType.options['latex_marked'] = False
sage: latex(ct)
A_{4}
sage: CartanType.options['latex_marked'] = True
Kac's notations are implemented::
sage: CartanType.options['notation'] = 'Kac'
sage: latex(CartanType(['D',4,3]).marked_nodes([0]))
D_4^{(3)} \text{ with node $0$ marked}
sage: CartanType.options._reset()
"""
from sage.misc.latex import latex
ret = self._type._latex_()
if self.options('latex_marked'):
if len(self._marked_nodes) == 1:
ret += " \\text{{ with node ${}$ marked}} ".format(latex(self._marked_nodes[0]))
else:
ret += " \\text{{ with nodes ${}$ marked}} ".format(latex(self._marked_nodes))
return ret
开发者ID:mcognetta,项目名称:sage,代码行数:33,代码来源:type_marked.py
示例3: _latex_
def _latex_(self):
r"""
Return LaTeX representation of ``self``.
EXAMPLES::
sage: from sage.numerical.knapsack import Superincreasing
sage: latex(Superincreasing())
\left[\right]
sage: seq = Superincreasing([1, 2, 5, 21, 69, 189, 376, 919])
sage: latex(seq)
<BLANKLINE>
\left[1,
2,
5,
21,
69,
189,
376,
919\right]
"""
if self._seq is None:
return latex([])
else:
return latex(self._seq)
开发者ID:ProgVal,项目名称:sage,代码行数:25,代码来源:knapsack.py
示例4: list_functions
def list_functions(ex, list_f):
r"""
Function to find the occurences of symbolic functions in the expression.
INPUT:
- ``ex`` -- symbolic expression to be analyzed
OUTPUT:
- ``list_f`` -- tuple containing the details of a symbolic function found, in a following order:
1. operator
2. function name
3. arguments
4. LaTeX version of function name
5. LaTeX version of arguments
TESTS::
sage: var('x y z')
(x, y, z)
sage: f = function('f', x, y, latex_name=r"{\cal F}")
sage: g = function('g_x', x, y)
sage: d = sin(x)*g.diff(x)*x*f - x^2*f.diff(x,y)/g
sage: from sage.geometry.manifolds.utilities import list_functions
sage: list_f = []
sage: list_functions(d, list_f)
sage: list_f
[(f, 'f', '(x, y)', {\cal F}, \left(x, y\right)), (g_x, 'g_x', '(x, y)', 'g_{x}', \left(x, y\right))]
"""
op = ex.operator()
operands = ex.operands()
from sage.misc.latex import latex, latex_variable_name
if op:
if str(type(op)) == "<class 'sage.symbolic.function_factory.NewSymbolicFunction'>":
repr_function = repr(op)
latex_function = latex(op)
# case when no latex_name given
if repr_function == latex_function:
latex_function = latex_variable_name(str(op))
repr_args = repr(ex.arguments())
# remove comma in case of singleton
if len(ex.arguments())==1:
repr_args = repr_args.replace(",","")
latex_args = latex(ex.arguments())
list_f.append((op, repr_function, repr_args, latex_function, latex_args))
for operand in operands:
list_functions(operand, list_f)
开发者ID:gaby7646,项目名称:sage,代码行数:59,代码来源:utilities.py
示例5: _print_latex_
def _print_latex_(self, u, m):
"""
EXAMPLES::
sage: latex(elliptic_eu(1,x))
E(1;x)
"""
return r"E(%s;%s)" % (latex(u), latex(m))
开发者ID:robertwb,项目名称:sage,代码行数:8,代码来源:special.py
示例6: _print_latex_
def _print_latex_(self, n, m, theta, phi):
r"""
TESTS::
sage: y = var('y')
sage: latex(spherical_harmonic(3, 2, x, y, hold=True))
Y_{3}^{2}\left(x, y\right)
"""
return r"Y_{{{}}}^{{{}}}\left({}, {}\right)".format(latex(n), latex(m), latex(theta), latex(phi))
开发者ID:jeromeca,项目名称:sage,代码行数:9,代码来源:special.py
示例7: _OG
def _OG(n, R, special, e=0, var='a', invariant_form=None):
r"""
This function is commonly used by the functions GO and SO to avoid uneccessarily
duplicated code. For documentation and examples see the individual functions.
TESTS:
Check that :trac:`26028` is fixed::
sage: GO(3,25).order() # indirect doctest
31200
"""
prefix = 'General'
ltx_prefix ='G'
if special:
prefix = 'Special'
ltx_prefix ='S'
degree, ring = normalize_args_vectorspace(n, R, var=var)
e = normalize_args_e(degree, ring, e)
if e == 0:
if invariant_form is not None:
if is_FiniteField(ring):
raise NotImplementedError("invariant_form for finite groups is fixed by GAP")
invariant_form = normalize_args_invariant_form(ring, degree, invariant_form)
if not invariant_form.is_symmetric():
raise ValueError("invariant_form must be symmetric")
try:
if invariant_form.is_positive_definite():
inserted_text = "with respect to positive definite symmetric form"
else:
inserted_text = "with respect to non positive definite symmetric form"
except ValueError:
inserted_text = "with respect to symmetric form"
name = '{0} Orthogonal Group of degree {1} over {2} {3}\n{4}'.format(
prefix, degree, ring, inserted_text,invariant_form)
ltx = r'\text{{{0}O}}_{{{1}}}({2})\text{{ {3} }}{4}'.format(
ltx_prefix, degree, latex(ring), inserted_text,
latex(invariant_form))
else:
name = '{0} Orthogonal Group of degree {1} over {2}'.format(prefix, degree, ring)
ltx = r'\text{{{0}O}}_{{{1}}}({2})'.format(ltx_prefix, degree, latex(ring))
else:
name = '{0} Orthogonal Group of degree {1} and form parameter {2} over {3}'.format(prefix, degree, e, ring)
ltx = r'\text{{{0}O}}_{{{1}}}({2}, {3})'.format(ltx_prefix, degree,
latex(ring),
'+' if e == 1 else '-')
if is_FiniteField(ring):
cmd = '{0}O({1}, {2}, {3})'.format(ltx_prefix, e, degree, ring.order())
return OrthogonalMatrixGroup_gap(degree, ring, False, name, ltx, cmd)
else:
return OrthogonalMatrixGroup_generic(degree, ring, False, name, ltx, invariant_form=invariant_form)
开发者ID:sagemath,项目名称:sage,代码行数:57,代码来源:orthogonal.py
示例8: _latex_
def _latex_(self) :
r"""
TESTS::
sage: from psage.modform.fourier_expansion_framework.gradedexpansions.gradedexpansion_grading import *
sage: latex( TrivialGrading( 3, "t" ) )
\text{Trivial grading on $3$ generators with index $\verb|t|$}
"""
return r"\text{Trivial grading on $%s$ generators with index $%s$}" \
% (latex(self.__ngens), latex(self.__index))
开发者ID:RalphieBoy,项目名称:psage,代码行数:9,代码来源:gradedexpansion_grading.py
示例9: _latex_
def _latex_(self):
r"""
Return latex representation of self.
EXAMPLES::
sage: latex(Set(ZZ).union(Set(GF(5))))
\Bold{Z} \cup \left\{0, 1, 2, 3, 4\right\}
"""
return '%s \\cup %s'%(latex(self.__X), latex(self.__Y))
开发者ID:chos9,项目名称:sage,代码行数:10,代码来源:set.py
示例10: _print_latex_
def _print_latex_(self, n, z):
"""
Custom _print_latex_ method.
EXAMPLES::
sage: latex(bessel_K(1, x))
\operatorname{K_{1}}(x)
"""
return r"\operatorname{K_{%s}}(%s)" % (latex(n), latex(z))
开发者ID:Findstat,项目名称:sage,代码行数:10,代码来源:bessel.py
示例11: _latex_
def _latex_(self):
"""
EXAMPLES::
sage: R.<x> = PolynomialRing(ZZ,'x')
sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])
sage: R.quotient_ring(I)._latex_()
'\\Bold{Z}[x]/\\left(x^{2} + 3x + 4, x^{2} + 1\\right)\\Bold{Z}[x]'
"""
return "%s/%s"%(latex.latex(self.cover_ring()), latex.latex(self.defining_ideal()))
开发者ID:dagss,项目名称:sage,代码行数:10,代码来源:quotient_ring.py
示例12: half_term
def half_term(mon, polynomial):
total = sum(mon)
if total == 0:
return '1'
ret = ' '.join('{}{}'.format(latex(R.gen(i)), exp(power)) if polynomial
else '\\partial {}{}'.format(latex(R.gen(i)), exp(power))
for i,power in enumerate(mon) if power > 0)
if not polynomial:
return '\\frac{{\\partial{}}}{{{}}}'.format(exp(total), ret)
return ret
开发者ID:saraedum,项目名称:sage-renamed,代码行数:10,代码来源:weyl_algebra.py
示例13: _latex_
def _latex_(self):
r"""
Return a latex representation of this set.
EXAMPLES::
sage: latex(Set(ZZ).union(Set(GF(5))))
\Bold{Z} \cup \left\{0, 1, 2, 3, 4\right\}
"""
return latex(self._X) + self._latex_op + latex(self._Y)
开发者ID:DrXyzzy,项目名称:sage,代码行数:10,代码来源:set.py
示例14: _latex_
def _latex_(self):
r"""
Return a latex representation of ``self``.
EXAMPLES::
sage: latex(3*ZZ) # indirect doctest
\left(3\right)\Bold{Z}
"""
return '\\left(%s\\right)%s'%(", ".join([latex.latex(g) for g in \
self.gens()]),
latex.latex(self.ring()))
开发者ID:saraedum,项目名称:sage-renamed,代码行数:12,代码来源:ideal.py
示例15: _latex_
def _latex_(self):
r"""
Return a latex representation of ``self``.
EXAMPLES::
sage: S = SymmetricGroupAlgebra(QQ, 3)
sage: W = S.cell_module([2,1])
sage: latex(W)
W_{...}\left(...\right)
"""
from sage.misc.latex import latex
return "W_{{{}}}\\left({}\\right)".format(latex(self._algebra), latex(self._la))
开发者ID:saraedum,项目名称:sage-renamed,代码行数:13,代码来源:cell_module.py
示例16: _print_latex_
def _print_latex_(self, a, b, z):
r"""
TESTS::
sage: latex(hypergeometric([1, 1], [2], -1))
\,_2F_1\left(\begin{matrix} 1,1 \\ 2 \end{matrix} ; -1 \right)
"""
aa = ",".join(latex(c) for c in a)
bb = ",".join(latex(c) for c in b)
z = latex(z)
return (r"\,_{}F_{}\left(\begin{{matrix}} {} \\ {} \end{{matrix}} ; "
r"{} \right)").format(len(a), len(b), aa, bb, z)
开发者ID:drupel,项目名称:sage,代码行数:13,代码来源:hypergeometric.py
示例17: _latex_
def _latex_(self):
r"""
Return a latex representation of ``self``.
EXAMPLES::
sage: m = matrix([[0,1],[1,1]])
sage: J.<a,b,c> = JordanAlgebra(m)
sage: latex(a + 2*b - c)
1 + \left(2,\,-1\right)
"""
from sage.misc.latex import latex
return "{} + {}".format(latex(self._s), latex(self._v))
开发者ID:saraedum,项目名称:sage-renamed,代码行数:13,代码来源:jordan_algebra.py
示例18: _print_latex_
def _print_latex_(self, m, n, **kwds):
r"""
Return latex expression
EXAMPLES::
sage: from sage.misc.latex import latex
sage: m,n=var('m,n')
sage: latex(kronecker_delta(m,n))
\delta_{m,n}
"""
from sage.misc.latex import latex
return r"\delta_{%s,%s}" % (latex(m), latex(n))
开发者ID:sagemath,项目名称:sage,代码行数:13,代码来源:generalized.py
示例19: _latex_
def _latex_(self):
"""
Return a latex representation of ``self``.
EXAMPLES::
sage: print(Bimodules(QQ, ZZ)._latex_())
{\mathbf{Bimodules}}_{\Bold{Q}, \Bold{Z}}
"""
from sage.misc.latex import latex
return "{{{0}}}_{{{1}, {2}}}".format(Category._latex_(self),
latex(self._left_base_ring),
latex(self._right_base_ring))
开发者ID:saraedum,项目名称:sage-renamed,代码行数:13,代码来源:bimodules.py
示例20: _latex_
def _latex_(self):
r"""
Return a latex representation of ``self``.
EXAMPLES::
sage: SGA = SymmetricGroupAlgebra(QQ, 3)
sage: T = SGA.trivial_representation()
sage: H = SGA.hochschild_complex(T)
sage: latex(H)
C_{\bullet}\left(..., ...\right)
"""
from sage.misc.latex import latex
return "C_{{\\bullet}}\\left({}, {}\\right)".format(latex(self._A), latex(self._M))
开发者ID:Babyll,项目名称:sage,代码行数:14,代码来源:hochschild_complex.py
注:本文中的sage.misc.latex.latex函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论