The built-in calculator (RPN expressions)
OghmaNano includes a small built-in calculator that evaluates algebraic expressions using Reverse Polish Notation (RPN). This is used anywhere the software needs a compact, unambiguous way to specify a mathematical expression rather than a single numeric value.
In practice, you will most often encounter the calculator in workflows such as:
- Fitting and parameter extraction — for example, defining an error function or cost metric in the fitting window.
- Formula-based inputs — where a material constant or model parameter is defined as an expression rather than a fixed number.
- Automation and scripting — when constructing parameterised studies that require a compact expression syntax.
1. Supported operations
| Operation | Operator | Example |
|---|---|---|
| Exponentiation | ^ | \(2^3 = 8\) |
| Multiplication | * | \(2 * 3 = 6\) |
| Division | / | \(6 / 2 = 3\) |
| Addition | + | \(2 + 3 = 5\) |
| Subtraction | - | \(5 - 3 = 2\) |
| Greater than | > | \(5 > 3\) is 1 |
| Less than | < | \(2 < 5\) is 1 |
| Greater than or equal | >= | \(5 >= 5\) is 1 |
| Less than or equal | <= | \(3 <= 4\) is 1 |
2. Supported functions
| Function name | Function | Example |
|---|---|---|
| Sine | sin | \(\sin(\pi/2) = 1\) |
| Cosine | cos | \(\cos(0) = 1\) |
| Absolute value | abs | \(\text{abs}(-3) = 3\) |
| Positive part | pos | \(\text{pos}(-3)=0,\ \text{pos}(3)=3\) |
| Logarithm (base 10) | log | \(\log(100) = 2\) |
| Exponential | exp | \(\exp(2) = e^2\) |
| Square root | sqrt | \(\sqrt{9} = 3\) |
| Minimum | min | \(\min(2, 3) = 2\) |
| Maximum | max | \(\max(2, 3) = 3\) |
| Random | rand | \(\text{rand}(a,b)\) generates a random number between \(a\) and \(b\) |
| Log-random | randlog | \(\text{randlog}(a,b)\) generates a log-random number between \(a\) and \(b\) |