Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sagetex does not convert number * symbol properly. #12

Open
kwangkim opened this issue Jun 11, 2017 · 1 comment
Open

sagetex does not convert number * symbol properly. #12

kwangkim opened this issue Jun 11, 2017 · 1 comment

Comments

@kwangkim
Copy link

\documentclass{article}
\usepackage{sagetex}
\begin{document}
\begin{sagesilent}
from sympy import *
x=Symbol('x')
expr1= 4*x**2+1
expr2= x**2*4+1
\end{sagesilent}
$$\sagestr{latex(expr1)}$$
$$\sagestr{srepr(expr1)}$$
$$\sagestr{latex(expr2)}$$
$$\sagestr{srepr(expr2)}$$
\end{document}

Shows
screen shot 2017-06-11 at 7 19 31 pm
Which means sagetex does not convert '4*x**2+1' properly?
I did it using cocalc.com

Could you give me an advice?

@kcrisman
Copy link
Member

kcrisman commented Jan 9, 2019

Something analogous happens with just sage instead of sagestr, where one gets (as expected) the latex() results above.

The really interesting part is that the strings returned by Sage seem to be identical:

sage: latex(expr1)
'4 x^{2} + 1'
sage: latex(expr2)
'4 x^{2} + 1'
sage: srepr(expr1)
"Add(Mul(Integer(4), Pow(Symbol('x'), Integer(2))), Integer(1))"
sage: srepr(expr2)
"Add(Mul(Integer(4), Pow(Symbol('x'), Integer(2))), Integer(1))"

but nonetheless somehow they are not coming out the same; maybe the internal representation, but I traversed both expression trees for these in Sage as well and can't find a difference. This would be worth investigating, but is relatively low priority since just avoiding Sympy (which after all isn't what SageTeX is designed for) would solve this particular issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants