[what] SciPy (Scientific Computing in Python)

 


SciPy is a set of open source scientific and numerical tools for Python. 

SciPy extends NumPy by providing additional tools for array computing and provides specialized data structures, such as sparse matrices and k-dimensional trees.

A good rule of thumb is that if it's covered in a general textbook on numerical computing (for example, the well-known Numerical Recipes series), it's probably implemented in SciPy. (SciPy FAQ)


Advantage of SciPy

It currently supports special functions, integration, ordinary differential equation (ODE) solvers, gradient optimization, parallel programming tools, an expression-to-C++ compiler for fast execution, and others. 


Practical uses of SciPy

SciPy performs complex numerical operations such as root finding and optimization problems. In contrast, NumPy is only capable of finding roots for polynomials and linear equations; it can not find roots for nonlinear equations (JobTensor - Roots of an Equation).

Besides root optimization, SciPy also helps to solve sparse data, spatial data and interpolation (or imputation) problem.




import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import scipy as sp
from scipy.optimize import root
from math import cos

def eqn(x):
  return x + cos(x)

myroot = root(eqn, 0)

print(myroot.x) 
  
  

Post a Comment

0 Comments