Skip to content

Commit

Permalink
start MD book
Browse files Browse the repository at this point in the history
  • Loading branch information
vanilla-extracts committed Dec 1, 2024
1 parent cbec0ba commit 5578404
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ There is a _MD Book_ [there](https://calc.charlotte-thomas.me/book)

## Manual

If you prefer a PDF, there is a [manual](https://github.com/vanilla-extracts/calc/blob/mistress/manual.pdf)
If you prefer a PDF, there is a [manual](https://calc.nwa2coco.fr/assets/manual.pdf)

## Contributors

Expand Down
1 change: 1 addition & 0 deletions docs/book/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
6 changes: 6 additions & 0 deletions docs/book/book.toml
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"
9 changes: 9 additions & 0 deletions docs/book/src/SUMMARY.md
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)
57 changes: 57 additions & 0 deletions docs/book/src/configuration.md
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)
1 change: 1 addition & 0 deletions docs/book/src/exact.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Exact math
67 changes: 67 additions & 0 deletions docs/book/src/function.md
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)
31 changes: 31 additions & 0 deletions docs/book/src/install.md
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
1 change: 1 addition & 0 deletions docs/book/src/logic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Logic
1 change: 1 addition & 0 deletions docs/book/src/plot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Plot
28 changes: 28 additions & 0 deletions docs/book/src/usage.md
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
3 changes: 3 additions & 0 deletions oranda.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"favicon": "https://www.axo.dev/favicon.ico"
},
"components": {
"mdbook": {
"path": "./docs/book"
},
"artifacts": {
"package_managers": {
"preferred": {
Expand Down

0 comments on commit 5578404

Please sign in to comment.