How does sympy know there are two tokens in the string "xalpha"

64 views
Skip to first unread message

asmwarrior

unread,
Mar 11, 2015, 11:33:32 PM3/11/15
to sy...@googlegroups.com
Hi, I'm a beginner of sympy, I found that using the Tex to render the output of math expression is so wonderful.
I see on doc page here: Extended LaTeXModule for SymPy — SymPy 0.7.2 documentation - http://docs.sympy.org/0.7.2/modules/galgebra/latex_ex/latex_ex.html
It shows some code which can show a x and alpha character, but the code don't works under my currently 0.7.5 version of sympy, here is what I get from Ipython
xa = sympy.symbols('xalpha')

xa
Out[18]: (I attach the output as an image)

But what I expect the is result from the page http://docs.sympy.org/0.7.2/modules/galgebra/latex_ex/latex_ex.html

So, my question is: do I need to add a special delimiter to separate characters, thanks.


a-alpha.png

Chris Smith

unread,
Mar 12, 2015, 7:33:57 AM3/12/15
to sy...@googlegroups.com
Does r'x\alpha' work for you?

asmwarrior

unread,
Mar 12, 2015, 8:11:33 PM3/12/15
to sy...@googlegroups.com


On Thursday, March 12, 2015 at 7:33:57 PM UTC+8, Chris Smith wrote:
Does r'x\alpha' work for you?

Hi, Chris, thanks, I just tried, and it works!
Well, I think the document of sympy(the git header or dev version) should add those samples, but cause when I use the "greek" keyword to search the document, I can't find any thing related about this.

Finn Krein

unread,
Sep 18, 2016, 2:18:30 PM9/18/16
to sympy
Hello,
I'm a beginner too. What would I use to get an \alpha x? I tried r'\alpha x' but Spaces already have a meaning in symbol declarations so I couldn't find a way to do it.
Thank you

Aaron Meurer

unread,
Sep 18, 2016, 2:20:03 PM9/18/16
to sy...@googlegroups.com
To create a symbol with spaces you have to use the Symbol() constructor, not symbols()

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+unsubscribe@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/39c194ad-c2d6-4219-825b-1e453679fbe9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Finn Krein

unread,
Sep 21, 2016, 6:56:54 PM9/21/16
to sympy
Thank you for your reply, though my issue was more to combine Greek and Latin letters like this: Δa.
After some experimenting I have found it  to work with this:
da= sympy.symbols(r'\Delta\ a')
Reply all
Reply to author
Forward
0 new messages