Skip to content

Commit

Permalink
finish md book
Browse files Browse the repository at this point in the history
  • Loading branch information
vanilla-extracts committed Dec 2, 2024
1 parent b4cb3d9 commit 6fdcc21
Show file tree
Hide file tree
Showing 15 changed files with 186 additions and 12 deletions.
27 changes: 20 additions & 7 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# Summary

- [Install](./install.md)
- [Usage](./usage.md)
- [Functions](./function.md)
- [Configuration](./configuration.md)
- [Logic](./logic.md)
- [Plot](./plot.md)
- [Exact math](./exact.md)
# Basic Usage
- [Introduction](./install.md)
- [Chapter I. Usage](./usage.md)

# Advanced Usage
- [Chapter II. Functions](./function.md)
- [Chapter III. Configuration](./configuration.md)
- [Chapter IV. Logic](./logic.md)
- [Chapter V. Plot](./plot.md)
- [Section V.1. GUI](plot/gui.md)
- [Section V.2. Terminal](plot/term.md)

# Algebra
- [Chapter VI. Algebra](algebra/index.md)
- [Section VI.1. Vectors](algebra/vectors.md)
- [Section VI.2. Matrices](algebra/matrices.md)
- [Chapter VII. Exact math](exact/index.md)
- [Section VII.1. Rational Reduction](exact/rational.md)
- [Section VII.2. Symbolic Reduction](exact/symbolic.md)
- [Section VII.3. Function differentiation](exact/diff.md)
20 changes: 20 additions & 0 deletions docs/book/src/algebra/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Chapter VI. Algebra

The calculator supports basic algebraic calculations, including

- Vectors
- Dot product (operator `*` - with another vector.)
- Scalar product (operator `*` - with a scalar.)
- Norm (function `norm`)
- Addition (operator `+`)
- Matrices
- Addition (operator `+`)
- Multiplication (operator `*` - with another matrix.)
- Scalar multiplication (operator `*` - with a scalar.)
- Transposition (function `transpose`)
- Determinant (via _LUP-decomposition_ function `det`)
- Inversion (via _LUP-decomposition_ function `invert`)

The matrices (and vectors) are pretty printed (and aligned) (since `v2.11.5`)

![matrix_pretty_printed](/assets/aligned_matrices.png)
11 changes: 11 additions & 0 deletions docs/book/src/algebra/matrices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Section VI.2. Matrices
As of `v2.7.0` matrix algebra supports

- Addition (operator `+`)
- Multiplication (operator `*` - with another matrix.)
- Scalar multiplication (operator `*` - with a scalar.)
- Transposition (function `transpose`)
- Determinant (via _LUP-decomposition_ function `det`)
- Inversion (via _LUP-decomposition_ function `invert`)

![matrix](/assets/matrix.png)
9 changes: 9 additions & 0 deletions docs/book/src/algebra/vectors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Section VI.1. Vectors
Basic vector calculation supports

- Addition (operator `+`)
- Dot product (operator `*` - with another vector.)
- Scalar product (operator `*` - with a scalar.)
- Norm (function `norm`)

![vector_calc](/assets/vector.png)
2 changes: 1 addition & 1 deletion docs/book/src/configuration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Configuration
# Chapter III. 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.
Expand Down
25 changes: 25 additions & 0 deletions docs/book/src/exact/diff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Section VII.3. Function differentiation
As of `v3.2.0`, the calculator can differentiate both known functions (built-in)
and user-defined functions constructed using known functions and operations.

<h2 style="color:red;">Warning</h2>

Beware, as of `v3.3.3` there is some bugs to iron out. It doesn't
differentiate variables (for example `x*x` works but not ``).
And differentiation of function referencing each other
(for example `v(x) = f(x) + x*x`) doesn't work either.

It's currently being fixed, and will be fixed before stable release `v3.4.0`
which is currently in `alpha` development-testing (it will implements basic languages
features
such as flow control and condition.)

The release `v3.3.4`, which correct those bugs is currently in `beta` dev-testing
and will be released before `v3.4.0`.

## Examples
### Built-in
![diff_bi](/assets/diff_builtin.png)

### User defined
![ud](/assets/diff_ud.png)
3 changes: 3 additions & 0 deletions docs/book/src/exact/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Chapter VII. Exact math

Exact math has been added between version `v2.11.0` to version `v3.3.3`
17 changes: 17 additions & 0 deletions docs/book/src/exact/rational.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Section VII.1. Rational Reduction

As of version `v2.11.0` rational exact math reduction was added, it supports.

- Rational operations
- `+`
- `-`
- `*`
- `/`
- Rational reductions
- Float rationalization (with 10 digits of precision)

## Operations
![operations](/assets/exact_rationals.png)

## In matrices
![matrix](/assets/exact_inverse.png)
7 changes: 7 additions & 0 deletions docs/book/src/exact/symbolic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Section VII.2. Symbolic Reduction

As of `v3.0.0` the support for symbolic reduction has been added to calc.
It supports multi-variables multi-operations reductions, you can reduce
expressions using it, fair warning, it uses _a lot_ of parentheses

![symbolic reduction](/assets/multi_variable.png)
2 changes: 1 addition & 1 deletion docs/book/src/function.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Functions
# Chapter II. Functions

## Built-in functions
The following functions are currently (as of `3.3.0`) built-in
Expand Down
14 changes: 13 additions & 1 deletion docs/book/src/logic.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# Logic
# Chapter IV. Logic

## Infix Operators

- `or` (alias `||`)
- `and` (alias `&&`)
- `geq` (alias `>=`)
- `leq` (alias `<=`)
- `gt` (alias `>`)
- `lt` (alias `<`)

![example](/assets/logic.png)

13 changes: 12 additions & 1 deletion docs/book/src/plot.md
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
# Plot
# Chapter V. Plot

You can plot, provided you have `gnuplot` installed,
which the backend relies on.

It works great on Linux and macOS, but it's not tested on Windows.

## Help
As the `plot` function is a little difficult you can call it without
parameters to show the help `plot()`

![plot_help](/assets/plot_help.png)
27 changes: 27 additions & 0 deletions docs/book/src/plot/gui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Section V.1. GUI

## Default

To plot a function `f` you just need to do `plot(f)`

![plot_default](/assets/plot_cos_default.png)

## Options
You can pass parameters to the function.

```
> plot(sin,-pi,pi,0.01,"sin","x(rad)","y","line")
```

Let's unpack, we have ploting the `sin` function, from `x=-pi` to `x=pi`
with a step of `0.01 rad`, the title of the graph is `sin`, the x_axis
label is `x(rad)`, the y_axis label is `y` and we want a line.

![plot_custom](/assets/plot_sin_custom.png)

## User-defined functions
You can plot your own functions with the same call.
Here is the example for `f(x) = x*x`

![plot_f](/assets/plot_f.png)

19 changes: 19 additions & 0 deletions docs/book/src/plot/term.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Section V.2. Terminal
You can also plot right into the terminal, without need for the `gnuplot`
backend.

## Default
The best example to show it to you (before the auto-scaling) is the square
function, from `x=-5` to `x=5` with a step of `0.1`.

![plot_term](/assets/plot_term_x_squared.png)

## Options
Like the GUI plotting, the terminal supports options

![plot_term_option](/assets/plot_term_x_squared_labels.png)

## Auto scaling
Both the `x` and `y` axis supports _auto-scaling_

![plot_term_scaling](/assets/termplot_cos.png)
2 changes: 1 addition & 1 deletion docs/book/src/usage.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Usage
# Chapter I. Usage

## Basic Operators

Expand Down

0 comments on commit 6fdcc21

Please sign in to comment.