Basic Calculations
Type a mathematical expression and Calcumber evaluates it instantly.
All examples on this page are interactive. Modify the input and see the results update immediately.
| 3*4 / (2 + 4) | 2 |
| 2^7 - 1 | 127 |
| sqrt(3^2 + 4^2) | 5 |
To make calculations easier to read, you can add comments before a colon
:. Everything before the colon is ignored during evaluation.
| basic calculations: 3*4 / (2 + 4) | 2 |
| highest 7-bit value: 2^7 - 1 | 127 |
| triangle: sqrt(3^2 + 4^2) | 5 |
Calcumber also ignores any text that is not part of a valid expression.
This lets you write natural comments directly inside your calculations.
Alternatively, start a comment with #.
| === Comments in Calcumber === | |
| 2.5^2 * 3 # approximately | 18.75 |
| 2.5^2 * 3.14 # more precise | 19.625 |
| 2.5^2 * pi # highest precision | 19.6350 |
| We don't always need full precision. |
Comments remain part of the shared calculation, making it easy to document your work and explain it to others.
Variables and Previous Results
Every result is automatically stored in the variable ans. This allows
you to continue a calculation without retyping the previous result.
| 2 * 6 | 12 |
| ans + 8 # reuse previous result | 20 |
For larger calculations, define named variables. They make formulas easier to read and allow you to change input values without modifying the calculations themselves.
| Line definition: | |
| slope: a = 3 | 3 |
| offset: b = 2 | 2 |
| Point 1: | |
| x1 = 7 | 7 |
| y1 = a*x1 + b | 23 |
| Point 2: | |
| x2 = 12 | 12 |
| y2 = a*x2 + b | 38 |
| Distance between points: | |
| Δx = x2 - x1 | 5 |
| Δy = y2 - y1 | 15 |
| distance = sqrt(Δx^2 + Δy^2) | 15.8114 |
Units
Using units makes your calculations more readable and reliable. Calcumber automatically converts compatible units, and if a result cannot be converted to the expected unit, the formula is dimensionally inconsistent — often revealing an error before it goes unnoticed.
The example below demonstrates requested unit conversion using to L or in s
and how litre cancelles out during calculation.
| Filling a Bathtub | |
| ================= | |
| Water volume: V = 190 cm * 50 cm * 20 cm to L | 190 L |
| Water flow rate: q = 17 L/min | 17 L/min |
| Time to fill: t = V / q | 11.1765 min |
| In seconds: ans in s | 670.588 s |
In the example above, each unit is surrounded by spaces: one between the
number and the unit, and another before the following operator. These spaces
mark where the unit begins and ends. Without them, Calcumber may not recognize
the unit. For example, m written directly after a number is
interpreted as the multiplier milli (0.001).
| Spaces around unit: 7 m + 3 m | 10 m |
| Not recognized: 7 m+3 m | |
| Interpreted as milli: 7m+3m | 0.01 |
Constants
Calcumber includes many predefined mathematical and physical constants
that can be used directly in calculations. Examples include
pi, e, the speed of light c,
standard gravity g, and the molar gas constant
R.
| pi | 3.1415927 |
| e # Euler's number | 2.7182818 |
| c # speed of light | 2.9979246e8 m/s |
| g # standard gravity | 9.80665 m/s2 |
| R # molar gas constant | 8.3144626 J/(mol*K) |
| eps0 # vacuum permittivity | 8.8541878e-12 F/m |
| mu0 # vacuum permeability | 1.2566371e-6 N/A2 |
See the full list of predefined variables and constants and use these in your calculations:
| How long does light travel from the Sun to the Earth? | |
| Distance: d = 150M km | 1.5e8 km |
| Time: t = d / c | 500.346 s |
Numbers and Precision
Large and small numbers can be entered using the standard exponential
notation such as 2.5e6 for 2.5 million. As a convenient
alternative, Calcumber also accepts multiplier prefixes such as
k, M, G,
m, and µ (u).
They can be written immediately after the number
(2.5M) or even in place of the decimal point
(2M5).
| 2.5e6 | 2.5e6 |
| 2.5M | 2.5e6 |
| 2M5 | 2.5e6 |
| 0.123 | 0.123 |
| 123e-3 | 0.123 |
| 123m | 0.123 |
See the complete list of multiplier prefixes.
By default, Calcumber switches to exponential notation for numbers
with an exponent of 6 or greater, or -6 or smaller.
You can change this threshold by assigning a new value to the variable
_exp_th.
| _exp_th = 3 | 3 |
| 1000 | 1e3 |
| 999 | 999 |
Assign a new value to _digits to control the number of
significant digits in Calcumber's output. The default is six digits.
| _digits = 3 | 3 |
| pi | 3.14 |
Fluid Properties
Calcumber can calculate thermodynamic fluid properties using the integrated CoolProp library. Load a fluid such as water, air, nitrogen, propane, or a refrigerant and calculate properties like density, enthalpy, entropy, viscosity, thermal conductivity, saturation pressure, and vapor quality.
This makes it possible to include real fluid-property calculations directly in engineering formulas, for example for heat pumps, refrigeration cycles, steam generation, air flows, or hydraulic heating circuits.
| load fluid water | 1 |
| h(1 bar, 20 °C) | 84.006054 kJ/kg |
| h(4 bar, 160 °C) | 2775.1891 kJ/kg |
| rho(1 bar, 20 °C) | 998.20654 kg/m3 |
See the Fluid Properties documentation for loading fluids, defining thermodynamic states, temperature conversion, two-phase calculations, and larger examples.