The widget allows you to create a custom calculator with pre-defined variables, constants and calculation logic (formula).
It will calculate using given formula and user-entered parameters.
Examples: tips calculator, mortgage calculator.
Q: Which mathematical operations can I use?
- + - Add
- - - Subtract
- () - Math Brackets
- * - Multiply
- / - Divide
- ^ - Power of
- abs - Absolute value
- exp - To get e raised to a power
- log, log10 - logarithm of a number
- sign - numbers sign (returns -1, if the number is negative; 1, if the number is positive)
- sqrt - square root of a number
- sin - sine of an angle
- cos - cosine of an angle
- tan - tangent of an angle
- atan - arctangent of a number
Q: Can I use expressions?
Here are examples of expressions you may use in your formula:
- a * b + b/2
- a * (0.01 + b)/c
Q: How can I embed this module into my app?
Choose "Calculator" widget from "Change page type" popup:
Type the calculator name and description:
On the "Variables" tab create variables for your formula - use "Add Variable" button:
Note: only latin symbols are allowed in variable names
To edit or delete variables use appropriate icons on the right in the variable list.
On the "Constants" tab create constants for your formula (if needed):
On the "Add constant" popup, enter constant name and value, and click Save.
NOTE: only latin symbols are allowed in variable names.
When you’re done with variables and constants, specify the calculation formula: use spaces to separate variables, constants and operators.
You can also customize the Result button: