【问题标题】:How do I display a latex string as latex output in sympy (jupyter notebook)?如何在 sympy (jupyter notebook) 中将乳胶字符串显示为乳胶输出?
【发布时间】:2019-12-20 19:40:07
【问题描述】:

我在 Jupyter 中的序言是:

%reset
import numpy as np
from sympy import *
from sympy.physics.quantum import Commutator, Dagger, Operator
from sympy.vector import CoordSys3D
import matplotlib.pyplot as plt
from sympy.interactive import printing
printing.init_printing(use_latex = True)

如何以乳胶形式打印以下字符串?我非常不希望字符串中术语的顺序发生变化。

'\\mathbf{R}_B \\cdot j'

【问题讨论】:

    标签: python sympy


    【解决方案1】:

    关注this solution

    from IPython.display import display, Math
    display(Math('\\mathbf{R}_B \\cdot j'))
    

    输出

    【讨论】:

      【解决方案2】:

      所以答案是:

      从 IPython.display 导入数学

      display(Math('\\mathbf{R}_B \\cdot j'))
      

      保留符号的顺序。但是,'Math' 没有属性 'subs' 并且无法进行 sympy,因此似乎无法对此输出进行 sympy 操作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-07-18
        • 1970-01-01
        • 2019-01-31
        • 1970-01-01
        • 2013-09-01
        • 2019-04-14
        • 1970-01-01
        • 2021-06-20
        相关资源
        最近更新 更多