====== Math Functions ======
Your notes and clips can perform instant calculations — no special mode or syntax required. Just type a formula and end the line with an equal sign (`=`) to evaluate it automatically.
NEW: You can now perform calculations in the same way in Dataviewer's Input box – very useful for quickly filling in project cost data, for example.
===== Basic Usage =====
To perform a quick calculation, simply type the formula and finish it with `=` on a new line:
12+5*3=
The calculated result will immediately be inserted after the equal sign:
12+5*3=27
This works anywhere: in notes, clips, and [[manual#dataviewer|Dataviewer]]'s Cell Edit box.
===== Supported Features =====
* **Standard math operations**: +, -, *, /, ^ (power)
* **Brackets**: Fully supports nested expressions like `(2 + 3) * (4 + 1)`
* **Decimal support**: You may use either `.` or `,` as decimal separator (but not both in one formula)
* **Functions**: The following functions and constants are recognized:
sin(), cos(), tan(), asin(), acos(), atan(), sinh(), cosh(), tanh(), exp(), log(), sqrt(), pi, e
* **Powers and roots**: Use `^2`, `^3`, or functions like `sqrt()` and `cbrt()`:
sqrt(25)=5
5^3=125
* **Aliases**: You can also use expressions like:
Square(x), Cube(x), Root(x), CBRT(x)
===== Memory Placeholders =====
The calculator automatically remembers the last results of your calculations. You can reference them using `M1`, `M2`, and `M3` in any formula:
* `M1` — the most recent result
* `M2` — the result before that
* `M3` — the third most recent result
There is no need to assign values to these manually — they are always available as placeholders in any new formula.
Example:
2+3=5
M1*2=10
M2+1=6
You can freely combine memory values with new expressions.
===== Continue Calculating =====
You can continue calculations using the last result without referencing `M1` explicitly. Even if you've written unrelated text in between, just type an operator and a new number followed by `=`:
2+3=5
Some comment here.
+2=
This will result in:
+2=7
This allows you to interleave math expressions and text naturally in your workflow.
===== Table Summation =====
You can sum values from a text table using a special pattern.
1. Enter your values as rows in plain text.\\
2. Insert a line containing just `--` below the values.\\
3. Add a line with just `=` to trigger summation.
Example:
12.5 7.3 2
15.0 3.2 1.5
--
=
This will calculate and insert the **column-wise sum**:
27.5 10.5 3.5
The separator used to detect columns is tab (tabulator) by default. To change the separator, type it immediately after the --, for example:
12.5/7.3/2
15.0/3.2/1.5
--/
=27.5 10.5 3.5
This will also work with a space as separator.
===== Memory and Environment Awareness =====
The calculator detects whether you use commas or dots for decimal values. It will issue a warning if both are used in the same expression (e.g. `3.5 + 2,1 =` is not allowed).
===== Error Handling =====
If your expression contains invalid syntax or unsupported elements, a clear error message is shown:
Pattern Error: Expected ')' at position...
This helps identify typos or unsupported formats.
===== Notes =====
* Calculation results are inserted instantly after typing `=`.
* If you don't want the result inserted, avoid typing `=` at the end of the formula.
* `M1`, `M2`, `M3`, and the last result are always available globally across notes and clips.
* The calculator handles most common math use cases and is designed for speed and simplicity.