# TKSolver 5.0: Rules-Based Mathematical Solutions

*An equation solver with programming capabilities that is not only an engineering tool, but an informational management tool as well*

Although this software is in its fifth version, I approach it as a novice as it is my first experience with the program. According to the company, it has been on the market since 1983, about the same time as VisiCalc, one of the first spreadsheets to be widely circulated. Although described as a "rules-based declarative programming environment" by the developers, it is basically an equation solver with programming capabilities. With these functionalities, the user can solve mathematical models of up to 32,000 equations (called "rules" in the software). The rules can be made in any order, and the software will link to databases and deploy the models on the Web. Among the other convenient features are keeping all unit conversions in a single area, automation of many operations via Wizards, a comprehensive library of built-in mathematical and programming functions, and a library of pre-programmed models.

Many of the functions of TKSolver are duplicated in spreadsheets and mathematical programming languages, but the developers highlight the software's "backsolving" capabilities, the ability to solve a system of equations proceeding either forward or backward through the list. In this manner, data outcomes may be optimized to the most desirable goals.

This latest version was released in 2003, but an update was available on the Web in late 2004. It also includes a solution optimizer for solving constrained systems, a solution tracer that performs the valuable function of tracking and documenting the details of a solution, improved plotting, wizards for creating reports and assisting with expressions, and new built-in functions. It appears that the modul-arity, equation solving techniques and mathematical symbol library make this not only an engineering tool, but also an informational management tool that many companies have used to computerize manuals and corporate standards.

##### Installation and manuals

The program comes on a single CD and installs within 1.5 minutes on an older 850 MHz Pentium with 80 percent of the hard drive already full. It occupies only 15 MB of drive space and runs quickly through shorter applications with only 125 MB of RAM.

The package comes with two manuals, a small "Getting Started" manual and a larger "User's Guide." The former does an adequate job of grounding the reader in the simpler menu driven functions and problem solving techniques, and in just 76 pages. The User's Guide has the details on all of the menu items and commands as well as the more specialized aspects of the program such as TK structure, direct and iterative solvers, solution optimizers, user-defined functions and Wizards. All explanations are clear and concise, and the inclusion of many pictures of the actual completed data/result tables does much to define all steps precisely. In addition, there are many user-friendly reminders to prompt the user to recall simple actions such as "Remember how to do this, see page...."

The box summaries used to further drive home points are also a nice idea. Unfortunately, for the scientist and engineer, all of the examples in the manuals pertain to business applications, but the tutorials and applications menus remedy that omission. For some strange reason, the full texts are not contained in the printed manual but are included on the disk. Several chapter additions and major revisions are included with this version.

##### Work environment

click the image to enlarge Figure 1: Main work area |

The main work area (Figure 1) has two sheets, one for rules (equations) and one for variables. To the right of this area is a palette of Greek letters for convenient use and, to the left, an Explorer-like 'Navigtion Bar' that gives immediate access to the other seven main worksheets. Each has a different function and its own set of tools. The seven other areas are:

• **Functions** — user-defined functions can be annotated and defined

• **Lists** — more to come on this useful feature later

• **Plots** — graphics appear and can be edited

• **Units** — units are defined and converted

• **Tables**

• **Formats**

• **Comments** — equations may be organized, further edited and annotated

In addition, a MathLook area allows the user to see the equations as they would look in standard mathematical format.

This layout eases the learning curve and makes use of the features a lot easier to both the novice and experienced user. In addition, the windows/sheets can be tiled to make any combination instantly available. This is always helpful when only some of the areas need be active and viewed/printed. Fortunately, when it comes time to saving or exporting the work, TKSolver supports the more common files types such as .xls, .txt, .wks, and .dif. Such additions to other standard mathematical/statistical programs such as SAS, JMP, Mathematica and Maple would be very useful. Before we leave this area, one brief warning: the program is case sensitive for user-defined functions! The built-in functions are not, however.

##### Mathematics/statistics/graphics

Although the program does quite a lot, it takes a bit of patience, and time is necessary to reach a comfort level with its method of operation. At first glance, it appears that the program will do only simple charting and very limited mathematics and statistics. However, upon accessing the help menu, a larger menu of built-in and user-defined functions is available, as well as some mathematical and statistical routines. It takes a while to become comfortable with the steps:

• fill in the rules

• fill in some variable values and solve

• pull down some Wizards and List solve and plot

• pull up other screens to view equations or define units

This seems rather cumbersome at first but, with a little practice, the routines proceed to solution with minimal pain.

For two examples of functionality, let us examine a simple filling routine and a 3-D mesh plot done from two columns of data. By entering three simple equations for the volume, radius and surface area of a cylinder, and then pressing enter, the variables' names will be automatically placed on the variable sheet. The program also will show an 'Unsatisfied' in the status field to let the user know it has not been satisfactorily solved. The status changes to 'Satisfied' upon solution. At this time, the equations can be viewed in their standard mathematical format in the MathLook screen. This is very helpful when editing the equations. Several variable values can then be entered and the series of equations solved for any of the other variables. Simple drop-down menus (available by double-clicking the Status field in the Variables sheet) allow choice of variable type (Input, Output, List, Guess and Blank).

If a given input will not produce a solution (and TKSolver will tell you this, either with an error box or lack of output), the letter 'G' (for guess) may be entered in the status field of the variable. The program will then iterate to an answer using our old friend the Newton-Raphson algorithm. In a similar manner, we can enter an 'L' (for list), call up the ListSolve Wizard, fill a table with many values between predefined limits and step size, and plot the result. Thus, for any series of functions we can either solve for an exact solution at a single point or examine the behavior of the functions across a range of values (Figure 2).

click the image to enlarge Figure 2: Simple iterative solve plot |

Again, a more complex plot can be made from a List Solve from two columns of data. For this, we can use a pre-defined graphic utility in conjunction with the Plot Wizard. By using the 2-D facility, we can visualize what looks remarkably like a 3-D graphic (Figure 3). It should be noted, however, that the graphics generated are of limited range and the ability to customize is not extensive. The developers stress that this is not a graphics program and its main value lies in the Backsolving and List Solve capabilities.

It will be quickly apparent, upon use of the statistical functions, that this is not a statistical program and will not easily generate many of the descriptors and tests, with diagnostics, that we expect from many of the standard statistical packages. Again, this was not the intent, and the statistical packages are there to augment simple analysis to supplement the major mathematical solvers. The mathematics included (more extensive than the statistical listing), are there to aid in the construction of more complex equations that ultimately will be submitted to the Solver. To further the solution power, an optional 'Optimizer' module is available.

The software has other features that cry for upgrades, as one drawback of the curve fitting utility was lack of automatic selection for best fit. In this case, the user will have to try several fits and judge which is best in terms of the process being fit. The method produces other graphics such as residuals and Cook's Distances, but is far less informative that the tables of diagnostics produced by specialized statistical programs.

Figure 3: A 3-D mesh plotted in 2-D |

##### Summary

So, we have a program that does backsolving, some mathematical/statistical functions and limited plotting. What are we getting here that we don't have in Excel? There are several areas where this software will make life a little (or a lot) easier. As the astute reader may have guessed, much of what this program does can be implemented in Excel, merely with a lot more pain and suffering! The main functionality, the Backsolver, allows the user to solve an equation, or a series of equations, for any variable without having to isolate that variable in the expression. The equations may be entered in any order. It will also take a starting value guess for equations not solvable for a single value entered, and will iterate to an acceptable answer.

The TK Solver Library is a collection of tools and programs written in the program's procedure language. Whereas each of the programs built-in functions handles a very specific task, the TK Library routines each perform a series of tasks to accomplish more complex computations. The software also includes several classes of functions that are not found in Excel, such as numerical solution of differential equations, thermodynamic and transport properties of pure fluids and mixtures, and nonlinear curve fitting.

The TK Solver Library is a collection of tools and programs written in the program's procedure language. Whereas each of the programs built-in functions handles a very specific task, the TK Library routines each perform a series of tasks to accomplish more complex computations. The software also includes several classes of functions that are not found in Excel, such as numerical solution of differential equations, thermodynamic and transport properties of pure fluids and mixtures, and nonlinear curve fitting.

Help is available through a variety of avenues: online, phone, fax, e-mail, and letter. When calling for further explanation on the plotting and routines, I was pleased to speak with a product manager who not only quickly stepped me through the routines, but also pointed out the strengths and weaknesses of each. I found the on-line help to be uneven, as some items are indexed and readily accessible, and others, such as the use of the statistical menus, a little harder to find.

For the business user, engineer, student and physical scientist there appears to be much of interest here.

##### Availability

• Standard version $399

• Premium version (with Solution Optimizer, TK Packager) $599**Universal Technical Systems, Inc.**

202 West State St., Suite 700

Rockford, IL 61101

815-963-2220; Fax: 815-963-8884

sales@uts.com; www.uts.com

*John Wass is a statistician with GPRD Pharmacogenetics, Abbott Laboratories. He may be reached at sditor@scientificcomputing.com.*