# Custom Tools

### How to create a custom tool?

The **Custom Tools** are a unique feature offered solely by CalcKit, that allows you to create your own calculators and converters in a matter of minutes.

To create a new calculator, open the `Custom Tools`

menu and Press on `Create New Tool`

. You can create an unlimited number of your own calculators and converters.

All components of the custom tools and their configuration are explained below with the help of some examples.

### Title & Description

The **Title** is basically the name of the tool, displayed in the **Custom Tools** menu.

The **Description** is a multi-line text box that is displayed on it's own dedicated tab that can be accessed by swiping to the left or by tapping the `Description`

button in the custom tool.

### Variables

This section is the main part of your custom tool.

There are two types of variables available: `Number`

and `Choice`

.

Each custom tool can have up to 25 variables.

You can also add static `Text`

elements to provide better visual representation of your custom tool.

### Number

The `Number`

variable has several elements and options that are described below.

All custom tools within CalcKit use a unique **circular reference** algorithm, allowing each `Number`

variable to act as both input and output.

##### Identifier

The **Identifier** is used to reference this variable in other variables' formulas. The identifier is predefined for each variable and is located at the top of the variable box.

The identifier is basically a single character from `A`

to `Z`

*(with the exception of E)*.

For example, on the image above, the identifier of the variable is

`X`

.##### Name

The **Name** is a label for the variable that you see on the screen when you use the calculator.

##### Formulas

Each variable can have any number of formulas. It can also have zero formulas in which case the variable is considered only as an input.

In the **Formulas** field you can put as many formulas as you need.

Each formula needs to be put on a new line.

For example, in the `Weight Converter`

below, you'll find the following formulas for the **Kilogram**.

`Y/1000`

Z/(10^6)

A/35.274

B/2.205

C*1000

where `Y`

, `Z`

, `A`

, `B`

and `C`

are the identifiers for `Gram`

, `Milligram`

, `Ounce`

, `Pound`

and `Ton`

respectively.

##### Unit(s)

The **Unit** *(also called suffix/postfix)* appears on the right side of the variable's input field.

You can add a single unit that is displayed as simple text, or you can add multiple units that will be displayed as a dropdown menu when using the calculator.

To add a single unit as text, you just need to type it in the `Unit(s)`

field.

Make sure to type it on the first line and do not create a second line.

To add a dropdown of multiple units, you need to put each unit on a new line.

You also need to include a **multiplier** for each unit, so that CalcKit can calculate the value.

In our `Rectangle Calculator`

example below, there is a dropdown for each variable.

You can see that for the `'a' Side`

variable, we have the dropdown with units: `km`

, `m`

, `cm`

, `mm`

. To create it we use the following code in the `Unit(s)`

field:

`0.001 km`

1 m

100 cm

1000 mm

Here, the `m`

*(meter)* unit has a multiplier of `1`

, so `m`

is our base unit. That means when you select one of the other units (**km** for example), internally it is converted to **meters** and all formulas for this variable are using the unit `m`

*(meters)*.

To calculate the **multiplier** for the other units we do the following:

**Centimeters (cm)**: There are 100 cm in one meter, so the multiplier for centimeters is`100`

**Millimeters (mm)**: There are 1000 mm in one meter, so the multiplier is`1000`

**Kilometers (km)**: There are 1000 meters in one kilometer, so that is 1/1000 km in one meter, which comes to`0.001`

As you can see in the example above, the multiplier and the unit name/label need to be separated by space and each unit has to be added on a new line.

##### Default Value

Using this option you can specify a **default value** for this variable. This value will be used when the field is empty.

##### Disabled

When this option is activated, the input field of this variable will be disabled when using the tool.

This can be used to visually separate the output variables from the rest of the calculator.

##### Hidden

When this option is activated, the variable will exist, but it will be hidden in the calculator.

For example, this can be used to create a constant that can be used in multiple formulas, simply by hiding the variable and specifying a default value for it.

Or it can be used to calculate a formula that does not necessarily need to be visible on the screen, but is needed for calculating the rest of the variables.

### Choice

The `Choice`

variable creates a dropdown list with one or multiple items/choices.

It has the following elements: `Identifier`

, `Name`

and `Choices`

.

##### Identifier

Same as for the Number variables, the **Identifier** is used to reference this variable in other variables' formulas. The identifier is predefined for each variable and is located at the top of the variable box. For example, on the image above, the identifier of the variable is `Y`

.

##### Name

The **Name** is a label for the variable that you see on the screen when you use the calculator.

##### Choices

The **Choices** field is a multi-line text box that is used to make the dropdown list for this variable.

Each choice/item has a `value`

and `label`

.

You can add multiple choices/items to the dropdown, by putting each choice on a new line.

For example you can make a dropdown list with multiple choices, by typing something like this:

`828 Burj Khalifa`

632 Shanghai Tower

541.3 One World Trade Center

381 Empire State Building

As you can see from the example above, the making of the dropdown list is very similar to the units dropdown for the Number variables.

Basically, the `value`

and `label`

for each choice/item are separated by space, and each choice has to be added on a new line.

### Text

You can add as many text elements to your custom tool as you need.

The `Text`

element is not a variable, it is just a visual element that you can use to make your calculator easier to use by providing a description for a variable, or separating your variables in multiple sections and similar.

Here are some examples of how it can be used:

### Copy / Paste / Share

You have the option to copy, paste and share a single tool, or all tools at once.

The custom tools are stored in JSON format, so it is possible to copy/paste them as a simple text.

##### Copy

To copy a single tool:

- Open the custom tool
- Press
`Edit Tool`

- Scroll down to the
`Tool Options`

- Press
`COPY`

To copy all of your custom tools at once:

- Open the
`Custom Tools`

menu - Scroll down to the bottom
- Press
`COPY`

Now the tool(s) are copied to your clipboard as simple text.

##### Paste

After you copy one or multiple tools, you can paste them in CalcKit by doing the following:

- Open the
`Custom Tools`

menu - Scroll down to the bottom
- Press
`PASTE`

**Note:** There is also a `PASTE`

button in the menu when editing a tool, but we encourage the use of the `PASTE`

button in the `Custom Tools`

menu.

##### Share

You can share a single tool or all tools at once simply by tapping the `SHARE`

button.

Because it is a simple text that is being shared, you can share it by email, messages, bluetooth, social media, google keep, drive, dropbox and other apps that allow sharing text messages/files.

After you share the tool(s), inserting them in CalcKit is done by copying the shared code and following the `PASTE`

procedure above.

### How to import/export the tools?

There is currently no automatic import/export feature in CalcKit.

You can `Export`

the tools by following the `Share`

procedure above and store them in a text file on your Google Drive (for example).

To `Import`

the tools later in CalcKit, you just need to:

- Open the text file where you saved the tools
- Copy the content of the file
- Open the
`Custom Tools`

menu in CalcKit - Tap the
`PASTE`

button

### Available Functions

Below is a list with all available built-in functions and short description for each.

`+` |
Add.`4+5 = 9` |

`-` |
Subtract.`7-3 = 4` |

`*` |
Multiply.`2*3 = 6` |

`/` |
Divide.`6/2 = 3` |

`^` |
Power.`2^3 = 8` |

`(…)` |
Grouping.`2*(3+4) = 14` |

`!` |
Factorial.`5! = 120` |

`%` |
Calculate percentage.`50 + 25% = 62.5` `50 - 25% = 37.5` `50 * 25% = 12.5` `50 / 25% = 200 ` |

`pi` |
Pi, mathematical constant, `3.14159…` |

`e` |
Euler’s number, mathematical constant, `2.71828…` |

`sqrt(…)` |
Square root.`sqrt(16) = 4` |

`log(…)` |
Common logarithm, base `10` .`log(10) = 1` |

`ln(…)` |
Natural logarithm, base `e` .`ln(e) = 1` |

`round(…)` |
Round a value towards the nearest integer.`round(1.2345) = 1` `round(1.2345, 2) = 1.23` |

`floor(…)` |
Round a value towards minus infinity.`floor(3.7) = 3` |

`ceil(…)` |
Round a value towards plus infinity.`ceil(3.2) = 4` |

`abs(…)` |
Calculate the absolute value of a number.`abs(-3.5) = 3.5` |

`min(…,…)` |
Compute the minimum value of the provided arguments.`min(3, 2, 5, 4) = 2` |

`max(…,…)` |
Compute the maximum value of the provided arguments.`max(3, 2, 5, 4) = 5` |

`sum(…,…)` |
Compute the sum value of the provided arguments.`sum(3, 2, 5, 4) = 14` |

`avg(…,…)` |
Compute the average/mean value of the provided arguments.`avg(3, 2, 5, 4) = 3.5` |

`gcd(…,…)` |
Calculate the greatest common divisor for two or more values.`gcd(25, 15, -10) = 5` |

`lcm(…,…)` |
Calculate the least common multiple for two or more values.`lcm(6, 21, 5) = 210` |

`mod(…,…)` |
Calculates the modulus, the remainder of an integer division.`mod(8, 3) = 2` |

`sinr(…)` `cosr(…)` `tanr(…)` `cotr(…)` `secr(…)` `cscr(…)` |
Trigonometric functions in Radians.(sine, cosine, tangent, cotangent, secant, cosecant) `sinr(pi/2) = 1` |

`sind(…)` `cosd(…)` `tand(…)` `cotd(…)` `secd(…)` `cscd(…)` |
Trigonometric functions in Degrees.(sine, cosine, tangent, cotangent, secant, cosecant) `sind(90) = 1` |

`sing(…)` `cosg(…)` `tang(…)` `cotg(…)` `secg(…)` `cscg(…)` |
Trigonometric functions in Gradians.(sine, cosine, tangent, cotangent, secant, cosecant) `sing(100) = 1` |

`asinr(…)` `acosr(…)` `atanr(…)` `asind(…)` `acosd(…)` `atand(…)` `asing(…)` `acosg(…)` `atang(…)` |
Inverse trigonometric functions in Radians, Degrees and Gradians.(arcsine, arccosine, arctangent) `asinr(1) = 1.57079…` (rad)`asind(1) = 90` (deg)`asing(1) = 100` (grad) |

`sinh(…)` `cosh(…)` `tanh(…)` |
Hyperbolic functions (sine, cosine, tangent) |

`asinh(…)` `acosh(…)` `atanh(…)` |
Inverse hyperbolic functions (arcsine, arccosine, arctangent) |

`==` |
Equal.`2 == 4-2` = `1` |

`!=` |
Unequal.`2 != 3` = `1` |

`<` |
Smaller.`2 < 3` = `1` |

`>` |
Larger.`2 > 3` = `0` |

`<=` |
Smaller or equal.`4 <= 3` = `0` |

`>=` |
Larger or equal.`2+4 >= 6` = `1` |

`not(…)` |
Logical not.`not(1)` = `0` |

`and(…,…)` |
Logical and.`and(1, 0)` = `0` |

`or(…,…)` |
Logical or.`or(1, 0)` = `1` |

`xor(…,…)` |
Logical xor.`xor(1, 1)` = `0` |

`if(test, true res, false res)` |
Conditional expression.`if(15 < 100, 10, 20)` = `10` `if(15 > 100, 10, 20)` = `20` |

### Custom Tool Examples

Below are 2 examples of a custom `calculator`

and `converter`

. You can import them (copy/paste) in your `Custom Tools`

menu to see how they are created with all formulas/units inside.