On Sun, Mar 30, 2008 at 05:07:04PM -0400, 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.
We have this: >>> from sympy import * >>> F = Symbol('F^1_0') >>> F F^1_0 >>> Basic.set_repr_level(0) 1 >>> F Symbol('F^1_0') >>> Basic.set_repr_level(2) 0 >>> F F¹₀ but we are going to remove this .set_repr_level: http://code.google.com/p/sympy/issues/detail?id=697 Feel free to join and discuss it. -- Всего хорошего, Кирилл. 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 -~----------~----~----~----~------~----~------~--~---