SciPy stands for Scientific Python. Scipy is a Scientific library for python is an open source, The Scipy library functions depends on Numpy. It is under best on BSD license. SciPy was created by NumPy’s created by **Travis Olliphant**.

#### SciPy Sub Packages

- Scipy.io
- scipy.special
- scipy.linalg
- scipy.interpolate
- scipy.optimize
- scipt.stats
- scipt.integrate
- scipyt.fftpack
- scipy.signal
- scipy.ndimage

#### Scipy.io

The SciPy.io package supports a web range of functions to work with a different format of files. sio means is Scipy input output.

**These are some formats are following :-**

- Matlab
- IDL
- Matrix Market
- Wave
- Arff
- Netcdf

Example of Scipy.io

import numpy as np from scipy import io as sio array = np.ones((5, 5)) why.savemat('what.mat', {'ar': array}) data = why.loadmat(‘what.mat', struct_as_record=True) data['ar']

**Output**

array([[ 1.,1., 1., 1., 1.], [ 1., 1., 1., 1., 1.], [ 1.,1., 1., 1., 1.], [ 1.,1., 1., 1., 1.], [ 1., 1., 1., 1., 1.]])

#### scipy.special

This package contains numerous functions of mathematical. SciPy special function includes Cubic Root, Exponential, Permutation and Combinations, Gamma, Bessel, hypergeometric, Kelvin, beta, parabolic cylinder etc.

#### Cubic Root Function

Cubic Root function defines the cube root of values.

**Syntax**

scipy.special.cbrt(x)

Example of Cubic Root Function

from scipy.special import cbrt #Find cubic root of 8 & 125 using cbrt() function cb = cbrt([8, 125]) #print value of cb print(cb)

**Output**:

([2., 5.])

#### Exponential Function

Example of Exponential Function

from scipy.special import exp10 #define exp10 function and pass value in its exp = exp10([1,10]) print(exp)

**Output**

[1.e+01 1.e+10]

#### Permutations & Combinations

**Permutations**

**Syntax**

scipy.special.perm(x,y)

Example of Permutation

from scipy.special import perm #find permutation of 5, 3 using perm (N, k) function per = perm(5, 3, exact = True) print(per)

**Output:** 60

**Combinations**

**Syntax**

scipy.special.comb(x,y**)**

Example of Combination

from scipy.special import comb #find combinations of 5, 3 values using comb(N, k) com = comb(5, 3, exact = False, repetition=True) print(com)

**Output**: 10

**Scipy Stats**

The scipy.stats contains a large number of statistics, probability distributions functions is knows as Scipy stats.

**Syntax**

scipy.stats.lognorm.method_name(data,loc,size,moments,scale)

#### Scipy ndimage

scipy.ndimage is a submodule of SciPy. ndimage means “n” dimensional image. SciPy Image Processing provides Geometrics transformation, image filter , display image, image segmentation, classification and features extraction.

Example of Scipy ndimage

from scipy import misc from matplotlib import pyplot as plt import numpy as np #get face image of panda from misc package panda = misc.face() #plot or show image of face plt.imshow( apple ) plt.show()

#### Scipy optimize

Scipy Optimize provides a useful algorithm for minimization of curve fitting, multidimensional or scalar and root fitting is knows as Scipy Optimize.

Example of Scipy Optimize

%matplotlib inline import matplotlib.pyplot as plt from scipy import optimize import numpy as np def function(d): return a*4 + 10 * np.sin(d) plt.plot(a, function(a)) plt.show() #use BFGS algorithm for optimization optimize.fmin_bfgs(function, 0)

#### Scipy fftpack

- It is stands for Fast Fourier Transformation.
- FFT is apply to a multidimensional array.
- The Frequency defines the number of signal or wavelength in particular time period.

Example of Scipy fffpack

%matplotlib inline from matplotlib import pyplot as plt import numpy as np #Frequency in terms of Hertz fre = 15 #Sample rate fre_samp = 55 t = np.linspace(0, 2, 2 * fre_samp, endpoint = False ) a = np.sin(fre * 2 * np.pi * t) figure, axis = plt.subplots() axis.plot(t, a) axis.set_xlabel ('Time (s)') axis.set_ylabel ('Signal amplitude') plt.show()

If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.

To know more about Scipy Library Function please Wikipedia **Click here**.

Stay Connected Stay Safe, Thank you.

## 0 Comments