Scipy Lib
Scipy Lib
TO
THE SESSION
ON
SciPy Library
By:
Mr. Pawan Kumar,
Assistant Professor, Deptt. Of Computer Science,
Shivaji College (University of Delhi).
CONTENT TO BE COVERED:
➢ Introduction to Python SciPy.
➢ NumPy Vs SciPy.
➢ Sub-Packages in SciPy
➢ Basic Functions in SciPy.
➢ Special Functions in SciPy.
➢ Integration Functions in SciPy.
➢ Fourier Transformations in SciPy.
➢ Linear Alzebra in SciPy.
➢ Interpolation Functions in SciPy.
What is Python SciPy
e.g. (code/syntax)
help(cluster) or help()
Scipy.info()
Scipy.source(cluster)
Special Functions
Output:
[10.-0.j -2.+2.j -2.-0.j -2.-2.j]
Linear Alzebra
✓SciPy is built on ATLAS LAPACK and
BLAS libraries and is extremely fast in
solving problems related to linear alzebra.
Output:
[[-2. 1. ]
[ 1.5 -0.5]]
Interpolation Functions
✓Interpolation refers to constructing new
data points within a set of known data
points. The scipy.interpolate consists of
spline functions and classes. One-
dimensional and multidimentional
(univariate and multivariate) interpolation
classes etc.
Example of Interpolation Functions
import matplotlib.pyplot as plt
from scipy import interpolate
x=np.arange(5,20)
y=np.exp(x/3.0)
f=interpolate.interp1d(x,y)
x1=np.arange(6,12)
y1=f(x1) #use interpolation function returned by'interp1d'
plt.plot(x,y,'o',x1,y1,'--')
plt.show()
Output: