Markwardt IDL Page

What's New Markwardt IDL Pages Entire Web

Craig's techie blog.

IDL Mathematics

INTERPOLATE - Cubic and Quintic Interpolation

CUBETERP and QUINTERP perform cubic and quintic interpolation of a known, tabulated function. These routines are different from the many other interpolation routines fr IDL in that they allow you to choose the first derivative -- and second derivative in the case of QUINTERP -- at each control point. In other words, these are not standard "natural" splines, but rather smooth polynomials with specified derivatives at every point. The caller specifies the tabulated values and derivatives and requested interpolation points, and returns the interpolated values (and optionally the interpolated derivaties). If you do not need to specify the derivative values explicitly, then you likely want to use SPL_INIT/SPL_INTERP instead.
 May 05 2009 7 kb cubeterp.pro May 05 2009 6 kb quinterp.pro

PHUNWRAP - Phase Unwrapping to Remove Cycle Jumps

PHUNWRAP unwraps a sequence of phases to produce a new series of cycle counts. Phase jumps due to crossing over the PHASE=0 boundary are removed by adding an integral number of cycles. The algorithm is based on the MATLAB "unwrap" function. Users can select the tolerance used to determine the phase jump, and can also select the definition of "1 cycle."

 Mar 28 2006 3 kb phunwrap.pro

QUATERNIONS - Library to Manipulate and Use Quaternions

This library provides routines to manipulate and use quaternions in IDL. Quaternions are 4-vectors that can be used to represent the orientations of one reference frame with respect to another. In practical terms, quaternions represent arbitrary three dimensional rotations. They have many advantages over rotation matrices (i.e., direction cosine matrices) and over Euler angles. Quaternions are used in computer animation to represent the orientation of the camera, and in spacecraft navigation to represent the body attitude.

The function QTCOMPOSE is used to make a quaternion from a rotation axis and angle. The functions QTANG and QTAXIS are used to extract the rotation axis and angle from an existing quaternion. The functions QTMAT and QTFIND are used to convert to and from the direction cosine matrix representation. The functions QTERP, QTPOW, QTLOG and QTEXP are used to perform smooth interpolations between orientations. The functions QTINV and QTMULT construct the quaternion inverse and product respectively. The function QTVROT transforms a 3-vector according to a quaternion rotation. QTEULER is a convenience routine to chain together multiple Euler-like rotations. QTNORMALIZE normalizes a quaternion to be a unit quaternion and/or enforces other regularity constraints.

 Jan 02 2009 2 kb qtang.pro Jan 02 2009 2 kb qtaxis.pro Jan 02 2009 3 kb qtcompose.pro Nov 10 2012 7 kb qterp.pro Oct 02 2012 5 kb qteuler.pro May 13 2002 3 kb qtexp.pro May 19 2016 6 kb qtfind.pro May 13 2002 2 kb qtinv.pro May 13 2002 3 kb qtlog.pro Jan 02 2009 3 kb qtmat.pro Sep 06 2007 5 kb qtmult.pro Jan 02 2009 3 kb qtmultn.pro Oct 02 2012 3 kb qtnormalize.pro May 13 2002 3 kb qtpow.pro May 13 2002 6 kb qtvrot.pro

UNITVEC - Manipulate unit vectors and polar angles

These three functions provide ways to manipulate unit vectors as 3-vectors and as spherical polar angles. (also known as longitude and latitude; or longitude and colatitude; or right ascension and declination)

UNITIZE returns a unit vector for any input vector. The returned vector has the same direction as the input, but unit magnitude.

ANGUNITVEC and UNITVECANG convert between 3-component vector notation and spherical polar angles. ANGUNITVEC converts from longitude and (co)latitude (or RA/Dec) to a unit 3-vector. UNITVECANG does the reverse conversion.
 Oct 02 2012 2 kb unitize.pro Oct 02 2012 3 kb unitvecang.pro Oct 02 2012 2 kb angunitvec.pro

QPINT1D adaptively calculates an approximation result to a given definite integral, hopefully satisfying a constraint on the accuracy of the solution. QPINT1D is based on the QUADPACK fortran package originally by Piessens, de Doncker, Ueberhuber and Kahaner (and implements equivalents to the QAGSE, QAGPE, QAGIE, and DQKxx fortran routines). All of these specialized integrators are combined into a single convenient callable IDL procedure.

QPINT1D integrates both IDL functions and IDL expressions. It handles integrands with known and unknown but integrable singularities, and also can compute improper integrals (i.e., integrals whose limits extend to infinity).

QPINT1D is "adaptive" in the sense that it locates regions of the integration interval which contain the highest error, and focusses its efforts on those regions. The algorithm locates these regions by successively bisecting the starting interval. Each subinterval is assigned an error estimate, and the region with the largest error estimate is subdivided further, until each subinterval carries approximately the same amount of error. Convergence of the procedure may be accelerated by the Epsilon algorithm due to Wynn.

 Nov 18 2010 60 kb qpint1d.pro

DDEABM - Integrate Ordinary Differential Equation (Adams-Bashforth-Moulton)

DDEABM performs integration of a system of one or more ordinary differential equations (ODEs) using a Predictor-Corrector technique. An adaptive Adams-Bashforth-Moulton method of variable order between one and twelve, adaptive stepsize, and error control, is used to integrate equations of the form:

```   DF_DT = FUNCT(T, F)
```

T is the independent variable, F is the (possibly vector) function value at T, and DF_DT is the derivative of F with respect to T, evaluated at T. FUNCT is a user function which returns the derivative of one or more equations.

DDEABM is based on the public domain procedure DDEABM.F written by L. F. Shampine and M. K. Gordon, and available in the DEPAC package of solvers within SLATEC library.

DDEABM is used primarily to solve non-stiff and mildly stiff ODE problems, where evaluation of the user function is expensive, or high precision is demanded (close to the machine precision).

 Dec 18 2012 121 kb ddeabm.pro

CHEB - Approximation and interpolation using Chebyshev polynomials

This is a set of three IDL functions, used for the interpolation and approximation of mathematical functions over finite intervals by Chebyshev polynomials. The approximating function is:

f(x) = Sum[ c_j T_j(x) ]

where "c_j" are the Chebyshev coefficients and T_j(x) are the orthogonal Chebyshev polynomials. By default the interval is [-1,1], but this can be changed with the INTERVAL keyword.

Chebyshev approximations are most appropriate when a known smooth function is expensive to calculate. With a small number of function evaluations, the Chebyshev coefficients can be determined once, and then the Chebyshev series can be subsequently evaluated quickly for many abcissae.

The approximation method proceeds in two steps. First, the user must estimate the Chebyshev coefficients. CHEBCOEF is normally used in this case, for functions which can be evaluated to full machine precision at arbitrary abcissae. For noisy or tabulated data, users should use CHEBFIT instead. For data tabulated on a uniform grid, the CHEBGRID function is appropriate. The result of either of these functions is an array of coefficients. The second step involves computing the function value at the desired abcissae, for which the CHEBEVAL function is used. Several mechanisms are provided to the user to control the approximation error.

LEGCHEB can estimate the coefficients of the Legendre series if the Chebyshev series coefficients are already known.

 May 13 2002 12 kb chebcoef.pro Jan 30 2005 4 kb chebeval.pro Aug 10 2003 8 kb chebfit.pro Nov 06 2002 16 kb chebgrid.pro Sep 25 2002 4 kb legcheb.pro

QRFAC - Linear Least Squares Solutions using QR decomposition

Given an MxN matrix A (M>N), the procedure QRFAC computes the QR decomposition (factorization) of A. This factorization is useful in least squares applications solving the equation, A ## x = B. Together with the procedure QRSOLV, this equation can be solved in a least squares sense.

The QR factorization produces two matrices, Q and R, such that

A = Q ## R

where Q is orthogonal such that TRANSPOSE(Q)##Q equals the identity matrix, and R is upper triangular. This procedure does not compute Q directly, but returns the more-compact Householder reflectors, which QRSOLV applies in constructing the solution.

The solution technique is to first compute the factorization using QRFAC, which yields the orthogonal matrix Q and the upper triangular matrix R. Then the solution vector, X, is computed using QRSOLV.

Pivoting can be performed using the PIVOT keyword.

 Dec 17 2007 8 kb qrfac.pro Jul 16 2004 4 kb qrsolv.pro

MCHOLDC - Modified Cholesky factorization of a symmetric matrix

Given a symmetric matrix A, the MCHOLDC procedure computes the factorization:

A + E = TRANSPOSE(U) ## D ## U

where A is the original matrix (optionally permuted if the PIVOT keyword is set), U is an upper triangular matrix, D is a diagonal matrix, and E is a diagonal error matrix.

The standard Cholesky factorization is only defined for a positive definite symmetric matrix (this is true both mathematically, and for the standard IDL routine CHOLDC). If the input matrix is positive definite then the error term E will be zero upon output. The user may in fact test the positive-definiteness of their matrix by factoring it and testing that all terms in E are zero.

The decomposition from MCHOLDC can now be used to solve problems with the built-in IDL function CHOLSOL, if the CHOLSOL keyword is set.

 Nov 18 2010 10 kb mcholdc.pro

CROSSPN - Efficient vector cross products of many terms

The function CROSSPN computes the vector cross product (outer product). The difference between CROSSPN and the IDL library function CROSSP, is that CROSSPN allows more than one cross product to be computed at one time (i.e., it is vectorized).

Thus, in the expression "C = CROSSPN(A, B)" the vector cross product is computed as C = A x B. Because CROSSPN is vectorized, the vector cross product of any combination of 3-vectors and 3xN arrays can be computed.

 Mar 22 2002 2 kb crosspn.pro

ACIRCCIRC - Calculate the area of overlap between two circular regions

ACIRCCIRC computes the overlap area between two circles. The circles are specified by their radii, R1 and R2, and the distance between the centers of the circles.

ACIRCCIRC handles cases of partial overlap, as well degenerate cases of no overlap and circle 1 completely enclosed within circle 2 (or vice versa).
 May 19 2016 2 kb acirccirc.pro