-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbec0ba
commit 5578404
Showing
12 changed files
with
206 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
book |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[book] | ||
authors = ["Charlotte Thomas"] | ||
language = "en" | ||
multilingual = false | ||
src = "src" | ||
title = "Calc Book" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Summary | ||
|
||
- [Install](./install.md) | ||
- [Usage](./usage.md) | ||
- [Functions](./function.md) | ||
- [Configuration](./configuration.md) | ||
- [Logic](./logic.md) | ||
- [Plot](./plot.md) | ||
- [Exact math](./exact.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Configuration | ||
The calculator is completely configurable, you can change the general color, | ||
the greeting message, the greeting color, the prompt and prompt color | ||
in a toml file found in your config folder. | ||
|
||
```sh | ||
$HOME/.config/mini-calc/mini-calc.toml | ||
``` | ||
|
||
On most GNU+Linux distros. | ||
|
||
![config](/assets/img.png) | ||
|
||
## Colors | ||
You can use the following colors: | ||
|
||
- blue | ||
- black | ||
- purple | ||
- green | ||
- cyan | ||
- red | ||
- yellow | ||
- white | ||
- an hexadecimal color (ex: #f7a8d8) | ||
|
||
The default color (or if it can't be parsed) is `cyan`. | ||
|
||
## Examples | ||
|
||
A modified config might looks like this | ||
|
||
![mod_config](/assets/config_modified.png) | ||
|
||
And produce the following output | ||
|
||
![mod_config_look](/assets/config_looks.png) | ||
|
||
## Command line interaction | ||
|
||
You can interact in the REPL with the config the commands are: | ||
|
||
- `config`: shows the config help. | ||
- `config reload`: reloads the configuration from the file. | ||
- `config reset`: resets the configuration to its default. | ||
- `config show`: shows the current configuration. | ||
- `config set <category> <value>`: modifies the configuration. | ||
|
||
Categories are | ||
|
||
- `greeting_message`: string | ||
- `greeting_color`: color | ||
- `prompt_color`: color | ||
- `prompt`: string | ||
- `general_color`: color | ||
|
||
![conf_inter](/assets/config.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Exact math |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Functions | ||
|
||
## Built-in functions | ||
The following functions are currently (as of `3.3.0`) built-in | ||
|
||
- Trigonometry | ||
- `sin` (vectorised) | ||
- `cos` (vectorised) | ||
- `tan` (vectorised) | ||
- Hyperbolic trigonometry | ||
- `sinh` (vectorised) | ||
- `cosh` (vectorised) | ||
- `tanh` (vectorised) | ||
- Reverse trigonometry | ||
- `asin` (vectorised) | ||
- `acos` (vectorised) | ||
- `atan` (vectorised) | ||
- Exponentiation | ||
- `exp` (vectorised) | ||
- `ln` (alias `log`) (vectorised) | ||
- Vectors | ||
- `norm` | ||
- Matrices | ||
- `det` | ||
- `invert` | ||
- Plot | ||
- `plot` | ||
- `termplot` | ||
- Other | ||
- `sqrt` (vectorised) | ||
- `factorial` (alias `fact`) | ||
- `abs` | ||
- `ceil` | ||
- `floor` | ||
- `round` | ||
|
||
## Trigonometry | ||
|
||
For trigonometry, the input is assumed to to in `radians`, if it is in `degrees` | ||
you need to add a second argument (can be anything, like `true`) to the function | ||
call. | ||
|
||
![example](/assets/trigo.png) | ||
|
||
## Exp/ln | ||
If you use the `exp` function you can pass the base you want to work with | ||
as a second argument. If nothing is supplied, we assume natural base. | ||
|
||
![example](/assets/expln.png) | ||
|
||
## Root | ||
You can add a second argument to `sqrt` for the `nth` root instead | ||
of the 2nd root. | ||
|
||
![example](/assets/nth_root.png) | ||
|
||
## User defined functions | ||
You can define your own functions with the following syntax | ||
(warning: it might change in `4.0.0`) | ||
|
||
![example](/assets/user_defined.png) | ||
|
||
## Partial functions | ||
You can use a user-defined function to declare a partial function, | ||
to have a cos in degrees for example. | ||
|
||
![example](/assets/function.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Introduction | ||
|
||
## Installation | ||
You can install `mini-calc` via several methods | ||
|
||
### Cargo | ||
```sh | ||
cargo install mini-calc | ||
``` | ||
|
||
### Source | ||
```sh | ||
git clone https://github.com/vanilla-extracts/calc | ||
cd calc | ||
cargo build --release | ||
./target/release/mini-calc | ||
``` | ||
|
||
### Nix | ||
```sh | ||
nix run github.com:vanilla-extracts/calc | ||
``` | ||
|
||
## Contributors | ||
|
||
[I am](https://www.charlotte-thomas.me) the main maintainer and developer of Calc. | ||
|
||
Thanks to my friends, who helped me along the way | ||
|
||
- [Léana](https://earth2077.fr), for her help and code cleanup | ||
- [Sigmaficient](https://sigmaficient.github.io), for his help to nixify the repo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Logic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Plot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Usage | ||
|
||
## Basic Operators | ||
|
||
Calc supports basic arithmetic operators such as: | ||
|
||
- `+` | ||
- `*` | ||
- `-` | ||
- `/` | ||
- `^` | ||
|
||
## Variables | ||
|
||
The calculators also implements a system of (for the moment all global) | ||
variables. | ||
|
||
The syntax is simple, close to python. Its type-abilities are close to python | ||
too, you can re-assign a variable with another value of another type. | ||
``` | ||
var = 5 | ||
``` | ||
|
||
![Example](/assets/image.png) | ||
|
||
### Built-in variable | ||
- `pi` is a double precision float representation of pi | ||
- `e` is a double precision float representation of e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters