Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Display()函数_Python_Pycharm_Output_Display - Fatal编程技术网

Python Display()函数

Python Display()函数,python,pycharm,output,display,Python,Pycharm,Output,Display,我正在用PyCharm做这件事: import sympy as sp from IPython.display import display, Math h,r,T = sp.symbols('h r T') #hier Eure Variablennamen einsetzen variablen = [h,r,T] #hier Eure Variablennamen einsetzen variablen_werte = [2.8

我正在用PyCharm做这件事:

    import sympy as sp
    from IPython.display import display, Math

    h,r,T = sp.symbols('h r T') #hier Eure Variablennamen einsetzen
    variablen = [h,r,T]         #hier Eure Variablennamen einsetzen

    variablen_werte = [2.8,4.2,2.4]  
    fehler_werte = [0.3,0.2,0.1] 

    funktion = (h*r**2*sp.sqrt(T))

    fehler = 0
    fehlersymbole=[]
    ableitungen_quadr = []

    for var in variablen:
        d = sp.symbols('d' + var.name)        
        fehlersymbole.append(d)               
        partial = sp.diff(funktion, var) * d  
        ableitungen_quadr.append(partial**2)
        fehler = fehler + partial**2

    fehler_abs=sp.simplify(sp.sqrt(fehler))              
    fehler_rel=sp.simplify(sp.sqrt(fehler/funktion**2))  

    funktions_wert=sp.Subs(funktion,variablen,variablen_werte).doit() 
                                                                  
    err1=sp.Subs(fehler,variablen,variablen_werte).doit()             
    err2=sp.Subs(err1,fehlersymbole,fehler_werte).doit()

    print('Funktion:')
    display(Math("f="+sp.latex(funktion)))
    print('Messwerte:')
    for i in range(len(variablen)):
      display(Math(str(variablen[i])+'='+ str(variablen_werte[i])+'\pm '+ str(fehler_werte[i])))
    print('Absoluter Fehler:')
    display(Math(r'\Delta f='+sp.latex(fehler_abs).replace('d',r'\Delta ')))
    print('Relativer Fehler:')
    display(Math(r"\Delta f/f="+sp.latex(fehler_rel).replace('d',r'\Delta '))) 
    display(Math("f= %6.2f \pm %6.2f" %(funktions_wert,sp.sqrt(err2))))        
    display(Math("f= %6.2f \pm %6.1f %s" %(funktions_wert,sp.sqrt(err2)/funktions_wert*100," \%")))
我还有很多其他的display()函数要显示,但我不能。 但是现在我的输出有问题。对于每个display(),输出为:
但它应该是:


我做错了什么?我应该更改我的PyCharm配置吗?如何实现?

PyCharm仅支持命令行(仅限文本)输入/输出。您期望的结果是使用IPython/Jupyter笔记本生成的公式图像。因此,尝试打开笔记本程序(如果已安装),并将代码粘贴到其中。例如: