How to give a Function a latex representation?

35 views
Skip to first unread message

G B

unread,
Mar 30, 2015, 1:13:36 AM3/30/15
to sy...@googlegroups.com
Hi--

I can give a symbol a latex representation with:

x1=symbols(r'x_{1}')

How do I create a function with a latex representation?

Ic=symbols(r'I_{C}',cls=Function)
Ic=Function(r'I_{C}')

Don't seem to work... They pretty print as strings.

Thanks--

G B

unread,
Mar 30, 2015, 2:54:27 AM3/30/15
to sy...@googlegroups.com
Interesting.  

Function('V_{C}')

returns a string (V_{C})

Function('V_{C}')(t)

returns proper latex.  It must be how it's handled in the printer...

Aaron Meurer

unread,
Mar 30, 2015, 2:02:17 PM3/30/15
to sy...@googlegroups.com
If you want to do anything nontrivial, you'll need to define a latex
printer on it, by defining _latex(self, printer) (where printer will
be the printer class that you should use to recursively print the args
with printer.doprint(expr)). See
http://docs.sympy.org/latest/modules/printing.html. Search the SymPy
code base for some examples.

Aaron Meurer
> --
> 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 sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/02276aae-b6ae-4518-a559-1cdf97c87b01%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages