Ask Your Question

Revision history [back]

sagemath displays in different lines

Hi there,

I am trying to display two different things at once. The first is some Latex stuff, and the second is the solution to a symbolic integration done in sage. Here is the code:

eq2 = x*eq0

display(LatexExpr(r'\langle x \rangle = \int\limits_{-\infty}^\infty x\rho dx'))

x1 = eq2.rhs().integral(x, -infinity, infinity)

display(LatexExpr(r'\langle x\rangle = '), x1)

(sorry I don't know how to show my code in a better format) so what happens is, that the latex expression is displayed in the first line and x1 is displayed in the second line. I hope someone can help me with this.

P.S.: is there a way to display the integral itself and not only the solution? I avoided this problem by just writing the latex expression manually in the first line. Thanks in advance for your help :)