The Helpful Mathematics
+38 044 572 93 47

Case 6

Scientific calculator Li-L — why and how

Category. Mathematical software development.

Abstract. Why and how scientific calculator Li-L was created — philosophy and ideas behind, practical introduction to the project, script samples.

References. Scientific calculator Li-L and scientific calculator Li-X products.

Download scientific calculator Li-L script samples (zip, 1.6 Kb)

Scientific calculator Li-L - why and how

1. Problem arise

Everything began from this...

Fig. 1. Room layout. Fig. 1. Room layout.

I was to make renovation of my flat and first step to be done was to calculate how much of different things I needed. I measured everything, draw on paper and got a bunch of room plans like the one above. Plans looked simple, I had a handheld scientific calculator with expression evaluation support, so, the task looked easy.

First thing I discovered immediately it was not that easy to verify even simple formulas written in digits. It is much easier to check something like

width × length

than

4.03 × 3.55

Second discovery was the trend to recalculate the same values like square of the floor for different applications like calculation of amount of self-evening mixture and wooden flooring. So, here I ended up writing down some basic results on paper like listing of floor squares room by room.

The same happened with multistaged calculations like calculation of amount of tiling for bathroom, where surface tiling depends on bathtub location. So, third discovery was that calculator memory is not very convenient, because it is unnamed — it is good for abstract calculations where one to store some multiplier or coefficient but not real-world items like “part of the left wall covered with beige tiles”.

Fourth revelation came when the same thing was to be calculated for different rooms like amount of paint. Not to repeat the same job for different rooms I had written C++ application to calculate walls square. That was quite awkward: not to lose time for creation of file input or whatever I entered all input data hardcoded, commenting already calculated previous version and recompiling the code to run it for the next room.

And that was not the worst thing. The nastiest, fifth, thing came when ideas started to mix with reality: you had an idea to use 30×30 tiles for bathroom and 80 cm width bathtub but then went to shop to find tiles 30×40 look better and only tub of 70 cm width was available. So, the calculation job to be redone.

Add to this “one button at a time” calculator input and its two string display... Well, basic calculations in 21 century.

2. Conclusion

Out of my experience I got a wish list:

  1. I want to write formulas in symbols or words, not in numbers;
  2. I want to store intermediate results under names, not under abstract “cell x”, “cell y”;
  3. I want to separate input data and formulas for their processing, so that the same succession of expressions could be run for different datasets;
  4. I want to save my job for future use in the case of changes;
  5. I want simple solution that allows easy modification of existing calculations.

3. Solution

Now, let me show how all that solved in scientific calculator Li-L. So, first, here is our input data:

//   Room dimensions, m
3.55 −> Mem[room width];
4.03 −> Mem[room length];
2.7  −> Mem[room height];
1.32 −> Mem[bay depth];
 .9  −> Mem[door width];
2.1  −> Mem[door height];
3.07 −> Mem[window width];
1.7  −> Mem[window height];

Enter data above into the calculator and save it as room.lcm file.

Clear the calculator window and enter paint data:

//   Paint consumption, Tikkurila Joker, l/m^2
1 ÷  8 −> Mem[paint first cover];
1 ÷ 11 −> Mem[paint second cover];

Save the data as paint-joker.lcm file.

Now time for formulas. Here we are interested in squares for ceiling and walls. The room has rounded part, so some job should be done to get its square. As final step necessary amount of paint is calculated. So, clear the window and enter:

//   Bay radius
Mem[room width]^2 ÷ (8 × Mem[bay depth]) + Mem[bay depth] ÷ 2 −> Mem[bay radius];
//   Walls square: long walls + short wall + bay wall − window − door
{Mem[room length] × 2 + Mem[room width]
   + 2 × Mem[bay radius] × arcsin[Mem[room width] ÷ (2 × Mem[bay radius])]} × Mem[room height]
   − 2 × Mem[bay radius] × arcsin[Mem[window width] ÷ (2 × Mem[bay radius])] × Mem[window height]
   − Mem[door width] × Mem[door height] −> Mem[square walls];
//   Ceiling square
Mem[room length] × Mem[room width]
   + Mem[bay radius]^2 × arcsin[Mem[room width] ÷ (2 × Mem[bay radius])]
   − Mem[room width] × (Mem[bay radius] − Mem[bay depth]) ÷ 2 −> Mem[square ceiling];
//   Amount of paint for walls
Mem[square walls] × (Mem[paint first cover] + Mem[paint second cover]);
//   Amount of paint for ceiling
Mem[square ceiling] × (Mem[paint first cover] + Mem[paint second cover]);

Save the script as square-bay.lcl file.

Now click Memory >> Load and load into memory previously saved room.lcm file. You can see the loaded data in the Memory window. Repeat the same for paint-joker.lcm file — paint data will be added to memory. Now hit Ctrl+Shift+= to evaluate squares and amount of paint.

4. Discussion

As you can see, scientific calculator Li-L allows easy separation of datasets and calculation logic — so that the same calculation script could be run for different input data. In my case it allows making evaluations for different rooms and check out different paints. For instance, to see another paint consumption it is enough just load another memory file:

//   Paint consumption, Tikkurila Luja, l/m^2
1 ÷ 5 −> Mem[paint first cover];
1 ÷ 8 −> Mem[paint second cover];
As well one can easily modify the calculation script for rectangular rooms, add another window or door, add calculation of flooring, etc. — expressions for all that are already there. For example, here is the script for rectangular room, got from the script above by removing expressions for bay squares:

//   Walls square: walls − window − door
(Mem[room length] + Mem[room width])  × 2 × Mem[room height]
   − Mem[window width] × Mem[window height]
   − Mem[door width] × Mem[door height] −> Mem[square walls];
//   Ceiling square
Mem[room length] × Mem[room width] −> Mem[square ceiling];
//   Amount of paint for walls
Mem[square walls] × (Mem[paint first cover] + Mem[paint second cover]);
//   Amount of paint for ceiling
Mem[square ceiling] × (Mem[paint first cover] + Mem[paint second cover]);

And the calculator provides effective memory management, so that one is not lost among memory cells.

To be exact the data above and scripts themselves are my real tools I have written as soon as I have created scientific calculator Li-L. You can copy the scripts from the screen or download them here:

Download scientific calculator Li-L script samples (zip, 1.6 Kb)

5. About scientific calculator Li-X

Scientific calculator Li-X is advanced version of scientific calculator Li-L, so, everything said above is true for it as well. The difference between them is X version has some extra:

The features could be of help in advanced scientific calculations.

 

Write to the author of the case — Sergey Chernenko.