xfuns.htmlTEXTMPad1ʵ{{UMathPad XFuns

  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 http://pubpages.unh.edu/~mwidholm/MathPad

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.

Adding XFuns will increase MathPads memory needs. Use the Finder's get info box to increase MathPad's memory size.

Most of XFun files contain both 68K and PowerPC code. Some XFuns are PowerPC only.

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.5 distribution

AEvents2
Add custom AppleEvents for scripting MathPad. AEvents2 works with MathPad 2.5.

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

fft
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.

FileExists
Check to see if the named file exists
-- FileExists(name)

finance
Finance routines
-- annuity(rate,periods) computes the present value factor for an annuity
-- compound(rate,periods) computes the compound interest factor

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

GetTime
System date time routines
-- GetTime(0) returns the current date time {yr,mo,day,hr,min,sec}
-- Date2Secs(date) converts {yr,mo,day,hr,min,sec} to seconds since 1904
-- Secs2Date(secs) converts seconds since 1904 to {yr,mo,day,hr,min,sec}

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

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

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

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

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

playsynth
Play sounds using the wave-table syntesizer
-- loadsynth(wave)
-- playsynth(note,dur,amp)

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

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

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

readsnd
Sampled sound routines. Version 1.1 has improved memory management.
-- readsnd(fname) reads in a system 7 sampled sound file.
-- writesnd(fname,samples,rate,bits) writes a system 7 sampled sound file.
-- playsnd(samples,rate,bits) plays an array as a sampled sound.

readxy
Read coordinates and labels from a delimited text file.
-- readxy(fname,skip,npts)

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

sizeaxis
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)

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

SVD
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

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

viewsurf
Display a projection of a 3D surface
-- viewsurf(zgrid,plotflag)
ddf ?5Ȯ +,(Monaco9Monaco9$0 ddf0nZPRefSTR#&SPRF2%$%<% font & size