SciPy Reference Guide

SciPy Reference Guide

Release 0.10.1 Written by the SciPy community

March 01, 2012

CONTENTS

1 SciPy Tutorial

3

1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.2 Basic functions in Numpy (and top-level scipy) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

1.3 Special functions (scipy.special) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.4 Integration (scipy.integrate) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

1.5 Optimization (scipy.optimize) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

1.6 Interpolation (scipy.interpolate) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

1.7 Fourier Transforms (scipy.fftpack) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

1.8 Signal Processing (scipy.signal) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

1.9 Linear Algebra (scipy.linalg) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

1.10 Sparse Eigenvalue Problems with ARPACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

1.11 Statistics (scipy.stats) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

1.12 Multi-dimensional image processing (scipy.ndimage) . . . . . . . . . . . . . . . . . . . . . . . 79

1.13 File IO (scipy.io) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

1.14 Weave (scipy.weave) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

2 API - importing from Scipy

143

2.1 Guidelines for importing functions from Scipy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

2.2 API definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144

3 Release Notes

147

3.1 SciPy 0.10.1 Release Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

3.2 SciPy 0.10.0 Release Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

3.3 SciPy 0.9.0 Release Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

3.4 SciPy 0.8.0 Release Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

3.5 SciPy 0.7.2 Release Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

3.6 SciPy 0.7.1 Release Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

3.7 SciPy 0.7.0 Release Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

4 Reference

169

4.1 Clustering package (scipy.cluster) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

4.2 K-means clustering and vector quantization (scipy.cluster.vq) . . . . . . . . . . . . . . . . . 169

4.3 Hierarchical clustering (scipy.cluster.hierarchy) . . . . . . . . . . . . . . . . . . . . . . 174

4.4 Constants (scipy.constants) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

4.5 Discrete Fourier transforms (scipy.fftpack) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208

4.6 Integration and ODEs (scipy.integrate) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222

4.7 Interpolation (scipy.interpolate) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

4.8 Input and output (scipy.io) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277

4.9 Linear algebra (scipy.linalg) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286

i

4.10 Maximum entropy models (scipy.maxentropy) . . . . . . . . . . . . . . . . . . . . . . . . . . 323 4.11 Miscellaneous routines (scipy.misc) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 4.12 Multi-dimensional image processing (scipy.ndimage) . . . . . . . . . . . . . . . . . . . . . . . 352 4.13 Orthogonal distance regression (scipy.odr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 4.14 Optimization and root finding (scipy.optimize) . . . . . . . . . . . . . . . . . . . . . . . . . . 422 4.15 Nonlinear solvers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 4.16 Signal processing (scipy.signal) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 4.17 Sparse matrices (scipy.sparse) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 4.18 Sparse linear algebra (scipy.sparse.linalg) . . . . . . . . . . . . . . . . . . . . . . . . . . 561 4.19 Spatial algorithms and data structures (scipy.spatial) . . . . . . . . . . . . . . . . . . . . . . 585 4.20 Distance computations (scipy.spatial.distance) . . . . . . . . . . . . . . . . . . . . . . . 609 4.21 Special functions (scipy.special) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625 4.22 Statistical functions (scipy.stats) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651 4.23 Statistical functions for masked arrays (scipy.stats.mstats) . . . . . . . . . . . . . . . . . . 927 4.24 C/C++ integration (scipy.weave) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 958

Bibliography

963

Python Module Index

971

Index

973

ii

SciPy Reference Guide, Release 0.10.1

Release 0.10

Date March 01, 2012

SciPy (pronounced "Sigh Pie") is open-source software for mathematics, science, and engineering.

CONTENTS

1

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download