Calculator

See Also:  Polymath Units Converter  Polymath Scientific Constants  Variables and Expressions


The POLYMATH calculator allows you to enter an expression to be evaluated. The calculator can be very beneficial for carrying out simple or more complicated sequential calculations and keeping documentation of the equations and the results. The "basic" form of the calculator's window is shown below.


 
Erase Expression:
Pressing the Esc key deletes the entire expression appearing in the "expression" box. (This is used mainly when entering a new expression.)

Main Calculator Window Options
Solve (Enter or ):
When this button is pressed, the expression is evaluated and the solution is shown in the appropriate box.

On Top:
Selecting this option keeps the calculator window on top of all the windows on your desktop.

Access to Calculator Help:

Additional Calculator Options:

The options indicated on this window include the available intrinsic functions, the numeric format, the commands buffer, the desired input, and the results display control. Note that in Results,  all the previously entered expressions and the calculated results are shown. There are options to "copy" a marked section of this field, to copy everything inside this field using "Copy All" and to clear this field by pressing "Clear"

Online Calculator Syntax Help:
The options indicated below appear when entering "Help" followed by Enter or :


ENTERING AND EVALUATING EXPRESSIONS

An expression may be typed or copied into the calculator window and evaluated by a mouse click on or by a keypress of function key F5.  (You may also have specified the CR to be "Solve" in the Calculator Options Display, and the Enter key will then also solve the calculation.)  Note that an expression may contain numbers, arithmetic operators, intrinsic functions, and previously defined local variables. Scientific notation can also be used to enter numbers. The calculator will recognize 'E' or 'e' as being equivalent to the notation '*10^'. For example, these two strings are equivalent: 4.71*10^6 = 4.71e6 . The expressions and the solution values can be copied by marking the part of the expression to be copied and using either the menu obtained by pressing the right mouse button or by holding down "Cntr" and pressing "C" on the keyboard. The copied expression can be inserted in a different window by marking the location it should be inserted and using either the menu obtained by pressing the right mouse button or by holding down "Cntr" and pressing "V" on the keyboard.

Calculator Examples

Example 1. This example provides a simple calculation of one of the roots of the quadratic equation: x^2-12*x+35 = 0

You should type the following expression into the calculator:


Pressing with the mouse or the F5 function key places the  calculation  result in the solution box.  (You may also have specified the CR to be "Solve" in the Calculator Options Display, and the Enter key will also carry out the calculation.)

USE OF LOCAL VARIABLES

The assignment capability is a way of storing your results. You may specify a variable name in which to store the result of a computation by first typing in the variable name, then an equals sign, then the expression you wish stored. For example, if you wished to store the value of sin(4/3)^2 in variable 'a', you would enter: a = sin(4/3)^2 . You may then use variable 'a' in any subsequent expression, and POLYMATH will use the value stored in the variable. These variables are stored as long as you do not return to the POLYMATH main menu. Variable names must start with a letter and can contain letters and digits. There is no limit on the length of variable names or on how many variables you can use. Note that the calculator distinguishes between lower- and upper-case letters, so the variables 'MyVar2' and 'myvar2' are NOT the same. Further discussion of valid variable names and expressions can be found in Variables and Expression.

Example 2. This example utilizes local variables to calculate one of the roots of the quadratic equation: a*x^2+b*x+c=0 for the values a=1, b=-12 and c=35

 First the numerical value of the variables a, b and c should be defined. (Note that a mouse click on the <eraser> button or pressing the ESC keyboard clears the current expression). After that the expression for x1 can be entered, as shown below. There is a separate list of the local variables and their numerical value. A variable can be marked and deleted (press "Delete" with the mouse) or its numerical value can be changed (press "Modify" with the mouse).



USE OF THE IF FUNCTION

Sometimes you may need to make conditional calculations. For such calculations a special 'if' function is available, with the following syntax: if (condition) then (expression) else (expression). The parentheses are optional. The condition(s) may include the following operators: >, <, >=, <=, == (equals).

Example 3. In this example the drag coefficient (Cd) is calculated using the following equations:
Cd=24/Re if Re<0.1 and Cd=(24/Re)(1+0.14Re^0.7) for Re>=0.1
where Re=Dp*vt*rho/vis. 

The complete set of equations, including the solution for one particular set of data values is shown below.