Did I find the right examples for you? yes no

All Samples(405)  |  Call(405)  |  Derive(0)  |  Import(0)
Internal dispatcher

Tries the following concepts to print an expression:
    1. Let the object print itself if it knows how.
    2. Take the best fitting method defined in the printer.
    3. As fall-back use the emptyPrinter method for the printer.

src/s/y/sympy-polys-HEAD/sympy/galgebra/latex_ex.py   sympy-polys(Download)
    def coefficient(self,coef,first_flg):
        if isinstance(coef, C.AssocOp) and isinstance(-coef, C.AssocOp):
            coef_str =  r"\lp %s\rp " % self._print(coef)
        else:
            coef_str = self._print(coef)
    def _print_Add(self, expr):
        tex = str(self._print(expr.args[0]))
 
        for term in expr.args[1:]:
            coeff = term.as_coeff_terms()[0]
 
            if coeff.is_negative:
                tex += r" %s" % self._print(term)
            else:
                tex += r" + %s" % self._print(term)

src/s/y/sympy-HEAD/sympy/printing/pretty/pretty.py   sympy(Download)
    def _print_subfactorial(self, e):
        x = e.args[0]
        pform = self._print(x)
        # Add parentheses if needed
        if not ((x.is_Integer and x.is_nonnegative) or x.is_Symbol):
    def _print_factorial(self, e):
        x = e.args[0]
        pform = self._print(x)
        # Add parentheses if needed
        if not ((x.is_Integer and x.is_nonnegative) or x.is_Symbol):
    def _print_factorial2(self, e):
        x = e.args[0]
        pform = self._print(x)
        # Add parentheses if needed
        if not ((x.is_Integer and x.is_nonnegative) or x.is_Symbol):
    def _print_binomial(self, e):
        n, k = e.args
 
        n_pform = self._print(n)
        k_pform = self._print(k)

src/s/y/sympy-0.7.5/sympy/printing/pretty/pretty.py   sympy(Download)
    def _print_subfactorial(self, e):
        x = e.args[0]
        pform = self._print(x)
        # Add parentheses if needed
        if not ((x.is_Integer and x.is_nonnegative) or x.is_Symbol):
    def _print_factorial(self, e):
        x = e.args[0]
        pform = self._print(x)
        # Add parentheses if needed
        if not ((x.is_Integer and x.is_nonnegative) or x.is_Symbol):
    def _print_factorial2(self, e):
        x = e.args[0]
        pform = self._print(x)
        # Add parentheses if needed
        if not ((x.is_Integer and x.is_nonnegative) or x.is_Symbol):
    def _print_binomial(self, e):
        n, k = e.args
 
        n_pform = self._print(n)
        k_pform = self._print(k)

src/s/y/sympy-polys-HEAD/sympy/printing/pretty/pretty.py   sympy-polys(Download)
    def _print_Factorial(self, e):
        x = e.args[0]
        pform = self._print(x)
        # Add parentheses if needed
        if not ((x.is_Integer and x.is_nonnegative) or x.is_Symbol):
    def _print_Relational(self, e):
        op = prettyForm(' ' + xsym(e.rel_op) + ' ')
 
        l = self._print(e.lhs)
        r = self._print(e.rhs)
        pform = prettyForm(*stringPict.next(l, op, r))
        return pform
 
    def _print_conjugate(self, e):
        pform = self._print(e.args[0])
    def _print_abs(self, e):
        pform = self._print(e.args[0])
        pform = prettyForm(*pform.parens('|', '|'))
        return pform
 

src/s/y/sympy-0.7.5/sympy/printing/theanocode.py   sympy(Download)
    def _print_Basic(self, expr, **kwargs):
        op = mapping[type(expr)]
        children = [self._print(arg, **kwargs) for arg in expr.args]
        return op(*children)
 
               "Matrix translation not yet supported in this version of Theano")
        else:
            return tt.stacklists([[self._print(arg, **kwargs) for arg in L]
                                         for L in X.tolist()])
    _print_ImmutableMatrix = _print_DenseMatrix
 
    def _print_MatMul(self, expr, **kwargs):
        children = [self._print(arg, **kwargs) for arg in expr.args]
    def _print_MatrixSlice(self, expr, **kwargs):
        parent = self._print(expr.parent, **kwargs)
        rowslice = self._print(slice(*expr.rowslice), **kwargs)
        colslice = self._print(slice(*expr.colslice), **kwargs)
        return parent[rowslice, colslice]

src/s/y/sympy-HEAD/sympy/printing/theanocode.py   sympy(Download)
    def _print_Basic(self, expr, **kwargs):
        op = mapping[type(expr)]
        children = [self._print(arg, **kwargs) for arg in expr.args]
        return op(*children)
 
    def _print_DenseMatrix(self, X, **kwargs):
        return tt.stacklists([[self._print(arg, **kwargs) for arg in L]
                                     for L in X.tolist()])
    _print_ImmutableMatrix = _print_DenseMatrix
 
    def _print_MatMul(self, expr, **kwargs):
        children = [self._print(arg, **kwargs) for arg in expr.args]
    def _print_MatrixSlice(self, expr, **kwargs):
        parent = self._print(expr.parent, **kwargs)
        rowslice = self._print(slice(*expr.rowslice), **kwargs)
        colslice = self._print(slice(*expr.colslice), **kwargs)
        return parent[rowslice, colslice]

src/s/c/scipy-2011-tutorial-HEAD/source/python/mathematica.py   scipy-2011-tutorial(Download)
    def parenthesize(self, item, level):
        printed = self._print(item)
 
        if precedence(item) <= level:
            return "(%s)" % printed
    def _print_Function(self, expr):
        name = expr.func.__name__
        args = ", ".join([ self._print(arg) for arg in expr.args ])
 
        if expr.func.nargs is not None: