Differentiation using SymPy
Code: "func_diff.py". Programming language: Python
DMelt Version 1.4. Last modified: 05/21/2018. License: Free
https://datamelt.org/code/cache/func_diff_7951.py
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
from java.awt import Color
from jhplot import *
c1 = HPlot("Canvas")
c1.setAutoRange()
c1.setGTitle("Differential", Color.red)
c1.setNameX("Xaxis")
c1.setNameY("Yaxis")
c1.setName("Canvas title")
c1.visible()
c1.setAutoRange()
func="2*exp(-x*x/50)+sin(pi*x)/x"
f1 = F1D(func, 1.0, 10.0)
c1.draw(f1)
from sympy import *
x = Symbol('x')
a=diff(S(func), x)
f2 = F1D(str(a), 1.0, 10.0)
f2.setTitle("Differential")
f2.setColor(Color.green)
c1.draw(f2)
c1.export("figure.pdf")