开发工具:
文件大小: 4mb
下载次数: 0
上传时间: 2019-08-18
详细说明:CONTENTS
1
SciPyTutorial
3
1.1
Introduction
...............................................
3
1.2
BasicfunctionsinNumpy(andtop-levelscipy).............................
6
1.3
Specialfunctions(scipy.special).................................
10
1.4
Integration(scipy.integrate)...................................
10
1.5
Optimization(optimize).........................................
14
1.6
Interpolation(scipy.interpolate)................................
28
1.7
FourierTransforms(scipy.fftpack)................................
40
1.8
SignalProcessing(signal)........................................
42
1.9
LinearAlgebra..............................................
48
1.10Statistics.................................................
59
1.11Multi-dimensionalimageprocessing(ndimage)............................
67
1.12FileIO(scipy.io)...........................................
89
1.13Weave
..................................................
95
2
ReleaseNotes
131
2.1
SciPy0.9.0ReleaseNotes........................................131
2.2
SciPy0.8.0ReleaseNotes........................................133
2.3
SciPy0.7.2ReleaseNotes........................................137
2.4
SciPy0.7.1ReleaseNotes........................................137
2.5
SciPy0.7.0ReleaseNotes........................................139
2.6
SciPy0.9.0ReleaseNotes........................................144
3
Reference
147
3.1
Clusteringpackage(scipy.cluster)................................147
3.2
Constants(scipy.constants)....................................170
3.3
Fouriertransforms(scipy.fftpack)
................................185
3.4
IntegrationandODEs(scipy.integrate).............................196
3.5
Interpolation(scipy.interpolate)................................211
3.6
Inputandoutput(scipy.io)......................................238
3.7
Linearalgebra(scipy.linalg)
...................................244
3.8
Maximumentropymodels(scipy.maxentropy)..........................278
3.9
Miscellaneousroutines(scipyCONTENTS
1 SciPy Tutorial
1.1 Introduction
1. 2 Basic functions in Numpy(and top-level scipy
1.3 Special functions(scipy. special)
“·
10
1.4 Integration (scipy integrate
10
1.5 Optimization (optimize)
14
1. 6 Interpolation(scipy. interpolate)
8
1. 7 Fourier Transforms(scipy. fftpack
1. 8 Signal Processing(signal)
1.9 Linear Algebra
1.10 Statistics
....59
1.11 Multi-dimensional image processing(ndimage)
1.12 File Io(scipy io)
89
1. 13 Weave
95
2 Release notes
131
2.1 SciPy 0.9.0 Release Notes
131
2.2 SciPy 0.8.0 Release Notes
133
2.3 SciPy 0.7.2 Release Notes
137
2.4 SciPy 0.7.1 Release Notes
137
2.5 SciPy 0.7.0 Release Notes
139
2.6 SciPy 0.9.0 Release Notes
.144
3 Reference
147
3.1 Clustering package(scipy cluster
.147
3.2 Constants(scipy constant s)
170
3.3 Fourier transforms(scipy. fftpack)
85
3.4 Integration and ODEs(scipy integrate)
.....196
3.5 Interpolation (sc
p
olate
3.6 Input and output(scipy. io)
238
3.7 Linear algebra(scipy linalg)
3.8 Maximum entropy models(scipy. maxentropy
244
..278
3.9 Miscellaneous routines(scipy. misc)
290
3.10 Multi-dimensional image processing(scipy cimage)
297
3. 11 Orthogonal distance regression(scipy odr)
350
3. 12 Optimization and root finding(scipy opt imi.e)
357
3.13 Signal processing(scipy. signal)
399
3. 14 Sparse matrices(scipy. sparse)
....438
3.15 Sparse linear algebra(scipy. sparse. linalg)
460
3. 16 Spatial algorithms and data structures(scipy. spatial)
483
3.17 Distance computations(scipy spatial distance)
.502
3.18 Special functions(scipy. special)
...519
3. 19 Statistical functions(scipy. stats
544
3.20 C/C++ integration(scipy weave)
.740
Bibliography
745
Python Module Index
753
Index
755
SciPy Reference Guide, Release 0.9.0.dev6665
Release
0.9dev6665
Date
October 30. 2010
SciPy(pronounced""Sigh Pie )is open-source software for mathematics, science, and engineering
CONTENTS
SciPy Reference Guide, Release 0.9.0.dev6665
CONTENTS
CHAPTER
ONE
SCIPY TUTORIAL
1.1 Introduction
Contents
ntroduction
SciPy organization
Finding documentation
SciPy is a collection of mathematical algorithms and convenience functions built on the Numpy extension for Python
It adds significant power to the interactive Python session by exposing the user to high-level commands and classes
for the manipulation and visualization of data. With SciPy, an interactive Python session becomes a data-processing
and system-prototyping environment rivaling sytems such as Matlab, IDL, Octave, R-Lab, and scilab
The additional power of using SciPy within Python, however, is that a powerful programming language is also available
for use in developing sophisticated programs and specialized applications. Scientific applications written in SciPy
benefit from the development of additional modules in numerous niches of the software landscape by developers
across the world. Everything from parallel programming to web and data-base subroutines and classes have been
made available to the Python programmer All of this power is available in addition to the mathematical libraries in
SciPy
This document provides a tutorial for the first-time user of SciPy to help get started with some of the features available
in this powerful package. It is assumed that the user has already installed the package. Some general Python facility
is also assumed such as could be acquired by working through the Tutorial in the Python distribution. For further
introductory help the user is directed to the Numpy documentation
For brevity and convenience, we will often assume that the main packages(numpy, scipy, and matplotlib) have been
imported as
>> import numpy as np
>> import scipy as sp
>>> import matplotlib as mpl
>> import matplotlib. pyplot as plt
These are the import conventions that our community has adopted after discussion on public mailing lists. You will
see these conventions used throughout NumPy and SciPy source code and documentation. While we obviously dont
require you to follow these conventions in your own code, it is highly recommended.
3
SciPy Reference Guide, Release 0.9.0.dev6665
1.1.1 SciPy Organization
SciPy is organized into subpackages covering different scientific computing domains. These are summarized in the
following table
Subpackage
Description
cluser
Clustering algorithms
constants
Physical and mathematical constants
fftpack
Fast fourier transform routines
integrate
Integration and ordinary differential equation solvers
interpolate Interpolation and smoothing splines
Input and Output
linalg
Linear algebra
maxentropy Maximum entropy methods
ndimage
N-dimensional image processing
odr
Orthogonal distance regression
optimize
Optimization and root-finding routines
signal
Signal
ng
sparse
Sparse matrices and associated routines
spatial
Spatial data structures and algorithms
special
Special functions
stats
Statistical distributions and functions
weave
C/C++ integration
Scipy sub-packages need to be imported separately, for example
>>>from scipy import linalg, optimize
Because of their ubiquitousness, some of the functions in these subpackages are also made available in the scipy
namespace to ease their use in interactive sessions and programs. In addition, many basic array functions from numpy
are also available at the top-level of the scipy package. Before looking at the sub-packages individually, we will first
look at some of these common functions
1.1.2 Finding Documentation
ScipyandNumpyhavehtMlandPdfversionsoftheirdocumentationavailableathttp://docs.scipy.org/,which
currently details nearly all available functionality. However, this documentation is still work-in-progress, and some
parts may be incomplete or sparse. As we are a volunteer organization and depend on the community for growth
your participation- everything from providing feedback to improving the documentation and code- is welcome and
actively encouraged
Python also provides the facility of documentation strings. The functions and classes available in SciPy use this method
for on-line documentation. There are two methods for reading these messages and getting help. Python provides the
command he lp in the pydoc module. Entering this command with no arguments (i. e. >> helo)launches an
interactive help session that allows searching through the key words and modules available to all of Python. Running
the command help with an object as the argument displays the calling signature, and the documentation string of the
object.
The pydoc method of help is sophisticated but uses a pager to display the text. Sometimes this can interfere with
the terminal you are running the interactive session within. A scipy-specific help system is also available under the
command sp. info. The signature and documentation string for the object passed to the help command are printed
to standard output (or to a writeable object passed as the third argument). The second keyword argument of sp. info
defines the maximum width of the line for printing. If a module is passed as the argument to help than a list of the
functions and classes defined in that module is printed. For exampl
Chapter 1. SciPy Tutorial
SciPy Reference Guide, Release 0.9.0.dev6665
>> spinfo(optimize fmin)
fmin(func, x0, args=(), xtol-00001, ftol-00001, maxitcr-None, maxfun-None,
full _output=0r diso=l, retall-0, callback-None)
Minimize a function using the downhill simplex algorithm
Parameters
func callable func(x,*args)
The objective function to be minimized
x0 ndarray
Initial guess
a工gs
tuple
ExTra argumenTs passed Lo func,i.e.'I(x, *args)
callback callable
Called after each iteration, as callback(xk), where xk is the
current parameter vector
Returns: (opt, t fopt, iter, funcalls, warnflag))
opt:
Parameter that minimizes function
fopt float
Value of funcLion aL minimum:LopL=funC(XOpL
ter int
umber of iterations performed
furcalis int
Number of function calls made
arnflag int
1: Maximum number of function evaluations made
2: Maximum number of iterations reached
allvecs list
Sclution at each iteration
大 ther parameters:
tol
float
Relative error in opt acceptable for convergence
ftol rumber
Relative error in func(xopt) acceptable =or convergence
maxiter int
Maximum number of iterations t
maxfun number
Maximum number of function evaluations to make
full cutput bool
Set to True l- tval and warnflag outputs are desired
disp boo I
Set to True to print convergence messages
retall bool
Set to True to reurn ist of solutions at cach iteration
Note
Nelder-Mead simpl
gorithm to find the minimum cf
function of one or more variables
Another useful command is source. When given a function written in Python as an argument, it prints out a listing
of the source code for that function. This can be helpful in learning about an algorithm or understanding exactly what
1.1. Introduction
SciPy Reference Guide, Release 0.9.0.dev6665
function is doing with its arguments. Also dont forget about the Python command dir which can be used to look
at the namespace of a module or package
1.2 Basic functions in Numpy(and top-level scipy
Contents
Basic fu
s in Numpy(and top-level scipy
Interaction with Numpy
Top-level scipy routines
Type handling
k ndex tricks
hape manipulation
本 Polynomials
4: Vectorizing functions(vectorize)
* k Other useful functions
Common functions
1.2.1 Interaction with Numpy
To begin with, all of the Numpy functions have been subsumed into the scipy namespace so that all of those func
tions are available without additionally importing Numpy. In addition, the universal functions(addition, subtraction
division) have been altered to not raise exceptions if floating-point errors are encountered; instead, NaN's and Infs
are returned in the arrays. To assist in detection of these events, several functions(spisnan, spisfinite
sp.isif) are available
Finally, some of the basic functions like log, sqrt, and inverse trig functions have been modified to return complex
numbers instead of NaNs where appropriate(i.e. sp. sqrt(-1)returns 11).
1.2.2 Top-level scipy routines
The purpose of the top level of scipy is to collect general-purpose routines that the other sub-packages can use and to
provide a simple replacement for Numpy. Any time you night think to import Nunpy. you can import scipy instead
and remove yourself from direct dependence on Numpy. These routines are divided into several files for organizational
purposes, but they are all available under the numpy namespace(and the scipy namespace). There are routines for
type handling and type checking, shape and matrix manipulation, polynomial processing, and other useful functions
Rather than giving a detailed description of each of these functions(which is available in the Numpy reference Guide
by using the help, info and source commands), this tutorial will discuss some of the more useful commands
which require a little introduction to use to their full potential
Type handling
Note the difference between sp. iscomplexsp.isreal and sp. iscomplexobj/sp. isrealobj. The for
mer command is array based and returns byte arrays of ones and zeros providing the result of the element-wise test
The latter command is object based and returns a scalar describing the result of the test on the entire object
Often it is required to get just the real and/or imaginary part of a complex number. While complex numbers and arrays
have attributes that return those values, if one is not sure whether or not the object will be complex-valued, it is better
to use the functional forms sp. real and sp imag. These functions succeed for anything that can be turned into
Chapter 1. SciPy Tutorial
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.