create symbols with complex names

58 views
Skip to first unread message

David Roilo

unread,
Jan 20, 2015, 4:14:02 AM1/20/15
to sy...@googlegroups.com
hello everybody,
I'm new to sympy and I need some help to create symbols.
In particular, I need to create a Symbol which looks like ΔR
In SymPy, If I input

DeltaR=symbols('Delta R')
DeltaR

I get as an output a tuple: (Δ, R)

Could you help me create the symbol ΔR?

Thank you

David

Aaron Meurer

unread,
Jan 20, 2015, 4:14:52 PM1/20/15
to sy...@googlegroups.com
I would just use the string 'ΔR'. If you are using Python 2, you will need to prefix the string with a u, like u'ΔR'.

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/4da8c83c-42da-4d2b-a46c-d3f1de503507%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Amit Saha

unread,
Jan 20, 2015, 4:28:12 PM1/20/15
to sy...@googlegroups.com
On Tue, Jan 20, 2015 at 7:14 PM, David Roilo <davidro...@gmail.com> wrote:
> hello everybody,
> I'm new to sympy and I need some help to create symbols.
> In particular, I need to create a Symbol which looks like ΔR
> In SymPy, If I input
>
> DeltaR=symbols('Delta R')
> DeltaR
>
> I get as an output a tuple: (Δ, R)

This is telling you that two symbols are created here. As Aaraon
points out, this should do in Python 3:

>>> symbols('ΔR')
ΔR



>
> Could you help me create the symbol ΔR?
>
> Thank you
>
> David
>
> --
> 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/4da8c83c-42da-4d2b-a46c-d3f1de503507%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
http://echorand.me

Chris Smith

unread,
Jan 21, 2015, 10:45:44 AM1/21/15
to sy...@googlegroups.com
Try Symbol('Delta R') -- note Symbol vs symbols.

David Roilo

unread,
Jan 22, 2015, 12:07:28 PM1/22/15
to sy...@googlegroups.com
Thanks a lot guys, I'm using Python3 and the solution proposed by Aaron and Amit works. What Chris suggested did not work.

thank you again, bye!

D

Aaron Meurer

unread,
Jan 22, 2015, 1:45:03 PM1/22/15
to sy...@googlegroups.com
We should perhaps extend the symbol name parser to detect names like DeltaR automatically (it already does this for some other things like Tdot).

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.
Reply all
Reply to author
Forward
0 new messages