How to create a symbol with greek subscript

534 views
Skip to first unread message

Paul Royik

unread,
Sep 28, 2021, 10:15:55 AM9/28/21
to sympy
I'm trying to create a symbol, where both alpha and beta are in subscript.
Symbol('x_{\alpha \beta}') doesn't work.

Oscar Gustafsson

unread,
Sep 28, 2021, 12:47:13 PM9/28/21
to sy...@googlegroups.com
Symbol('x_alpha_beta') # SymPys own magic, works for pretty printer as well
Symbol('x_{\\alpha \\beta}') # Escape the \
Symbol(r'x_{\alpha \beta}')  # Python "raw" string, no need to escape

BR Oscar


Den tis 28 sep. 2021 kl 16:15 skrev Paul Royik <distan...@gmail.com>:
I'm trying to create a symbol, where both alpha and beta are in subscript.
Symbol('x_{\alpha \beta}') doesn't work.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/sympy/7912cef5-b505-4dd7-b2ee-0451a1fbd2c6n%40googlegroups.com.

Paul Royik

unread,
Sep 28, 2021, 1:10:49 PM9/28/21
to sympy
Thank you. It works!
Reply all
Reply to author
Forward
0 new messages