Python Forum
Unexpected output: symbols for derivative not being displayed
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unexpected output: symbols for derivative not being displayed
#1
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Unexpected output when trying to attach files in a mail application PythonU2Novel 0 1,040 May-17-2024, 02:59 AM
Last Post: PythonU2Novel
  Fuzzy Wuzzy how to get my fuzzyratio displayed windingsareuseful 3 1,527 Apr-04-2024, 05:38 PM
Last Post: deanhystad
  Unexpected output Starter 2 1,248 Nov-22-2023, 12:08 AM
Last Post: Starter
  Unexpected Output - Python Dataframes: Filtering based on Overlapping Dates Xensor 5 2,106 Nov-15-2023, 06:54 PM
Last Post: deanhystad
  Unexpected output while using random.randint with def terickson2367 1 1,240 Oct-24-2023, 05:56 AM
Last Post: buran
  Python script that deletes symbols in plain text nzcan 3 1,700 Sep-05-2023, 04:03 PM
Last Post: deanhystad
  Unexpected output from df.loc when indexing by label idratherbecoding 6 3,634 Apr-19-2023, 12:11 AM
Last Post: deanhystad
  Table displayed out of order nigelwright7557 3 2,642 Nov-24-2021, 10:07 AM
Last Post: nigelwright7557
  Derivative function Irv1n 1 2,391 May-01-2021, 10:54 AM
Last Post: Larz60+
  unexpected output asyrafcc99 0 1,952 Oct-24-2020, 02:40 PM
Last Post: asyrafcc99

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020