ARRAY(<ary>,FLOAT,<dim1>); or ARRAY(<ary>,FLOAT,<dim1>,<dim2>);
For 1D arrays
<dim1> = 2^n-1
and for 2D arrays
(i.e. the array is square). (Recall that MACSYMA arrays are indexed from a 0 origin so that there will be 2^n and (2^n)^2 arrays elements in the above two cases.) This package also contains two other functions, POLARTORECT and RECTTOPOLAR. Do DESCRIBE(cmd) for details. For details on the implementation, do PRINTFILE(FFT,USAGE,SHARE); .
(C1) 1.0E-20*X^2-5.5*X+5.2E20; 2 (D1) 1.0E-20 X - 5.5 X + 5.2E+20 (C2) HORNER(%,X),KEEPFLOAT:TRUE; (D2) X (1.0E-20 X - 5.5) + 5.2E+20 (C3) D1,X=1.0E20; ARITHMETIC OVERFLOW (C4) D2,X=1.0E20; (D4) 6.9999999E+19
INTERPOLATE(SIN(X)=X/2,X,%PI,.1); is equivalent to INTERPOLATE(SIN(X)=X/2,X,.1,%PI);
The method used is a binary search in the range specified by the last two args. When it thinks the function is close enough to being linear, it starts using linear interpolation. An alternative syntax has been added to interpolate, this replaces the first two arguments by a function name. The function MUST be TRANSLATEd or compiled function of one argument. No checking of the result is done, so make sure the function returns a floating point number.
F(X):=(MODE_DECLARE(X,FLOAT),SIN(X)-X/2.0); INTERPOLATE(SIN(X)-X/2,X,0.1,%PI) time= 60 msec INTERPOLATE(F(X),X,0.1,%PI); time= 68 msec TRANSLATE(F); INTERPOLATE(F(X),X,0.1,%PI); time= 26 msec INTERPOLATE(F,0.1,%PI); time= 5 msec
There is also a Newton method interpolation routine, do DESCRIBE(NEWTON); .
<real>=<magnitude>*COS(<phase>) ==> <imaginary>=<magnitude>*SIN(<phase>
This function is part of the FFT package. Do LOAD(FFT); to use it. Like FFT and IFT this function accepts 1 or 2 dimensional arrays. However, the array dimensions need not be a power of 2, nor need the 2D arrays be square.