On Sun, Mar 30, 2008 at 05:25:00PM -0400, Alan Bromborsky wrote:
> 
> Alan Bromborsky wrote:
> > Kirill Smelkov wrote:
> >   
> >> Hi Alan,
> >>
> >> On Sun, Mar 30, 2008 at 02:58:56PM -0400, Alan Bromborsky wrote:
> >>   
> >>     
> >>> Kirill Smelkov wrote:
> >>>     
> >>>       
> >>>> Hi Alan,
> >>>>
> >>>> On Sun, Mar 30, 2008 at 02:28:48PM -0400, Alan Bromborsky wrote:
> >>>>   
> >>>>       
> >>>>         
> >>>>> How difficult would it be to allow one to create symbols in sympy with 
> >>>>> unicode names.  I would like to be able to print out super and sub 
> >>>>> scripts without using latex formatting.
> >>>>>     
> >>>>>         
> >>>>>           
> >>>> super & subscripts are already possible:
> >>>>
> >>>> In [1]: F = Symbol('F^1_0')
> >>>>
> >>>> In [2]: F
> >>>> Out[2]: F¹₀
> >>>>
> >>>> In [3]: sin(F)
> >>>> Out[3]: sin(F¹₀)
> >>>>
> >>>> Is this what you want?
> >>>>
> >>>>   
> >>>>       
> >>>>         
> >>> My second question is how I do this in a python program for I get
> >>>  
> >>>  >>>import sympy
> >>>  >>> F = sympy.Symbol('F^1_0')
> >>>  >>> F
> >>> F^1_0
> >>>  >>> print F
> >>> F^1_0
> >>>     
> >>>       
> >> For this you need pprint:
> >>
> >>   
> >>     
> >>>>> from sympy import *
> >>>>> F = Symbol('F^1_0') 
> >>>>> F
> >>>>>         
> >>>>>           
> >> F^1_0
> >>   
> >>     
> >>>>> pprint(F)
> >>>>>         
> >>>>>           
> >> F¹₀
> >>   
> >>     
> >>>>> pprint(sin(F)/2)
> >>>>>         
> >>>>>           
> >> sin(F¹₀)
> >> ────────
> >>    2    
> >>
> >>
> >> In fact, pprint is used internally in isympy as the displayer.
> >>
> >>   
> >>     
> > A suggestion for sympy would be to also implement as a switch in __str__
> > so that calling the switch function, say "pp_on()" or "pp_off()" would allow
> > you to simply use print for both pretty and normal printing and turn 
> > pretty printing
> > on or off by calling the appropriate switch function.
> >
> > >
> >
> >   
> Also an option to just pass unicode through Symbol() would be useful if 
> someone wants to use a unicode character that is not implemented in your 
> conventions such as partial, nabla, etc.!

You can pass uincode strings to Symbol already:

In [1]: a = Symbol('ПРИВЕТ')

In [2]: a
Out[2]: ПРИВЕТ

In [3]: sin(a)
Out[3]: sin(ПРИВЕТ)

there is a problem with it though:

http://code.google.com/p/sympy/issues/detail?id=769

-- 
    Всего хорошего, Кирилл.
    http://landau.phys.spbu.ru/~kirr/aiv/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to