Aaron S. Meurer wrote:
I think it is just the numbers, a few letters, and some mathematical symbols.
See http://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts and also
the PDF linked to there. The only other option I can think of is to make
larger normal letters and make the default size letters the subscripts. You
could also try setting the display hook to a function like preview() that opens
a rendered formula in a PDF. It will be a little slower, but it should be
possible.
Another option would be to see if there is a font out there that has better
subscript support and require that for pretty printing within the module. Just
an idea, anyway.
On May 30, 2010, at 11:16 AM, Alan Bromborsky wrote:
I am developing a sympy module for abstract tensor algebra and have the
following question for displaying tensors. What subscripts and superscripts
are available for simple printing via unicode. In my web searches it looks
like the subscript letter set is very limited. Is there any reasonable
alternative to LaTeX to display the tensors so that it could be done in an
immediate mode from a python program. Also is there anyone would be interested
in collaborating on such a project. What is the best way to collaborate before
a module is ready for initial submission to sympy.
I've never collaborated on the same piece of code at the same time as someone else before, but I think it should be easiest if you both use git and work on top of each other's patches. In other words, git will make the merging of the work as easy as possible. But probably others will have better advice.
Aaron Meurer
The current status of the module is that I have implemented tensor addition,
multiplication, contraction, and symmetrization for general abstract tensors.
Tensors are instanciated from strings. For example 'R = Tensor('R_ijk__l')
would instanciate a tensor with the same covariant and contravariant indexing
as the Riemann tensor. The next thing I am doing is to impose given symmetries
on a tensor such as the R is antisymmetric in i and j and in k and l.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
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.
Here is my LaTeX solution for immediate (not really but fast enough for
my purposes) display using Pyx and xpdf:
#!/bin/env python
import pyx,os,subprocess
class PDF:
filename = 'trash'
old_filename = 'old_trash'
file_flg = True
pyx.text.set(mode='latex')
pyx.text.preamble(r'\usepackage{tensor}')
pyx.text.preamble(r'\usepackage{amsmath}')
pyx.text.preamble(r'\usepackage{amsfonts}')
pyx.text.preamble(r'\usepackage{amssymb}')
os.system('rm trash.pdf old_trash.pdf')
canvas = pyx.canvas.canvas()
vpos = 0.0
dvpos = 0.5
@staticmethod
def write(latex_str):
PDF.canvas.text(0,PDF.vpos,latex_str)
PDF.vpos -= PDF.dvpos
filename = ''
remove_filename = ''
if PDF.file_flg:
filename = PDF.filename
remove_filename = PDF.old_filename
else:
filename = PDF.old_filename
remove_filename = PDF.filename
PDF.file_flg = not PDF.file_flg
PDF.canvas.writePDFfile(filename)
subprocess.Popen('xpdf -cont -z 150 -remote myserver
'+filename+'.pdf',shell=True)
os.system('rm '+remove_filename+'.pdf')
return
if __name__ == '__main__':
PDF.write(r'$x^{2}+y^{2} = 1$')
PDF.write(r'$x^{3}+y^{3} = 1$')
PDF.write(r'$x^{4}+y^{4} = 1$')
It would have to be modified for multiline equations.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
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.