`misc.common`¶

Functions which are common and require SciPy Base and Level 1 SciPy (special, linalg)

Module Contents¶

Functions¶

 `central_diff_weights`(Np,ndiv=1) Return weights for an Np-point central derivative. `derivative`(func,x0,dx=1.0,n=1,args=tuple,order=3) Find the n-th derivative of a function at a point. `ascent`() Get an 8-bit grayscale bit-depth, 512 x 512 derived image for easy use in demos `face`(gray=False) Get a 1024 x 768, color image of a raccoon face.
`central_diff_weights`(Np, ndiv=1)

Return weights for an Np-point central derivative.

Assumes equally-spaced function points.

If weights are in the vector w, then derivative is w[0] * f(x-ho*dx) + … + w[-1] * f(x+h0*dx)

Np : int
Number of points for the central derivative.
ndiv : int, optional
Number of divisions. Default is 1.

Can be inaccurate for large number of points.

`derivative`(func, x0, dx=1.0, n=1, args=tuple, order=3)

Find the n-th derivative of a function at a point.

Given a function, use a central difference formula with spacing dx to compute the n-th derivative at x0.

func : function
Input function.
x0 : float
The point at which n-th derivative is found.
dx : float, optional
Spacing.
n : int, optional
Order of the derivative. Default is 1.
args : tuple, optional
Arguments
order : int, optional
Number of points to use, must be odd.

Decreasing the step size too small can result in round-off error.

```>>> from scipy.misc import derivative
>>> def f(x):
...     return x**3 + x**2
>>> derivative(f, 1.0, dx=1e-6)
4.9999999999217337
```
`ascent`()

Get an 8-bit grayscale bit-depth, 512 x 512 derived image for easy use in demos

The image is derived from accent-to-the-top.jpg at http://www.public-domain-image.com/people-public-domain-images-pictures/

None

ascent : ndarray
convenient image to use for testing and demonstration
```>>> import scipy.misc
>>> ascent = scipy.misc.ascent()
>>> ascent.shape
(512, 512)
>>> ascent.max()
255
```
```>>> import matplotlib.pyplot as plt
>>> plt.gray()
>>> plt.imshow(ascent)
>>> plt.show()
```
`face`(gray=False)

Get a 1024 x 768, color image of a raccoon face.

raccoon-procyon-lotor.jpg at http://www.public-domain-image.com

gray : bool, optional
If True return 8-bit grey-scale image, otherwise return a color image
face : ndarray
image of a racoon face
```>>> import scipy.misc
>>> face = scipy.misc.face()
>>> face.shape
(768, 1024, 3)
>>> face.max()
255
>>> face.dtype
dtype('uint8')
```
```>>> import matplotlib.pyplot as plt
>>> plt.gray()
>>> plt.imshow(face)
>>> plt.show()
```