"Blackboard 3" Calculator

Expression names




Formulas = 2+3 and x = 2+3 give the same result. The variant with the name of the expression, in this case, x, makes sense if one or more expressions using this value are counted. For instance,

x = 2+3
= (x-4):x

Tip. It is convenient and correct to assume that the value of this expression is stored in the name of an expression.

Rule 2. The name (identifier) ​​of the expression may consist of the letters of the Cyrillic and Latin alphabets, numbers and the underscore character "_", but cannot begin with a number.

For example, the sum2 = tg(x)+ctg(x) is correct, and 2sum = tg(x)+ctg(x) causes an error message.

Rule 3. You can use any number of named expressions, but so that the formula that defines each name is higher than any other expression that uses it.

The use of names makes sense, for example, in the following listing:

Salary = 4173.00
PIT = Salary*18/100
Military_Fees = Salary*1.5:100
SSC = Salary*22:100
Total_tax_load = PIT+Military_Fees+SSC;
To_payment = Salary-SSC-Military_Fees

These formulas for filling out the accounting statement are convenient in that for each employee you only need to enter his salary in the first line.

If the same bulky block is repeatedly included in the calculated expression, then assigning a name to this block can significantly speed up the set of formulas. For instance,

x = [sin(pi:8)+cos(pi:8)]:sqr3-1
= 1+x^2+x^3+x^4

Keep in mind that expression names are significantly more useful than what is contained in these examples. To some extent this is demonstrated in the following paragraphs.