SCIPY - DATASCIENCE ( PART 3 )
In this article, we will learn about Scipy and it's implementation
Scipy is a Python-based library mainly used for technical computing and scientific computing. It contains varieties of sub-packages and scientific libraries only to GNU Scientific Library for C and C++ or Matlab. I also support to operate on an array of Numpy Library and easy to use and has the fast computational power to increase efficiency.
Advantages of using Scipy
- Most new DataScience features are available on Scipy than Numpy
- It is a fully-featured version of Linear Algebra
- Built on the cream top of Numpy
Installation
- On WINDOWS -
Python3 -m pip install --user numpy scipy
- On MAC -
sudo port install py35-scipy py35-numpy
- On LINUX -
sudo apt-get install python-scipy python-numpy
Example
import numpy as np
from scipy import linalg
# We are trying to solve a linear algebra system which can be given as:
# 11x + 2y =50
# 23x + 14y =65
# Create input array
A= np.array([[11,2],[23,14]])
# Solution Array
B= np.array([[50],[65]])
# Solve the linear algebra
X= linalg.solve(A,B)
# Print results
print(X)
# Checking Results
print("\n Checking results, following vector should be all zeros")
print(A.dot(X)-B)
The above example clearly illustrates how a linear algebra equation can be solved in a scipy environment. Well to master scipy very versed practice is needed to make sure that each and every function is known to you.