Features - bornova/numara-calculator GitHub Wiki
In addition to all constants, functions, and units provided by Math.js, following functionalities are provided:
Shortcut keywords
ans Returns the answer from the previous line
total Total all numeric values up to this keyword.
subtotal Total numeric values within a calculation block after a blank line.
avg Average all numeric values up to this keyword
lineX Return answer from a specific line, where X is the line number. Ex. line4 would return the answer from line 4.
today Return today's date
now Return todays's date and time
Simple date calculations
Numara allows you to do simple date additions/substractions such as today + 3 weeks and now + 36 hours. You can also do a date plus/minus a duration such as 7/31/2023 + 4 days where the date provided must be in user's locale format. If the date is not followed by an operator, the expession is evaluated as 7 divided by 31 divided by 2023.
Function plotting
When an expression is entered as a function such as f(x) = 2x^2 + 3x - 5, Numara will output a link to plot the function and clicking the link will display the plot in a dialog.
Currency calculations
When enabled, Numara imports currency rates from floatrates.com as units and these units can then be used to do currency calculations such as 1 usd to eur and 25 hours * 50 usd/hr (1250 usd)
Commenting
Any text starting with // or # will be treated as a comment. You can comment an entire line:
// This is a comment line
# So is this
Or, comments can be added to the end of an expression:
1 + 2 // Add 1 and 2 | 3
1 + 2 # Add 1 and 2 | 3
User defined functions and units
Functions
Custom functions can be defined to be used in the calculator. Each custom function must be a typed as an object (name: function | value) and separated by a comma ,
xyz: (x, y, z) => {
return x+y+z
},
test: 123,
Above examples can be then used in Numara where xyz(1, 2, 3) outputs 6 and test outputs 123
Units
Custom units can be defined to be used in the calculator. Each custom unit must be a typed as an object (name: unit | unit object) and separated by a comma ,.
xunit: '12 foot',
Above examples can be then used in Numara where 5 xunit to ft outputs 60 ft
More information on creating units can be found here: Math.js User-Defined Units
Settings
Appearance
Theme System (Default) | Light | Dark
- Set the app theme.
Font size Tiny | Small | Normal (Default) | Large | X-Large
- Set the font size of the calculation text.
Font weight Light | Thin | Normal (Default) | Semi Bold | Bold
- Set the font weight of the calculation text.
Line height Tiny | Small | Normal (Default) | Large | X-Large
- Set the height of each calculation line.
Always on top On | Off (Default)
- Keep Numara on top off all others on the screen.
Editor
Syntax highlighting On (Default) | Off
- Enable syntax highlighting for typed expressions.
Keyword tooltips On (Default) | Off
- Display tooltips where available when hovered over keywords such as function names, units, and constants.
Highlight matching brackets On (Default) | Off
- When cursor is next to a bracket, highlight the matching bracket.
Autocomplete hints On (Default) | Off
- Show autocompletion hints as a list while typing an expression.
Close matching brackets On (Default) | Off
- Auto-close brackets and quotes when typed.
Line numbers On (Default) | Off
- Show line numbers for each line on the input panel.
Wrap lines (input only) On (Default) | Off
- This is setting applies to the input panel only. Allows the overflown text to wrap to the next line. Answers on the output panel will always be displayed on a single line.
Rulers On | Off (Default)
- Show rulers to visually separate each line.
Start with blank page On | Off (Default)
- Starts the app with a new blank page instead of the last used page.
Calculator
Answer position Left (with divider) (Default) | Right (no divider) | Below expression
- Sets where the answer should be shown in the app.
Numeric output Number (Default) | BigNumber | Fraction
-
The type of numeric output for functions which cannot determine the numeric type from the inputs. For most functions though, the type of output is determined from the the input: a number as input will return a number as output, a BigNumber as input returns a BigNumber as output.
For example the functions '2+3', parse('2+3'), range('1:10'), and unit('5cm') use the number configuration setting. But sqrt(4) will always return the number 2 regardless of the number configuration, because the input is a number.
BigNumbers have higher precision than the default numbers of JavaScript, and Fractions store values in terms of a numerator and denominator.
Notation Auto (Default) | Engineering | Exponential | Fixed | Bin | Hex | Oct
-
Numeric output type for answers.
'Auto' (default) Regular number notation for numbers having an absolute value between lower and upper bounds, and uses exponential notation elsewhere. Lower bound is included, upper bound is excluded. For example '123.4' and '1.4e7'.
'Exponential' - Always use exponential notation. For example '1.234e+2' and '1.4e+7'
'Engineering' - Always use engineering notation: always have exponential notation, and select the exponent to be a multiple of 3. For example '123.4e+0' and '14.0e+6'
'Fixed' - Always use regular number notation regardless of the exponential limits.
'Bin', 'Oct', or 'Hex' - Format the number using binary, octal, or hexadecimal notation. For example '0b1101' and '0x10fe'.
Precision (0 - 16) Default 4
- Number of decimal points to display for the answer.
Upper exponent limit (0 - 16) Default 12
- Number determining the upper boundary for formatting a value with an exponent.
Lower exponent limit (-12 - 0) Default -12
- Number determining the lower boundary for formatting a value with an exponent.
Matrix type Matrix (Default) | Array
- The default type of matrix output for functions. Where possible, the type of matrix output from functions is determined from the function input: An array as input will return an Array, a Matrix as input will return a Matrix. In case of no matrix as input, the type of output is determined by the option matrix. In case of mixed matrix inputs, a matrix will be returned always.
Predictable output On | Off (Default)
- When On, output type depends only on the input types. When Off (default), output type can vary depending on input values. For example math.sqrt(-4) returns complex('2i') when predictable is Off, and returns NaN when On. Predictable output can be needed when programmatically handling the result of a calculation, but can be inconvenient for users when evaluating dynamic equations.
Continue previous line On (Default) | Off
- Choose whether the calculation on a new line should continue from the previous line.
Line errors On (Default) | Off
- Show 'Error' in the output panel if a calculation error occurs. User can then click the Error link to see details about the error. This will also highlight the line number red where the error is present.
Locale
User Locale System (Default) | Chinese (PRC) | English (Canada) | English (UK) | English (US) | French (France) | German (Germany) | Italian (Italy) | Japanese (Japan) | Portuguese (Brazil) | Russian (Russia) | Spanish (Mexico) | Spanish (Spain) | Turkish (Turkey)
- Set the locale of the calculator. The type of decimal place and thousands separator, as well as the display of dates, will match the chosen locale. Choosing
Systemwill use the user's operating system locale.
Enable for input On | Off (Default)
- Enable locale-specific number formatting for input values (e.g., decimal and thousands separators).
Thousand separator On (Default) | Off
-
Choose whether to use thousand separators for numbers grater than 999.
-
Copy with answerOn | Off (Default) Choose whether to include the thousand separator with the copied answer. -
Paste with separatorOn | Off (Default) Enable thousands separator when pasting numbers into the calculator.
-
Show day with date On | Off (Default)
- If 'On', the day of the week will be prepended to the date output when performing date calculations and using keywords such as 'today' and 'now'.
Notifications
Location Top Left | Top Center | Top Right | Bottom Left | Bottom Center (Default) | Bottom Right
- Set the location of the notification pop up on the screen
Duration (seconds) 1 | 3 | 5 (Default) | 10 | 30 | Close manually
- Set the duration of the notification pop up on the screen or set to close it manually.
Currency Conversion
Enabled On (Default) | Off
- Enable currency conversions. Currency rates are provided by floatrates.com and updates daily (once in 12 hours at 12 AM/PM)
Rate update interval On start (Default) | 1 hour | 3 hour | 6 hour | 12 hour
- Set how often the currency exchange rates are updated.
3rd Party Library Integration
Formula.js
-
Numara can process limited number of Excel functions based on the formulajs library. For more information about available functions, please visit https://formulajs.info
Example:
formulajs.ABS(-2) // 2
Nerdamer
-
Numara can process Nerdamer functions for added symbolic math expression evaluation support. For more information about Nerdamer, please visit https://nerdamer.com/
Example:
nerdamer.solve("x^3-10x^2+31x-30", "x") // [3,5,2]