我正在使用Google的Colaboratory平台在Jupyter笔记本中运行python.在标准的Jupyter笔记本中,sympy函数的输出正确排版Latex,但Colaboratory笔记本只输出Latex,如下面的代码片段所示:
import numpy as np
import sympy as sp
sp.init_printing(use_unicode=True)
x=sp.symbols('x')
a=sp.Integral(sp.sin(x)*sp.exp(x),x);a
Run Code Online (Sandbox Code Playgroud)
导致乳胶输出如下:
$$\int e^{x} \sin{\left (x \right )}\, dx$$
Run Code Online (Sandbox Code Playgroud)
这些问题中引用的答案,在Colaboratory和LaTeX方程的输出单元格中渲染LaTeX在使用IPython时没有在Google Colaboratory中呈现.display.Latex无法解决问题.虽然它提供了一种在代码单元的输出中显示Latex表达式的方法,但它不能修复内置的sympy函数的输出.
关于如何让sympy输出正确渲染的任何建议?或者这是Colaboratory笔记本的问题?