Performing SYMBOLIC/ANALYTICAL Integration or Differentiation using PYTHON [TUTORIAL]

DEMO CODE:

#Differentiation and Integration using Python
import sympy as sp
#from sympy import *

#To change the printing method of SymPy Live
sp.init_printing()

#Declare symbolic variables explicitly which are to be treated as symbols
x = sp.symbols('x')
y = sp.symbols('y')

#Indefinite Integration
integral = sp.integrate('1/sqrt(1-x*x)*1/sqrt(1-(1+x)**2)', x)

#Definite integration
#integral = sp.integrate('x**2 + x + 1', (x,0,1))

#Pretty print demo
sp.pprint(sp.Integral(x**2 + x + 1, x))
print('=')
print(integral)

#Differentiation
derivative = sp.diff('sin(x)', x)

print(derivative)

YouTube Tutorial

[wpedon id="7041" align="center"]

One thought on “Performing SYMBOLIC/ANALYTICAL Integration or Differentiation using PYTHON [TUTORIAL]

  1. sir,
    when I am relaxing a system, I actually expect an output file, .xml file and .save folder. but why am i getting .bfgs and .update files along with 40 other pwscf files (40 is number of processors) and output file is not giving the final coordinates. In some cases convergence have been achieved. Please help me

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.