Python Forum

Full Version: Unexpected output: symbols for derivative not being displayed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
code running in Python 3.6 on Ubuntu 18.04.4 Linux-x86_64 taken from YouTube video https://youtu.be/ssZse3cvEoc

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

q = sym.symbols('q')
print(sym.diff( sym.cos(q)) )
print(sym.diff( sym.sin(q)) )

f= sym.cos(q)
for i in range(0,8):
    display(Math('\\frac{d}{dx}%s = %s' % (sym.latex(f), sym.latex(sym.diff(f)))))
Quote:I hit the wall here, stopped trying to get this to work at this point; also seeing "Expected type 'tuple', got 'Math' instead " in PyCharm Inspection Type Checker on this line (line 14)


Output:
-sin(q) cos(q) <IPython.core.display.Math object> <IPython.core.display.Math object> <IPython.core.display.Math object> <IPython.core.display.Math object> <IPython.core.display.Math object> <IPython.core.display.Math object> <IPython.core.display.Math object> <IPython.core.display.Math object> Process finished with exit code 0
installed sympy from within PyCharm environment with no errors.
Installed Jupyter notebook version 6.0.3 using Anaconda3-2020.02-Linux-x86_64.per the Debian prerequisites listed in Anaconda Documentation at
https://docs.continuum.io/anaconda/install/linux/
I tried substituting Jupyter in place of IPython. Installed Jupyter from within the PyCharm environment with no errors.