# Function approximations

There is an excellent number theoretical BASIC called UBASIC. It can handle arbitrary precision numbers and so it is ideally suited for approximations and number theoretic manipulations like factoring large numbers. If you cannot find it on the net, you can download it here.

I have ported a MINIMAX VIA ERROR FLUFFING ALGORITHM by Steven A. Ruzinsky to UBASIC. This program demonstrated the determination of polynomial coefficients to a minimum maximum absolute error criterion. The UBASIC version, by virtue of the larger precision, is more practical and useful.

Using UBASIC I have made a program to approximate functions that are known analytically, by calculating the true Chebychev coefficients directly from its definition. As everybody knows, a Chebychev approximation is a polynomial with the property that positive and negative deviations alternate and all the deviations are equal. This program makes those deviations equal to a certain precision specified by the user. 20 bits is easily obtainable if the order of the approximation is not too large. If you can't run it you may want to look at the some outputs
NOTE: Chebychev approximations are no longer the best choice for very high precision approximation. Use rational approximations, i.e. quotients of polynomials, instead.

For the testing of function approximations I have made a toolset that generates tables of functions with a given interval and a given precision. Again this requires UBASIC. The forth program used for testing the floating point of tForth is supplied as an example. The tables with extension .ftb are interpreted as programs in Forth. These tables are examples. In a real test tables are much denser and occupy many megabytes. You have to create them yourself using UBASIC.