On 09/05/2013 10:46 AM, Sergey B Kirpichev wrote:
On Thu, Sep 05, 2013 at 03:59:22PM +0200, Saullo Castro wrote:
    - how to change the printer from Function to give just "u" instead of
    "u(x, t)", for example. I tried subclassing Function like shown in the
    code but without success
You can see how printers works in sympy/printing/

Below is what I did to achieve  what you want (note the last statement)


class GaPrinter(StrPrinter):

function_names = ('acos', 'acosh', 'acot', 'acoth', 'arg', 'asin', 'asinh', 'atan', 'atan2', 'atanh', 'ceiling', 'conjugate', 'cos', 'cosh', 'cot', 'coth', 'exp', 'floor', 'im', 'log', 're', 'root', 'sin', 'sinh', 'sqrt', 'sign', 'tan', 'tanh', 'Abs')

    def _print_Function(self, expr):
        name = expr.func.__name__

        if expr.func.nargs is not None:
            if name in GaPrinter.function_names:
return(expr.func.__name__ + "(%s)" % self.stringify(expr.args, ", "))

        return Eprint.Fct("%s" % (name,))

Basic.__str__ = lambda self: GaPrinter().doprint(self)

--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to