MathPad XFuns

XFuns are plug-in modules that can be used to extend MathPad's capabilities. Several XFuns are included with the MathPad distribution. More are available at

To add an XFun, drag the file from the "XFuns" folder the into MathPad's "Active XFuns" folder. If MathPad is already running, you must quit and re-launch it to see the new XFun.

Installed XFuns will be added to the Functions menu and typically also add items to the Help menu to show how to use the function.

Programers interested in writing their own XFuns can download an XFun kit. It contains documentation, interface routines and C source code for several example XFuns. CodeWarrior projects are included but other development systems should be able to create Xfuns as well.

XFuns included with the MathPad 2.6 distribution

Set up a custom color table for image plots.
-- ColorTable(RGBarray)

Discrete Fourier transform routines
-- fft(C) transform of a complex array.
-- invfft(C) inverse transform.
-- rfft(R) transform of a real array.
-- pwrspec(R) power spectrum estimate of a real array.

Gamma and error functions
-- gamma(n)
-- lgamma(n)
-- erf(n)
-- erfc(n)

Accumulate a histogram of the values in an array
-- histogram(array,lo,hi,nbins)

Accumulate a 2D histogram
-- histo2D(xarray,xlo,xhi,xbins,yarray,ylo,yhi,ybins)

Hyperbolic trig functions
-- acosh(n)
-- asinh(n)
-- atanh(n)
-- cosh(n)
-- sinh(n)
-- tanh(n)

Allow direct specification of image color components
-- imageRGB(rgbarray,pixsize)

Fit data to a straight line using linear regression
-- linfit(XYpoints)

Utility functions for 1D arrays
-- max(array)
-- min(array)
-- maxindex(array)
-- minindex(array)
-- ave(array)

Can be called repeatedly during a long calculation to display a window with a progress bar and an estimate for time remaining.
-- progressbar(percent)

Save a sequence of plots as a QuickTime movie.
-- movie(fname,nframes)

Read a PICT file as an array of grayscale values.
-- readgray(fname,width,height)

Read and write sound files to and from a data array
-- readsnd("fname")
-- writesnd("fname",samples,rate,bits)
-- playsnd(samples,rate,bits)

Read a PICT file and displays it as a data plot overlay
-- showPICT(fname,left,bot,width,ht)

Change the plot window size to get a specific data axis size or aspect ratio. Can be used to force a square data display coordinate system.
-- sizeaxis(xpix,ypix)

Allow values to be controlled by slider bars
-- slider(name,min,max)

Linear algebra tools using singular value decomposition. These XFuns are considerably faster and more accurate than using the det() function.
-- solve(A,B) solves a system of linear equations A*X = B
-- invert(A) finds the inverse of matrix A
-- SVD(A) returns the decomposition arrays

Return the current system tick count for timing comparisons
-- ticks(0)

Display a projection of a 3D surface
-- viewsurf(zgrid,plotflag)