On 02/04/2012 11:36 AM, Akin wrote:
Thank you very much. Two quick questions:
1) Is it currently possible to print the sympy expressions to stdout
and at the same time write the latex output to a file? In this case,
the latex file would be a kind of logging device.
2) Is it currently possible to choose my own latex representation for
the variables? E.g. I would like the sympy.tensor expression L[0,1] to
translate to something like $L_{0}^{(1)}$.
Best,
Akin
On Feb 3, 6:03 pm, Alan Bromborsky<abro...@verizon.net> wrote:
On 02/03/2012 11:52 AM, Akin wrote:
Hi,
it seems that the extended latex module fails to typeset expressions
involving sympy.tensors, whereas the sympy.printing.latex command
works. Here is a minimal script that reproduces the error messages I
get:
from sympy import *
import sympy.galgebra.latex_ex as tex
x = Symbol('x')
A = 2*x
C = IndexedBase('C')
L = IndexedBase('L')
tau = IndexedBase('tau')
hd = IndexedBase('hd')
xi = IndexedBase('xi')
B = 3**(1/2)*C[5]*L[0]*tau[0]*hd[0]*xi[1]/3
print latex(A) #Works
print latex(B) #Works
tex.Format()
print A # Works
print B # Fails with error message 'RuntimeError: maximum
recursion depth exceeded while calling a Python object'
tex.xdvi('test.tex')
Any thoughts on that?
Best,
Akin
When I wrote letex_ex I don't think sympy had tensors. I will fix this.
The problem with using latex_ex with the Index class and output
redirection is that there is not a specific __str__(self) function for
the Index class. If you do not use redirection (see below) the output
is the same as for latex, but this does
not buy you anything since you will not get the latex displayed unless
you are using ipython notebook with the proper profiles. I will see if
I can add __str__(self) methods to the appropriate classed to make
latex_ex work the way is should.
from sympy import *
from GA import *
import latex_ex as tex
#from indexed import *
x = Symbol('x')
A = 2*x
C = IndexedBase('C')
L = IndexedBase('L')
tau = IndexedBase('tau')
hd = IndexedBase('hd')
xi = IndexedBase('xi')
B = 3**(1/2)*C[5]*L[0]*tau[0]*hd[0]*xi[1]/3
print latex(A) #Works
print latex(B) #Works
tex.Format(redir=False)
#tex.Format()
print A # Works
print B # Fails with error message 'RuntimeError: maximum
#tex.xdvi('test.tex')
--
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
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.