[Scipy-svn] r6887 - in trunk/doc/source: . tutorial

scipy-svn@scip... scipy-svn@scip...
Sun Nov 14 03:59:58 CST 2010


Author: rgommers
Date: 2010-11-14 03:59:58 -0600 (Sun, 14 Nov 2010)
New Revision: 6887

Modified:
   trunk/doc/source/fftpack.rst
   trunk/doc/source/stats.rst
   trunk/doc/source/tutorial/basic.rst
   trunk/doc/source/tutorial/fftpack.rst
   trunk/doc/source/tutorial/general.rst
   trunk/doc/source/tutorial/io.rst
   trunk/doc/source/tutorial/special.rst
Log:
DOC: merge wiki edits for tutorials.

Modified: trunk/doc/source/fftpack.rst
===================================================================
--- trunk/doc/source/fftpack.rst	2010-11-14 09:59:33 UTC (rev 6886)
+++ trunk/doc/source/fftpack.rst	2010-11-14 09:59:58 UTC (rev 6887)
@@ -43,7 +43,7 @@
 
    fftshift
    ifftshift
-   dftfreq
+   fftfreq
    rfftfreq
 
 Convolutions (:mod:`scipy.fftpack.convolve`)

Modified: trunk/doc/source/stats.rst
===================================================================
--- trunk/doc/source/stats.rst	2010-11-14 09:59:33 UTC (rev 6886)
+++ trunk/doc/source/stats.rst	2010-11-14 09:59:58 UTC (rev 6887)
@@ -197,6 +197,7 @@
    z
    zs
    zmap
+   zscore
 
 .. autosummary::
    :toctree: generated/

Modified: trunk/doc/source/tutorial/basic.rst
===================================================================
--- trunk/doc/source/tutorial/basic.rst	2010-11-14 09:59:33 UTC (rev 6886)
+++ trunk/doc/source/tutorial/basic.rst	2010-11-14 09:59:58 UTC (rev 6887)
@@ -86,7 +86,7 @@
 part will discuss the operation of :obj:`sp.mgrid` , :obj:`sp.ogrid` ,
 :obj:`sp.r_` , and :obj:`sp.c_` for quickly constructing arrays.
 
-One familiar with Matlab may complain that it is difficult to
+One familiar with MATLAB (R) may complain that it is difficult to
 construct arrays from the interactive session with Python. Suppose,
 for example that one wants to construct an array that begins with 3
 followed by 5 zeros and then contains 10 numbers spanning the range -1

Modified: trunk/doc/source/tutorial/fftpack.rst
===================================================================
--- trunk/doc/source/tutorial/fftpack.rst	2010-11-14 09:59:33 UTC (rev 6886)
+++ trunk/doc/source/tutorial/fftpack.rst	2010-11-14 09:59:58 UTC (rev 6887)
@@ -47,7 +47,7 @@
 Return the Discrete Cosine Transform [Mak]_ of arbitrary type sequence ``x``.
 
 For a single dimension array ``x``, ``dct(x, norm='ortho')`` is equal to
-matlab ``dct(x)``.
+MATLAB ``dct(x)``.
 
 There are theoretically 8 types of the DCT [WP]_, only the first 3 types are
 implemented in scipy. 'The' DCT generally refers to DCT type 2, and 'the'

Modified: trunk/doc/source/tutorial/general.rst
===================================================================
--- trunk/doc/source/tutorial/general.rst	2010-11-14 09:59:33 UTC (rev 6886)
+++ trunk/doc/source/tutorial/general.rst	2010-11-14 09:59:58 UTC (rev 6887)
@@ -10,7 +10,7 @@
 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.
+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

Modified: trunk/doc/source/tutorial/io.rst
===================================================================
--- trunk/doc/source/tutorial/io.rst	2010-11-14 09:59:33 UTC (rev 6886)
+++ trunk/doc/source/tutorial/io.rst	2010-11-14 09:59:58 UTC (rev 6887)
@@ -7,7 +7,7 @@
 
 .. seealso:: :ref:`numpy-reference.routines.io` (in numpy)
 
-Matlab files
+MATLAB files
 ------------
 
 .. autosummary::
@@ -25,7 +25,8 @@
    sio.loadmat
    sio.savemat
 
-These are the high-level functions you will most likely use.  You'll also find::
+These are the high-level functions you will most likely use.  You'll
+also find::
 
    sio.matlab
 
@@ -38,10 +39,10 @@
 ```````````````
 
 You may have a ``.mat`` file that you want to read into Scipy.  Or, you
-want to pass some variables from Scipy / Numpy into Matlab.
+want to pass some variables from Scipy / Numpy into MATLAB.
 
-To save us using a Matlab license, let's start in Octave_.  Octave has
-Matlab-compatible save / load functions.  Start Octave (``octave`` at
+To save us using a MATLAB license, let's start in Octave_.  Octave has
+MATLAB-compatible save / load functions.  Start Octave (``octave`` at
 the command line for me):
 
 .. sourcecode:: octave
@@ -72,7 +73,7 @@
 
 
 
-  octave:3> save -6 octave_a.mat a % Matlab 6 compatible
+  octave:3> save -6 octave_a.mat a % MATLAB 6 compatible
   octave:4> ls octave_a.mat
   octave_a.mat
 
@@ -82,7 +83,11 @@
   >>> print mat_contents
   {'a': array([[[  1.,   4.,   7.,  10.],
           [  2.,   5.,   8.,  11.],
-          [  3.,   6.,   9.,  12.]]]), '__version__': '1.0', '__header__': 'MATLAB 5.0 MAT-file, written by Octave 3.2.3, 2010-05-30 02:13:40 UTC', '__globals__': []}
+          [  3.,   6.,   9.,  12.]]]),
+   '__version__': '1.0',
+   '__header__': 'MATLAB 5.0 MAT-file, written by
+   Octave 3.2.3, 2010-05-30 02:13:40 UTC',
+   '__globals__': []}
   >>> oct_a = mat_contents['a']
   >>> print oct_a
   [[[  1.   4.   7.  10.]
@@ -131,7 +136,7 @@
 
    >>> sio.savemat('np_vector.mat', {'vect':vect}, oned_as='row')
 
-We can load this in Octave or Matlab:
+We can load this in Octave or MATLAB:
 
 .. sourcecode:: octave
 
@@ -147,12 +152,12 @@
        1   10
 
 
-Matlab structs
+MATLAB structs
 ``````````````
 
-Matlab structs are a little bit like Python dicts, except the field
-names must be strings.  Any Matlab object can be a value of a field.  As
-for all objects in Matlab, structs are in fact arrays of structs, where
+MATLAB structs are a little bit like Python dicts, except the field
+names must be strings.  Any MATLAB object can be a value of a field.  As
+for all objects in MATLAB, structs are in fact arrays of structs, where
 a single struct is an array of shape (1, 1).
 
 .. sourcecode:: octave
@@ -170,7 +175,7 @@
 
    >>> mat_contents = sio.loadmat('octave_struct.mat')
    >>> print mat_contents
-   {'my_struct': array([[([[1.0]], [[2.0]])]], 
+   {'my_struct': array([[([[1.0]], [[2.0]])]],
          dtype=[('field1', '|O8'), ('field2', '|O8')]), '__version__': '1.0', '__header__': 'MATLAB 5.0 MAT-file, written by Octave 3.2.3, 2010-05-30 02:00:26 UTC', '__globals__': []}
    >>> oct_struct = mat_contents['my_struct']
    >>> print oct_struct.shape
@@ -185,7 +190,7 @@
    >>> print val.dtype
    [('field1', '|O8'), ('field2', '|O8')]
 
-In this version of Scipy (0.8.0), Matlab structs come back as numpy
+In this version of Scipy (0.8.0), MATLAB structs come back as numpy
 structured arrays, with fields named for the struct fields.  You can see
 the field names in the ``dtype`` output above.  Note also:
 
@@ -200,7 +205,7 @@
 
      1   1
 
-So, in Matlab, the struct array must be at least 2D, and we replicate
+So, in MATLAB, the struct array must be at least 2D, and we replicate
 that when we read into Scipy.  If you want all length 1 dimensions
 squeezed out, try this:
 
@@ -209,10 +214,10 @@
    >>> oct_struct.shape
    ()
 
-Sometimes, it's more convenient to load the matlab structs as python
+Sometimes, it's more convenient to load the MATLAB structs as python
 objects rather than numpy structured arrarys - it can make the access
-syntax in python a bit more similar to that in matlab.  In order to do
-this, use the ``struct_as_record=False`` parameter to ``loadmat``. 
+syntax in python a bit more similar to that in MATLAB.  In order to do
+this, use the ``struct_as_record=False`` parameter to ``loadmat``.
 
    >>> mat_contents = sio.loadmat('octave_struct.mat', struct_as_record=False)
    >>> oct_struct = mat_contents['my_struct']
@@ -250,7 +255,7 @@
      field1 =  0.50000
    }
 
-You can also save structs back again to Matlab (or Octave in our case)
+You can also save structs back again to MATLAB (or Octave in our case)
 like this:
 
    >>> dt = [('f1', 'f8'), ('f2', 'S10')]
@@ -263,11 +268,11 @@
    >>> arr[1]['f2'] = 'not perl'
    >>> sio.savemat('np_struct_arr.mat', {'arr': arr})
 
-Matlab cell arrays
+MATLAB cell arrays
 ``````````````````
 
-Cell arrays in Matlab are rather like python lists, in the sense that
-the elements in the arrays can contain any type of Matlab object.  In
+Cell arrays in MATLAB are rather like python lists, in the sense that
+the elements in the arrays can contain any type of MATLAB object.  In
 fact they are most similar to numpy object arrays, and that is how we
 load them into numpy.
 
@@ -298,7 +303,7 @@
    >>> print val.dtype
    float64
 
-Saving to a Matlab cell array just involves making a numpy object array:
+Saving to a MATLAB cell array just involves making a numpy object array:
 
    >>> obj_arr = np.zeros((2,), dtype=np.object)
    >>> obj_arr[0] = 1
@@ -370,7 +375,6 @@
 
 Allows reading of  NetCDF files (version of pupynere_ package)
 
-
 .. _pupynere: http://pypi.python.org/pypi/pupynere/
 .. _octave: http://www.gnu.org/software/octave
 .. _matlab: http://www.mathworks.com/

Modified: trunk/doc/source/tutorial/special.rst
===================================================================
--- trunk/doc/source/tutorial/special.rst	2010-11-14 09:59:33 UTC (rev 6886)
+++ trunk/doc/source/tutorial/special.rst	2010-11-14 09:59:58 UTC (rev 6887)
@@ -1,8 +1,6 @@
 Special functions (:mod:`scipy.special`)
 ========================================
 
-.. sectionauthor:: Travis E. Oliphant
-
 .. currentmodule:: scipy.special
 
 The main feature of the :mod:`scipy.special` package is the definition of
@@ -21,3 +19,41 @@
 need, consider writing it and contributing it to the library. You can
 write the function in either C, Fortran, or Python. Look in the source
 code of the library for examples of each of these kinds of functions.
+
+Bessel functions of real order(:func:`jn`, :func:`jn_zeros`)
+--------------------------------------------------------------------------
+Bessel functions are a family of solutions to Bessel's differential equation
+with real or complex order alpha:
+
+.. math::
+   x^2 \frac{d^2 y}{dx^2} + x \frac{dy}{dx} + (x^2 - \alpha^2)y = 0
+
+Among other uses, these functions arise in wave propagation problems such as
+the vibrational modes of a thin drum head.  Here is an example of a circular
+drum head anchored at the edge:
+
+.. plot::
+   >>> from scipy import *
+   >>> from scipy.special import jn, jn_zeros
+   >>> def drumhead_height(n, k, distance, angle, t):
+   ...    nth_zero = jn_zeros(n, k)
+   ...    return cos(t)*cos(n*angle)*jn(n, distance*nth_zero)
+   >>> theta = r_[0:2*pi:50j]
+   >>> radius = r_[0:1:50j]
+   >>> x = array([r*cos(theta) for r in radius])
+   >>> y = array([r*sin(theta) for r in radius])
+   >>> z = array([drumhead_height(1, 1, r, theta, 0.5) for r in radius])
+
+   >>> import pylab
+   >>> from mpl_toolkits.mplot3d import Axes3D
+   >>> from matplotlib import cm
+   >>> fig = pylab.figure()
+   >>> ax = Axes3D(fig)
+   >>> ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap=cm.jet)
+   >>> ax.set_xlabel('X')
+   >>> ax.set_ylabel('Y')
+   >>> ax.set_zlabel('Z')
+   >>> pylab.show()
+
+..   :caption: Vibrating drum head using
+..             :obj:`scipy.special.jn`



More information about the Scipy-svn mailing list