Detailed Overview on POLYMATH Software for Chemical Engineering Analysis

: It is pertinent to highlight areas POLYMATH software is useful for chemical engineering analysis. Its applications had been demonstrated in this paper using 10 Problem Set, in areas that includes transport phenomena, heat transfer, reaction, and bioreaction kinetics to solve differential equations, nonlinear equations, simultaneous linear equations, graphical representation and regression problems arising in these fields using Licensed POLYMATH Software Version 6.10.261. POLYMATH is mostly used by students, teachers and researchers for educational purposes, but however limited in application by engineers in process industries, as more sophisticated softwares are preferred. Incorporating many solution approaches there in the literature for solving mathematical method problems, especially the newly proposed novel Extended Runge-Kutta Method of Order 6 into POLYMATH and the enabling of log-log plots is hereby recommended.


Introduction
Tiring engineering task, including calculations and analysis, today are carried out using computerized systems or specific softwares designed for specific type or large variety of functions. Computers are therefore, powerful tools employed to collect, store, process and analyze data for simulation, explaining mathematical models and analysis of basic scientific phenomena [1]. Chemical engineers employ the services of softwares such as POLYMATH, ASIM, MathCad, AQUASIM, MAPLE, Mathematica, FORTRAN, Excel, MATLAB and ASPEN among others for purposeful analysis. So, the act of finding the root causes of observed phenomenon utilizing both statistical, graphical and numerical analysis softwares is termed chemical engineering analysis. Chemical engineering analysis is thus broadly applied in chemical reaction engineering (CRE), transport phenomena (e.g. fluid mechanics, heat and mass transfer), process dynamics and control, thermodynamics, phase equilibria and distillation and biochemical engineering among others [2]. In CRE, problems solved with POLYMATH are co-current and countercurrent heat exchange, nonlinear regression of rate equations, nonlinear algebraic balances on continuous stirred tank reactors (CSTRs), growth kinetics in bioreactors and membrane reactors, multiple reactions with heat effects, to mention a few [3].

POLYMATH
is an educational software recommended for mathematicians, engineers [4] and financial analysts, created by Shacham and Cutlip in January 1, 2003. The challenge of using FORTRAN and C++ is that, a very lengthy time is spent developing and testing codes [3] in addition to hours spent analyzing the result based on different possible scenarios. Unlike ASPEN and COMSOL where the equations behind the computations are hidden, POLYMATH allow the user to provide their mathematical model where necessary [5] and are solved immediately. Errors in the typed mathematical models, entry of wrong initial estimates or the selection of an inappropriate solution algorithm would prevent the software package from given the correct solutions to problems entered [6,7]. A table of results containing initial estimates, problem statement and calculated unknown parameters are presented by POLYMATH together with graphs relating some of the parameters in the expression [8]. A hardcopy of this result can sometimes be printed by pressing the function key (F3) on the keyboard [9].
Famously, a solution to ten (10) chemical engineering numerical problems that cut across different aspects of chemical engineering, titled (i) molar volume and compressibility factor from Van Der Waal's equation, (ii) steady state material balances on a separation train, (iii) vapor pressure data representation by polynomials and equations, (iv) reaction equilibrium by multiple gas phase reactions, (v) terminal velocity of falling particles, (vi) unsteady state heat exchange in a series of agitated tanks, (vii) diffusion with chemical reaction in a one dimensional slab, (viii) binary batch distillation, (ix) reversible, exothermic, gas phase reaction in a catalytic reactor, and (x) dynamics of a heated tank with PI temperature control, had been solved using six numerical software packages including Excel, MAPLE, MATHCAD, MATLAB, MATHEMATICA, and POLYMATH [4] for undergraduate education [1]. Statistical analysis of adsorption isotherm models and estimation of growth kinetic parameters can be done using POLYMATH [10,11]. It is a user friendly software for numerical computation with short learning time, requiring minimal user intervention in technical details of the solution process and had been incorporated into several text, such as Kyle's textbook of ''Chemical and Process Thermodynamics'' and Fogler's textbook of ''Elements of Chemical Reaction Engineering'' among others [1]. An android application that can run on a minimum of Android 2.2 version called PolyMath Lite had been developed by Cutlip in 2016 [12].

Features of POLYMATH Software Package
POLYMATH is a simple software package developed to help students, academicians and engineers solve numerical analysis problems. In a book written by [2], 170 chemical and biochemical engineering problems requiring numerical solutions had been highlighted. The package consists of a calculator, units converter, records of scientific constants and numerical method icons. Numerical methods in chemical engineering deals broadly with subjects like (i) quantum mechanical calculations of atoms and molecules, (ii) numerical treatment of chemical reaction kinetics, (iii) transport processes, (iv) mathematical description of unit operations, and (v) stationary and instationary simulation and optimization of chemical plants among others [13]. Thus, POLYMATH solves four type of numerical problems arising in those subjects, namely, system of nonlinear equations, system of ordinary differential equations (ODEs), data regression and system of linear equations.
POLYMATH can solve up to 300 set of nonlinear equations with 300 explicit equations using four types of solution approaches, including 'safenewt', 'fastnewt', 'safebroydn' and constrained nonlinear equations [5]. Same number of ODEs can be solved by POLYMATH by either Runge-Kutta-Fehlberg (RKF45), RKF56, Burlirsch-Stoer (BS), STIFF or STIFFBS method. The data regression window is divided into regression, analysis and graph tabs. Multiple linear, nonlinear and linear and polynomial regression with room for finding polynomial derivative and integration are found under the regression tab which is capable of regressing 200 variables with up to 1000 data points for each. Under the analysis tab, numerical differentiation, integration and interpolation can be done using 3 solution methods each. Graphs are plotted entering the 'x' and 'y' data in cell box sheet provided by POLYMATH under the graph tab. Lastly, POLYMATH can accommodate 264 simultaneous linear equations as stated by [5]. Table 1 shows selected chemical engineering problems that can be solved using the four numerical methods discussed above: where, = the saturation concentration of dissolved oxygen in freshwater at 1 atm (mg/L) and = absolute temperature (K). From Problem Set 1, it could be concluded that ranges from 14.621 mg/L at 0℃ to 6.413 mg/L at 40℃.

Nonlinear with Constants
Von Karman equation can be used to predict the fanning friction factor, , for pipes. For the range and initial value of = 0.001(0.0001)0.01 , estimate by numerical analysis taking typical Reynold's number, for turbulent flow from 10,000 to 500,000 where, = fanning friction factor and Re = Reynold's number. POLYMATH gives = 0.007727 when = 10,000 and = 0.003291 when = 500,000.

6.
Differential Equation A half full storage tank in which liquid is supplied at a sinusoidal rate, 3Qsin 2 ( ), and withdrawn at constant flowrate to meet demand is shown in Fig. 2b. Use the continuity equation to solve for y which is initially zero, taking area, A = 1200 m 2 , Q = 500

Multiple linear Regression
Fit the data of = where, T = temperature (K) and k = thermal conductivity (W/cm-K) Using the above data, it was found that, = 1.3739, = 191.97 and R 2 = 0.9895.

Numerical
Interpolation, Differentiatio Day and night variation of temperature of a

Nonlinear Equations
Chemical engineering problems can possibly result in a single or sets of nonlinear equations solvable by numerical methods, including Secant Method, Regula-Falsi, Iterative Method, Bisection, and Newton's Method. Equations of state (EOS) in Thermodynamic, flow equations in Transport Phenomena (e.g. Manning, Von Karman and Colebrook equations as defined in Problem Set 2-4 of Table 1), equilibrium equation in Separation Processes, and Heat Transfer problems seen in Problem Set 5, to mention a few are solved using any of these methods. In [18], Newton's algorithm had been applied to formulate a programming codes capable of solving cubic EOS. Among these EOS, [6] demonstrated how Redlich-kwong equation of state is solved using successive substitution method, a method similar to how Problem Set 5 in this work was solved using POLYMATH. In [19], the modified Raoult's law had been solved using simultaneously with Wilson equation to determine the composition of a non-ideal binary mixture.
In POLYMATH, nonlinear equations are solved with basically two methods: (a) Newton's, and (b) Broyden's method. The "safenewt" algorithm uses the Newton's technique with line search to guarantee reduction of the norm of the function values in all iteration [20]. Broyden is a quasi-Newton method (or the generalization of the Secant method to nonlinear systems) that is superlinearly convergent for finding roots in k variables, as it reduces the amount of calculation at each iteration without significantly degrading the speed of convergence [21]. Therefore, both 'safenewt' and 'safebroyd' includes function minimization along the Newton and Broyden directions.

Differential Equations
POLYMATH would request the typing of a function to be solved by numerical methods or userdefined functions to be entered for regression purposes. Functions generate one unique output for each input [8] which are termed as arguments, often enclosed in parenthesis [9]. Some of the functions recognized by POLYMATH are 'sin', 'sinh', 'cos', 'cosh', 'tan', 'tanh', 'ln', 'log', 'arcsin', 'arccos', 'arctan', 'exp', 'frac', 'int', 'abs', 'sign', and 'round'. For example, absolute value of say 'x' can be written as "abs(x)". Also, factorial of an integer, say '5' is written as "5!" in POLYMATH. Differential functions which are implicit type of functions as well as explicit functions must be specified in POLYMATH.
Differential equations are classified into ordinary or partial differential equations and linear or nonlinear equations [22]. A mathematical equation that relates some functions with their derivatives are known as differential equations. Practically, the functions represent physical quantities, the derivatives stand for their rates of change, and the equation defines a relationship between the two [8]. Modeling of the variation of a physical quantity, such as temperature, pressure, displacement, velocity, stress, strain, current, voltage, or concentration of a pollutant, with the change of time or location, or both would result in differential equations [23]. Differential equation govern almost all physical processes of interest to chemical engineers, namely [24]; description of thermodynamic laws, description of flow processes (e.g. using Darcy's law, Bernoulli's equation, Nervier-Stoke and mass conservation equations), microbial growth kinetic constant estimation, representation of reaction rates in CRE, Fick's law of diffusion in mass transfer and many more. Elsewhere, [25] highlighted some of the applications of ODEs in reaction engineering. Partial differential equations (PDEs) on the other hand, finds applications in CRE to model complex reactors and reacting systems [3].  [22,23]. Softwares that can deal with PDEs are COMSOL (formerly FEMLAB) and MATLAB, especially for reactions taking place in tubular reactors [3]. ODEs in Problem Set 6 & 7 where solved by POLYMATH which is also utilizing the six parameters ( 1 , 2 , 3 , 4 , 5 and 6 ) of the RKF method in equations (1) [26,27] An approximate solution, +1 , to given initial value problems (IVPs) can then be executed using the RKF45 approximation as in equation (2) (3) Note that the approximations in (2) and (3) of the RKF45 method [26] ignores, 2 . This makes equation (2) of order 4 and (3), an order 5 equation; basically, making use of the classical Runge-Kutta methods of order 4 and 5 together, therefore defining RKF45 algorithm holistically. The selection of appropriate step sizes, h, guarantees the accuracy of most IVPs. The advantage of the RKF45 algorithm is that, it ensures that the right, h is used on its own and not allowing the user to specify any step size. Problem Set 6 had been coded to give, +1 and +1 using a step size of h = 0.1 for the RKF45 technique using C++ as seen in the Appendix. RKF56 on the other hand is termed the 6th order Runge-Kutta-Fehlberg method and is presented by [28]. The Runge-Kutta-Fehlberg method is generally thought of as one of the best methods existing for solving non-stiff systems of equations [27].
Starting from order 1 to 6, differential equations are solved using (i) Euler's method of order 1, (ii) Heun's method (or modified Euler or leap-frog formula) of order 2, (iii) Bogacki-Shampine method of order 3, (iv) Runge-Kutta method of order 4, (iv) R-K-Fehlberg method of order 4 with an error estimator of order 5 (RKF45), and (v) RKF method of order 5 with an error estimator of order 6 (RKF56). Beyond this, not long ago, [29] proposed a novel Extended RK 6th order method to bring the number of the solution approaches to six. A differential equation of the form, ′ = ( , ) is said to be stiff if its exact solution ( ) includes a term that decays exponentially to zero as increases (i.e. − , where c is a large positive constant), but whose derivatives are much greater in magnitude than the term itself [30]. A stiff differential equation is further characterized as being numerically unstable unless the step size is extremely small [30]. Stiff and Burlirsch-Stoer (BS) are alternative solution techniques similar to Runge-Kutta.

Data Regression
The most extensively used statistical technique is regression analysis, which involves detecting, evaluating, and analyzing the connection between the dependent and independent variables [31]. As mentioned earlier, the regression window in POLYMATH is divided into 3 tabs, namely, 'Regression', 'Analysis' and the 'Graph' tab. User-defined linear and multiple linear regression was carried out in Problem Set 8 and 9 to determine unknown constants, however, using the nonlinear function definition provided by POLYMATH. Regressed graph of the calculated and experimental data of Problem 8 is shown in Figure 3.
In chemical engineering, regression tools are widely used to determine unknown constant parameters in Arrhenius equation, Antoine equation, microbial growth models, EOS parameters, rate equations, biogas kinetic models and many other proposed models in the literature. KaleidaGraph program (Synergy software), PAST, SigmaPlot, SAS, EViews, GraphPad Prism, SPSS, Matrixer, SHAZAM, Statistica, ORIGINPro, Datafit, JASP, PSPP, Xlstat Excel Add-in, Excel Solver, Jamovi, Minitab, Stata, KyPlot, Scilab, nonlinear curve fitting toolbox of MATLAB and NCSS are competitive softwares for regression analysis apart from POLYMATH [32,33].  [8] We have demonstrated how to use POLYMATH to carryout numerical differentiation, interpolation, integration as well as data plots for Problem Set 10. Interpolation, formerly can be described as a method of estimating missing data values that are in-between a given set of field data [34]. Typical example is approximating of function values (e.g. temperature) in heat transfer and/or thermodynamics at points where there is no data reading and when computing derivatives from empirical data values.
In chemical engineering, regression tools are widely used to determine unknown constant parameters in Arrhenius equation, Antoine equation, microbial growth models, EOS parameters, rate equations, biogas kinetic models and many other proposed models in the literature. KaleidaGraph program (Synergy software), PAST, SigmaPlot, SAS, EViews, GraphPad Prism, SPSS, Matrixer, SHAZAM, Statistica, ORIGINPro, Datafit, JASP, PSPP, Xlstat Excel Add-in, Excel Solver, Jamovi, Minitab, Stata, KyPlot, Scilab, nonlinear curve fitting toolbox of MATLAB and NCSS are competitive softwares for regression analysis apart from POLYMATH [32,33]. We have demonstrated how to use POLYMATH to carryout numerical differentiation, interpolation, integration as well as data plots for Problem Set 10. Interpolation, formerly can be described as a method of estimating missing data values that are in-between a given set of field data [34]. Typical example is approximating of function values (e.g. temperature) in heat transfer and/or thermodynamics at points where there is no data reading and when computing derivatives from empirical data values.
To show how one quantity vary with another related quantity, graphs are readily used to convey information to readers than if same information are explained in words [35]. Graphs can also be plotted in POLYMATH just like Excel as depicted in Figure 1. However, POLYMATH cannot be used to plot a log-log scale. Log-log graphs is a scatterplot in which both axes have a logarithmic scale [36]. A log-log plot displays the relationship, such as one in Problem Set 9 ( = ) as a straight-line equivalent to "ln = ln − ln ". The Bode plot, a graphical depiction of the frequency responses of a system in control and electrical engineering is a log-log plot [37]. The idea behind this type of plot according to [36] is to use the axes so we can more easily see details for small and large values of the dependent variable, and to show % change or multiplicative factors. Log-log scales are plotted very easily in Excel for an existing scatter plot by clicking on the "Logarithmic Scale" check box under Format Axis after right-clicking on the values along the xaxis. This is then repeated for the y-axis.

Linear Equations
Not one, but sets of simultaneous linear equations are solved using numerical analysis softwares. Methods of solution are usually, Cramer's rule, substitution method, elimination method [35], graphical, and adjoint method which requires painstaking steps if the number of equations is more than 3. The fastest tool of solving a system of simultaneous linear equations is POLYMATH. In chemical engineering, simultaneous equations are used to balance chemical equations, finding unknowns in material balances, constrained optimization problems of differential equations after applying Laplace transform, solving certain functional equations among others. In real life, a smartphone user can use system of linear equations to select, best cell phone data plan knowing the charge rate of different companies per minute [38]. Also, to determine if one will make more money at one job or another, taking multiple variables (e.g. salary, benefits and commissions) into account [38]. POLYMATH cannot solve sets of linear inequality constraint equations used in cost optimization in chemical plants [39].

Conclusion
POLYMATH provisions for solutions to numerical problems makes it a useful chemical engineering analysis tool. An Android application called PolyMathLite had been created to further go into user's smart phones. The software package is limited to not possessing the features for solving PDEs in engineering. Unlike Excel, Tora, Lingo and sometimes C++ programs, it cannot solve linear programming problems, involving cost minimization or maximization in chemical plants. POLYMATH has the advantage of solving ODEs by selecting the best step size necessary while the use of programming codes would take much time and lengthy iterations before arriving at a solution and sometimes crash a system if 'h' is very negligible.  As explained earlier the RKF45 method as used in POLYMATH selects the appropriate step size on its own for the solution of a given problem. Entering a very minute step size in C++ execution of Problem Set 6 will display a lengthy table of calculation before given the result, simply because, the smaller the value of h, the higher the number of iterations. This is the reason why, the execution of the code in Figure 4, for a step size of h = 0.1 gave y = 0.604765m and 0.58828m (for RKF45 of order 4 & 5 respectively) in Figure 5, which is not the same with the value obtained by POLYMATH and Excel, which are y = 1.798038m. The step size used by POLYMATH for Problem Set 6 is h = 0.000001. Despite that, the C++ result cannot be discarded because it falls between the minimal and maximal value given by POLYMATH in Figure 6.
Note that varying the step size, h, during C++ execution of the problem will definitely affect the result. A step size of h = 0.001, 0.01 and 0.5 gives 0.604776 & 0.604656, 0.604736 & 0.603485 and 0.604765 & 0.455666m for RKF45 of order 4 and 5 respectively. Therefore, in chemical engineering where time will not permit the use of C++ codes due to the 'h' myths, POLYMATH have an edge in this case, over C++ and other coding software programs for solving ODEs by Runge-Kutta-Fehlberg method. The continuity equation in Problem Set 6 is a single first order differential equation. Column 2 of Table 2 gives the solution of the Monod Model Kinetic equation, often used to explain growth and decay rate of microbes in bioreaction engineering. Problem 7, though solved by RKF56 method in POLYMATH, differs from Problem 6, being a multiple first order differential equation solved simultaneously.