PolyMathLite is a part of a proven computational system from PolyMath Software that has been specifically created for educational or professional use. It allows the user to apply effective numerical analysis techniques during interactive problem solving on Android OS smartphones, tablets and computers.
Results are presented with a standard html based POLYMATH Report for easy understanding and can be shared across for incorporation into mail messages, papers, and reports. Students, engineers, mathematicians, scientists, or anyone with a need to problems will appreciate the efficiency and speed of problem solution.
This Help will enable you to start using PolyMathLite for numerical problem solving. For advanced applications, Please refer also to PolyMathLite User's Manual which is available at the website: www.PolyMathLite.com. Other more advanced versions of PolyMath are available for personal computers from the website: www.PolyMathSoftware.com
The main problem entry text box is where the user can enter a new problem or modify an existing one. All problems are entered in plain text format. Four types of problems can be entered; (1) systems of linear equations (2) systems of nonlinear equations (3) systems of first order, ordinary differential equations, and (4) problems involving regression analysis. Each problem type has its own syntax. New users are encouraged to execute some of the sample problems in order to understand problem entry in addition to studying this HELP. In case the user does not enter the problem correctly, a detailed error message is displayed that guides the user regarding the type of the error and indicates the line number of its occurrence.
To start using PolyMathLite, you first need to determine to what category of problem you want to solve. After that you can select a problem belonging to the same category from the PolyMathLite Sample Problems menu. The sample problem can help you learning the problem entry syntax. By executing the sample problem, you can see the content and the format of the results. The easiest way to enter a new problem is by modifying a similar sample problem. Note that lines starting with the # sign indicate a "comment" which is being ignored by PolyMathLite when solving the problem. After entering a problem, the Solve button is tapped for solving the problem and obtaining the results on the "POLYMATH Report" screen. In case of errors in the problem set up, the "POLYMATH Report" screen will contain only error messages, and some additional information that can be helpful in identifying and correcting the source of the error.
The main entry screen has a standard toolbar under the PolyMathLite icon on the left followed by the "Open", "Sample" and "Run" buttons. To enter a new problem you can start typing on the main entry screen or simply open and modify an existing sample problem. It is recommended that the first line of a problem be started with a comment which contains a short description of the problem. This description is automatically used to identify the problem when saving or retrieving it. You may open options available from your problem display by tapping the three vertical dots icon just above the Ln (Line) indicator on the right side of the PolyMathLite icon on the upper right side of the display. Tapping on the desired option will select your desired option. A tap on "Save" will result in saving your problem with the title as the Comment used in Line 1 of your problem. The disk icon will produce the "Save". Your saved problem will then become available under a depression of the "Open" button..
The syntax of the problem input depends on the category to which the problem belongs. The following explanations deal with the problem input of the various categories.
This section explains the different problem types that can be entered in the PolyMathLite problem entry window and the required syntax for each problem type. The # sign indicates a user comment section which the computer ignores except it is used to name the problem when it is the first line. Any line starting with # anywhere else in the problem is completely ignored by PolyMathLite. Also any line content after # is ignored by PolyMathLite calculations.
Remember that when saving the program, the first line (which must start with the # sign) is used to indicate the problem name.
This category involves the solution of a system of linear algebraic equations. The number of equations must be equal to the number of unknowns. Only the plus, minus, and multiplication operators are allowed. All the variables must appear in linear expressions (no x*x or 1/x). Note that the linear algebraic equations can be entered in any order. (The free version is limited to five linear equations.)
The following example demonstrates the input of a linear system of equations:
The POLYMATH Report includes the values of the unknowns at the solution (a = 54, b = -4 and c = -2, for this problem) and the problem definition in both matrix and system of equations formats.
See also: Sample problems 1, 2* (*-indicates too large for Free Version) and 3 and the section PolyMathLite Control Buttons.
The problems belonging to this category contain implicit nonlinear algebraic equations that require iterative solution and explicit algebraic equations where individual variables can be expressed as explicit functions of other variables and constants. An implicit nonlinear equation must be entered in the form:
f(x) = an expression
where x is the chosen variable name, and f(x) is an expression that will have the value of zero at the solution.
An explicit equation should be rewritten in the form:
x = an expression
where the expression may contain constants, implicit variables, and explicit
Only real roots (non-complex) can be found. Multiple roots are determined for a single equation where the range of the variable must be provided. (The free version is limited to 3 nonlinear and 10 explicit algebraic equations and uses only the NLE - Nwtn2 algorithm.)
This type of problem contains a set of explicit algebraic equations. Each equation must start with a variable name followed by the equal sign and a linear or nonlinear algebraic expression. The equations may be entered in any order. During the solution, the equations are automatically ordered to achieve a solution. The following system of explicit equations calculates the two roots of a quadratic equation. Note that both problem setups have the same solution.
The POLYMATH Report includes the values of the unknowns (x1 = 7, x2 = 5) and all the variables at the solution, a copy of the problem definition in HTML format, and MATLAB formatted version of the problem definition.
HINT! This option for NLEs is very useful for solving systems of explicit algebraic equations for problems of the type that would have been solved using electronic calculators. Note that the equations do not need to be ordered for solution. Keep this option in mind for your general explicit calculational needs.
See also: Sample problems 4, 5 advanced sample problems 15 and 16,
PolyMathLite Control Buttons, Variables and Expressions
See also (in PolyMathLite manual): Problem Export to MATLAB.
This option involves the solution of a single implicit nonlinear equation with any number of explicitly defined variables. The implicit nonlinear equation must be arranged to an expression which is equal to zero at the solution. For the variable associated with the implicit equation, both minimal and maximal initial estimates must be provided. Multiple roots are reported if the problem has several solutions (roots) between the minimal and maximal initial estimates. The equations and initial estimates can be entered in any order. PolyMathLite always reorders the equations during the problem solution.
The POLYMATH Report includes the value/s of the unknown (x=20, in this case), the function value/s (f(x)= 1.0e-8), the values of all the variables at the solution, a copy of the problem definition in HTML format, and a MATLAB program m-file for solving the same problem.
See also: Sample problems 6, 7, advanced sample problem 17, PolyMathLite Control Buttons, and Variables and Expressions.
See also topics in the PolyMathLite Manual (found on the polymathlite.com website): Solution Algorithms and Problem Export to MATLAB.
This option involves the solution of a system comprising of several, implicit, nonlinear algebraic equations with any number of explicitly defined variables. All the implicit equations must be rewritten in the form:
f(x) = an expression
where x is a variable that does not appear on the left hand side of any of the explicit equations and the "expression" must be equal to 0 at the solution. Initial estimates must be provided for all the implicit variables using the syntax: x(0) = a value. The equations may be written in any order.
The POLYMATH Report includes the values of the unknowns (x = 5, y = 20), the function values (f(x)= -2.7E-12, f(y)= 1.3E-12 ) and the values of all the additional variable/s at the solution, a copy of the problem definition in HTML format, and a MATLAB program for solving the same problem.
See also: Sample problem 8 advanced sample problems 18, 19, 20 , and 21, PolyMathLite Control Buttons, and Variables and Expressions.
See also (in PolyMathLite manual): Solution Algorithms, and Problem Export to MATLAB
A special solution algorithm is available for problems where some of the
some of the variables can have only positive values.
For details refer to Sample problem 21 and the PolyMathLite User's Manual.
d(x)/d(t) = an expression
Here t is the independent variable and x is a dependent variable. Note that other independent and dependent variable names are possible. Auxiliary algebraic equations must be entered in the form:
x = an expression
where the same naming rules apply.
An expression may contain any combination of constants and variables. However, the auxiliary equations must be explicit (not simultaneous). PolyMathLite will sort and order the equations and will indicate if a simultaneous situation exists (by warning of 'circular dependency').
Initial conditions must be specified for all the variables defined by differential equations, as well as the independent variable. A final value must also be specified for the independent variable. (The free version is limited to 3 first-order ordinary differential equations, 10 explicit algebraic equations and uses only the ODE (RKF45) integration algorithm.)
The POLYMATH Report for this example includes a Table listing the initial, minimal, maximal, and final values of all the variables over the integration range. In the example shown, the final values are: A = 0.049787, B = 0.047308 and C = 0.902905. A table containing 50 values of the dependent variables between the initial and final values of the independent variable is also displayed. A copy of the problem definition in HTML format and a MATLAB program for solving the same problem are also included in the POLYMATH Report.
The table containing the values of the dependent and independent variables can be exported to plotting utilities to prepare various plots. The use of the Plotim application for this purpose will be demonstrated here. Plotim Free Graphs and Plotim Graph Maker are Android apps available from Google Play.
When tapping the Android menu button (while on the POLYMATH Report screen) enables two standard menu options: Mail and Copy Tables. The results can be plotted by tapping on Copy Tables, opening the Plotim application, and selecting "Paste tab delimited" from the Plotim menu. Then the following plot can be created and displayed:
Plotim provides various options to manipulate and format the plot.
See also: Sample problems 10, 11, advanced sample problems 22, 23, 24, 25, 26 and 27, PolyMathLite Control Buttons, and Variables and Expressions. See also (in PolyMathLite manual): Plotting Tabular Data, Solution Algorithms, and Problem Export to MATLAB.
PolyMathLite can fit a polynomial of degree n with the general form:
y = P(x) = a0 + a1*x + a2*x^2 + . . . + an*x^n
or a linear equation when the equivalent first degree polynomial is specified
y = P(x) = a0 + a1*x
where a0, a1, ..., an are regression parameters to a set of N tabulated values of x (a single independent variable) versus y (a single dependent variable). The highest degree allowed for a polynomial is N - 1 (thus n >= N - 1). The program calculates the coefficients a0, a1, ..., an by minimizing the sum of squares of the deviations between the calculated y or P(x) and the data for y.
A polynomial regression is specified by the "polyfit" command that must be followed by the name of the independent variable vector, name of the dependent variable vector, a number representing the degree of the polynomial, and an optional string 'origin' which indicates that the polynomial regression curve must go through the origin. These names must be separated by commas.
Example 4.1.1: Correlation of BOD data:
Consider the following BOD (biological oxygen demand) data versus Time:
Fit a straight line (linear regression) to the BOD vs. Time data
Fit the data to a 2nd degree polynomial
Fit the data to a 2nd degree polynomial that passes through the origin Plot the BOD data and the BOD calculated values vs. time and plot the residuals vs. time.
Compare the models using R2, variance and 95% confidence interval values
Part 1 Straight Line (Linear Regression)
This program yields the results a0 = 0.657797 (±0.374896), (95% confidence intervals shown between parentheses), a1 = 0.178056 (±0.031674), R2 = 0.9472735 and the variance: σ2 = 0.0825304.
In the POLYMATH Report a table containing the observed (measured) y values, the predicted y values (ycalc) and the residuals (r = y- ycalc) are also displayed.
Part 2 Solution
To fit a 2nd degree polynomial, the polyfit statement is revised:
polyfit Time, BOD, 2
The results obtained in this case are a0 = 0.224387 (±0.353054 ), a1 = 0.310403 (±0.081692 ), a2 = -0.006439 (±0.003851), R2 = 0.9815572 and σ2 = 0.0324762.
Part 3 Solution
To fit a 2nd degree polynomial which passes through the origin, the following polyfit statement is used:
polyfit Time, BOD, 2, origin
For this polynomial a0 = 0, by definition, and the rest
of the results are: a1 = 0.354779 (±0.044171), a2 =
-0.008236 (±0.002724), R2 = 0.9766053 and σ2 =
tap the Android menu button (while on the POLYMATH Report screen) and
consequently tap the Copy Tables option. Open the Plotim application
and select "Paste tab delimited" from its Android menu.
To prepare the required plots,
A plot containing three variables: BOD (the data) BOD calc (calculated
values) and Delta BOD (residuals) vs. time should be displayed. To remove
the residual plot, tap Edit in Plotim's Android menu and deselect Delta BOD
in the variable list. The following plot should appear.
To plot the residuals versus Time, tap Edit in Plotim's Android menu and select Delta BOD and deselect BOD and BOD calc in the variable list. The plot is revised:
Judging by the R2 and σ2 values, the 2nd degree polynomial represents the data the best. However, the confidence interval value of a0 shows that this parameter is not significantly different from zero, thus the use of 2nd degree polynomial passing through the origin should be preferred.
Example 4.1.2: Consider the following set of Pressure (mm Hg) versus Temperature (deg C) data:
The following operations need to be carried out with these data:
Convert the temperature to K (by adding 273.15 to the value shown)
Convert the pressure to kPa (by multiplying the value shown by 0.1333)
Fit a fourth degree polynomial to the Pressure (dependent variable) vs. Temperature data.
The program to accomplish these tasks is shown below.
The POLYMATH Report includes a Table listing the parameter values
and confidence intervals on these values.
For this particular problem the following results are shown.
The POLYMATH Report includes also the statistical metrics: R2, R2adj, root mean squared deviation and variance. A table displaying the observed (measured) y values, the predicted y values (ycalc) and the residuals (r = y- ycalc).
To fit a polynomial that passes through the origin, the "polyfit"
command must also include the parameter "origin".
polyfit T_K, P_kPa, 4, origin
See also: Sample problems 12(a), 12(b) , 12(c), 13, advanced Sample problem 28, PolyMathLite Control Buttons, and Variables and Expressions. See also (in PolyMathLite manual): Plotting Tabular Data.
This PolyMathLite option will fit a linear function of the form:
y(x1, x2, ..., xn) = a0 + a1*x1 + a2*x2 + ... + an*xn
where a0, a1, ..., an are regression parameters, to a set of N tabulated values of x1, x2, ..., xn (independent variables) versus y (dependent variable). Note that the number of data points must be greater than or equal to n+1 (thus N >= n+1). The program calculates the coefficients a0, a1, ..., an by minimizing the sum of squares of the deviations between the calculated and the data for y.
Use the mlinfit command to request a multiple linear regression fit. The arguments are the independent variables vector's names, followed by the independent vector name. Additional optional (last) argument is the string 'origin' which indicates that the regression curve should pass through the origin (thus a0 = 0).
Example 4.2.1: Simple Multiple Linear Regression:
The following data are for the wear of a bearing y that may be dependent upon x1 = oil viscosity and x2 = load data.:
y : 293 230 172 91 125 125
x1: 1.61 15.5 22 45 33 40
x2: 851 820 1058 1201 1357 1115
Compare the linear regression models that includes x1 and x2 as independent variables with a model that includes only x1.
The results obtained in this case are a0 = 360.836 (±118.076), a1 = -3.75246(±1.774), a2 = -0.084265(± 0.140313), R2 = 0.9835209 and σ2 = 159.1951.
To remove x2 from the regression model, the mlinfit statement is revised:
mlinfit x1, y
After this modification the following results are obtained: a0
= 292.784(±37.3385 ), a1 = -4.58727(±1.23994), R2 =
0.963462 and σ2 = 264.7302 .
Judging by the
Consider the "vapor pressure" example. This time we want to fit to
these data a regression model of the form:
log(P_kPa) = a0+a1/T_K +a2*log(T_K)
The dependent variable can be defined by logP=log(P_kPa) and the independent variables defined by OneonT=1/T_K and logT=log(T_K). Then mlinfit can be used to find the parameter values.
The POLYMATH Report includes a Table listing the parameter values and confidence intervals on these values. For this particular problem the following results are shown.
See also: Sample Problem 14, advanced Sample Problems 31(a) and 31(b),
PolyMathLite Control Buttons and Variables and Expressions.
See also (in PolyMathLite manual): Plotting Tabular Data.
Nonlinear regression involves a general mathematical function (model) of the form:
y = f (x1,
x2, ..., xn, a0, a1, a2,
where a0, a1, ..., an are regression parameters to a set of N tabulated values of x1, x2, ..., xn (independent variables) versus y (dependent variable). Note that the number of data points must be greater than m + 1 (thus N >= m + 1).
Use the nlinfit command to request nonlinear regression fit. The argument is the nonlinear regression model: the dependent variable vector name on the left side of the "=" sign, the independent variable vectors names and the parameters on the right side. Initial estimates must be provided for all the parameter values using expressions of the form:
m(ai) = value
Consider the data for the "vapor pressure example". A nonlinear
(Antoine) equation of the form: log(P) = A-B/(T+C).
where P is pressure (mmHg) , T is temperature (deg C) and A, B and C are parameters, need to be fitted to the "vapor pressure" example's data.
Following is the program for finding the optimal parameter values with nlinfit.
The optimal solution obtained is A = 5.76735, B = 677.094 and C = 153.885.
See also: Advanced sample problems 29 and 30, PolyMathLite Control
Buttons, and Variables and Expressions.
See also (in PolyMathLite manual): Plotting Tabular Data and Solution Algorithms.
The main problem entry screen has the following 3 standard buttons:
|Open||Opens a list of previously saved problems.|
|Sample||Opens the built in sample problems screen.|
|Run||Solves the current problem and presents the POLYMATH Report.|
The main toolbar also indicates the current line number Ln #. This is useful to track lines with errors identified after the "Run" button is tapped.
The following menu items are available:
|New||Creates a new blank problem|
|Help||Opens the Help documentation screen|
Save the current problem on the internal disk of the device. Note that the first line of the problem to be saved must start with the # sign followed by the name of the problem.. The saved problem is given a unique ID number. This ID along with the date at which the problem was last saved appears in the information bar below the extended buttons strip.
|Share||Shares the current problem text with an external Android application such as email, text viewers, cloud storage devices etc.|
|Settings||Opens the settings screen which allows changing the parameters of the numerical solution algorithms, such as error tolerances, number of iterations allowed, number of digits shown in the result tables, solution techniques etc.|
|Delete||Deletes the current file (if it is stored on the device), and clears the current problem screen to enable new problem entry. To clear the problem entry screen without deleting the displayed file use the Android menu option (clicking the physical menu button of the device ).|
|Increase Font||Increases the default font size for the problem entry text editor|
|Decrease Font||Decreases the default font size for the problem entry text editor|
Additional menu items available on the problem entry screen.
If the problem definition contains a vector (in regression problems) two additional menu items: "Copy Vectors" and "Paste Vectors" become available. These options enable copying vectors into MS Office like spreadsheet editors, such as Excel, to easily edit long vectors, and then, copy them back into PolyMathLite.
The following menu items are displayed on the open screen:
|Order by Name||Sorts the displayed problems by name.|
|Order by Date||Sorts the displayed problems by the date they were saved.|
|Export Programs DB||Exports the entire problems database into a backup file.|
|Import Programs DB||Imports the entire problems database from a backup file to become the main problems DB. This option overwrites any existing problems which might be saved currently.|
|Go Back||Returns to the last screen.|
Additional notes when exporting/importing the entire database problems:
The following menu items are displayed on the POLYMATH Report screen:
|Share...||Enables sharing the POLYMATH Report with external Android applications such as email, text viewers, cloud storage devices etc.|
|Copy Tables||The "Copy Tables" option can be used to copy tables displayed within the report. These can be pasted into external application such as Excel to review the tabular data and/or construct charts.|
|Go Back||Returns to the last screen.|
Viewing and running the built in PolyMathLite sample problems is the best way to become familiar with the problem input and execution of PolyMathLite problems. The following problem types are displayed.
|NLE||Explicit Equations Set|
|NLE||Single Nonlinear Equation|
|NLE||Multiple Nonlinear Equations|
|NLE||Constrained Multiple Nonlinear Equations|
|DEQ||Ordinary Differential Equations|
|REG||Multiple Linear Regression|
The following objects compose a valid PolyMathLite math expression:
A number can be represented in decimal notation or engineering notation.
Engineering notation can be used to indicate powers of 10 using 'e' or 'E' .
For example, 0.123e-5 is the same as 0.123*10^(-5).
Note that only the period "." is used as the decimal delimiter symbol and comma nor spaces must not be used to indicate digits grouping.
Invalid PolyMathLite numbers:
Variable names must begin with an alphabetical character and can contain
alphabetic and numeric characters or underscore "_".
Variable names are case-sensitive, i.e. 't' and 'T' are two different variables.
Special characters such as $, &, #, @ etc. are not allowed.
Returns the arithmetic operations of the binary components.
For example '2+3' returns 5 .
The '^' symbol is used for exponentiation.
The +, -, *, / symbols are used for addition, subtraction, multiplication, and division respectively.
The precedence of operators is ^, (* or /), (+ or -) which is invoked working from left to right in an expression.
Various mathematical function names are available. Examples: sin, cos,
The full list of available PolyMathLite functions is presented below.
These operators return "1" if the condition met, and "0" if the
condition does not meet.
Examples: The expression '3>6' returns 0. The expression '4>=4' returns 1.
Valid conditional operators:
The Boolean operators return "1" if the condition is met, and "0" if the
condition is not met.
Example: The expression '(2>3) or (1>0)' returns 1. The expression '1 and 0' returns 0.
Valid Boolean operators:
There are three case-insensitive keywords which compose the if-then-else
The three keywords are: If, Then, Else.
Open Parenthesis: (
Close Parenthesis: )
A special 'if' statement is available, with the following syntax:
if (condition) then (expression1) else (expression2)
The parentheses are optional.
The condition may include the following operators: and, or (Boolean operators), > (greater than), < (less than), >= (greater than or equal), <= (less than or equal), == (equals).
The expressions may be any formula, including another 'if' statement.
A number of standard functions are available for use in the various programs. The arguments of the functions must be enclosed in parentheses. The arguments may be themselves expressions or other functions. The nesting of functions is allowed.
|abs ( )||absolute value|
|arccos ( )||trigonometric inverse cosine with result in radians|
|arccosec ( )||trigonometric inverse cosecant with result in radians|
|arccosech ( )||inverse hyperbolic cosecant|
|arcsech ()||inverse hyperbolic secant|
|arccosh ( )||inverse hyperbolic cosine|
|arccotan ( )||trigonometric inverse cotangent with result in radians|
|arccotanh ( )||inverse hyperbolic cotangent|
|arcsec ( )||trigonometric inverse secant with result in radians|
|arcsin ( )||trigonometric inverse sine with result in radians|
|arcsinh ( )||inverse hyperbolic sine|
|arctan ( )||trigonometric inverse tangent with result in radians|
|arctanh ( )||inverse hyperbolic tangent|
|cbrt ( )||cubic root|
|cos ( )||trigonometric cosine with argument in radians|
|cosec ( )||trigonometric cosecant with argument in radians|
|cosech ( )||hyperbolic cosecant|
|cosh ( )||hyperbolic cosine|
|cotan ( )||trigonometric cotangent with argument in radians|
|coth ( )||hyperbolic cotangent|
|exp ( )||exponential (e^x )|
|exp10 ( )||exponential of 10 (10^x )|
|exp2 ( )||exponential of 2 (2^x )|
|frac ( )||fractional part|
|int ( )||integer part|
|ln ( )||natural logarithm to the base e|
|log ( )||logarithm to the base 10|
|rand ( )||
Returns a random number between 0-1.
A parameter such as 1 or 2 should be provided to this function.
|round ( )||rounded value|
|sec ( )||trigonometric secant with argument in radians|
|sech ( )||hyperbolic secant|
|sign ( )||returns + 1 or 0 or -1|
|sin ( )||trigonometric sine with argument in radians|
|sinh ( )||hyperbolic sine|
|sqrt ( )||square root|
|tan ( )||trigonometric tangent with argument in radians|
|tanh ( )||hyperbolic tangent|
All function names must be given in lower-case letters. The trigonometric functions require that their arguments be given in radians. Conversely, the inverse trigonometric functions give their results in radians.
You should note that the functions require that their arguments be enclosed in parentheses, but that the arguments do not have to be simple numbers. You may have a complicated expression as the argument for a function, and you may even nest the functions, using one function (or an expression including one or more functions) as the argument for another.
|Module||Limitation||Free Version||Paid Version|
|LEQ||Max # of simultaneous linear equations||4||No limit|
|NLE||Max # of simultaneous nonlinear equations||3||No limit|
|NLE||Max # of simultaneous explicit equations||10||No limit|
|NLE||Number of available solution algorithms||1||4|
|DEQ||Max # of simultaneous differential equations||3||No limit|
Max # of simultaneous explicit equations
|DEQ||Number of available solution algorithms||1 (RKF45)||5 stiff and nonstiff|
|REG||Max # of data points||24||No limit|
|REG||Max polynomial regression degree||5||12|
Number of nonlinear regression solution algorithms