Tuesday, April 29, 2008

Have you visited the TK Library lately?

The hundreds of tools in the TK Solver Library can save you hours of programming time. Many of the tech calls I receive regarding application development with TK are answered with the use of one or more TK Library functions. It's good to stay acquainted with all that's in there. Here’s a quick tour of some of the most popular Library tools and some of the more recent additions.

Bilinear Interpolation
The inpol2 function is found under Utilities -- Model Solving. It can be used to convert tables of data (families of curves) into two-way look-up tables with interpolation.

Calendar Functions
These are found under Utilities – Miscellaneous. There are six functions for computing days between dates, a useful collection for financial calculations.

Graphics Tools
The “pickit” tools are found under Utilities – Graphics. This collection of functions generates plot coordinates for lines, boxes, circles, and other shapes and can rotate, translate, mirror, and otherwise transform the coordinates. There are also 34 functions found in the Mathematics – Geometry folder for doing geometry calculations frequently required for CAD. For example, there are various equations for lines, angles, points of intersection, rules for collinearity and parallelism and a function for determining the coordinates of the common tangent of two circles.

Unit Sheets
Perhaps the most commonly used time-savers in the TK Library, these unit sheets – arranged by discipline – can be merged into your TK models to allow for a variety of different display units for your variables and lists. These unit sheets are found under Utilities – Units and Conversions.

Fluids and Mixtures
The Utilities – Fluid Properties folder includes tools for calculations involving combustion, psychrometric charts and latent heat of vaporization but the Fluids and Mixtures file is probably the most frequently referenced. It summarizes the results from all the built-in fluid property functions.

Root Finders
The tools in the Mathematics – Roots of Equations folder are a must for TK application developers. These functions can be used instead of the built-in iterative solver to solve sub-tasks within an application such as generating plot data. The most recent addition to this folder is a tool called mbisect which hunts for and returns multiple roots of functions.

Functions of Complex Numbers
The 18 comfun tools under Mathematics – Complex Numbers compute functions of complex numbers such as square root, log, and a variety of trig functions.

Similar to the root-finders, these tools can be used to process sub-tasks within TK models, freeing the Optimizer for use with the complete model. A very popular routine is the Marqoptn function based on the Marquardt algorithm for nonlinear optimization with numerical differentiation of the objective function with respect to the decision variables.

Random Number Generation
A recent addition to the Statistics – Distributions and Random Numbers folder provides the ability to generate correlated multivariate random values. This can be vital in performing Monte Carlo simulations where it is known that two or more input variables in a model are not independent.

The TK Library now includes random number generators for 33 different probability distributions, from Beta to Zipf-Mandelbrot. It also includes routines for fitting distribution parameters to lists of values.

Financial Modeling Tools
The Finance folder includes the very popular mortgage calculator and a few other, more sophisticated tools such as the Black-Scholes options pricing model.

Labels: ,


Dell Computer Deals