2.3 SciPy-1
2.3 SciPy-1
Scipy
>>> I = sqrt(2/pi)*(18.0/27*sqrt(2)*cos(4.5)-4.0/27*sqrt(2)*sin(4.5)+ :
... sqrt(2*pi)*special.fresnel(3/sqrt(pi))[0])
>>> print I
1.11781793809
Finding Determinant
Minimize
c1,c2= 5.0,2.0
i = r_[1:11]
xi = 0.1*i
yi = c1*exp(-xi)+c2*xi
zi = yi + 0.05*max(yi)*random.randn(len(yi))
A = c_[exp(-xi)[:,newaxis],xi[:,newaxis]]
c,resid,rank,sigma = linalg.lstsq(A,zi)
xi2 = r_[0.1:1.0:100j]
yi2 = c[0]*exp(-xi2) + c[1]*xi2
plt.plot(xi,zi,'x',xi2,yi2)
plt.axis([0,1.1,3.0,5.5])
plt.xlabel('$x_i$')
plt.title('Data fitting with linalg.lstsq')
plt.show()
SciPy – Singular value decomposition
Singular Value Decompostion (SVD) can be thought of as an extension of the
eigenvalue problem to matrices that are not square. Let A be an M x N matrix.
SVD of A can be written as
With U = AHA and V= AAH and is the matrix of eigenvectors
Simple differential equations can be solved numerically using the Euler-Cromer method, but more
complicated differential equations may require a more sophisticated method. The scipy library for Python
contains numerous functions for scientific computing and data analysis. It includes the function odeint for
numerically
from solving sets
scipy import of first-order, ordinary differential equations (ODEs) using a sophisticated algorithm.
odeint
from pylab import * # for plotting commands
End