From 6fdcc2138b0d02c70527003a3db27156b3fc40d1 Mon Sep 17 00:00:00 2001 From: Charlotte Thomas Date: Mon, 2 Dec 2024 12:24:39 +0100 Subject: [PATCH] finish md book --- docs/book/src/SUMMARY.md | 27 ++++++++++++++++++++------- docs/book/src/algebra/index.md | 20 ++++++++++++++++++++ docs/book/src/algebra/matrices.md | 11 +++++++++++ docs/book/src/algebra/vectors.md | 9 +++++++++ docs/book/src/configuration.md | 2 +- docs/book/src/exact/diff.md | 25 +++++++++++++++++++++++++ docs/book/src/exact/index.md | 3 +++ docs/book/src/exact/rational.md | 17 +++++++++++++++++ docs/book/src/exact/symbolic.md | 7 +++++++ docs/book/src/function.md | 2 +- docs/book/src/logic.md | 14 +++++++++++++- docs/book/src/plot.md | 13 ++++++++++++- docs/book/src/plot/gui.md | 27 +++++++++++++++++++++++++++ docs/book/src/plot/term.md | 19 +++++++++++++++++++ docs/book/src/usage.md | 2 +- 15 files changed, 186 insertions(+), 12 deletions(-) create mode 100644 docs/book/src/algebra/index.md create mode 100644 docs/book/src/algebra/matrices.md create mode 100644 docs/book/src/algebra/vectors.md create mode 100644 docs/book/src/exact/diff.md create mode 100644 docs/book/src/exact/index.md create mode 100644 docs/book/src/exact/rational.md create mode 100644 docs/book/src/exact/symbolic.md create mode 100644 docs/book/src/plot/gui.md create mode 100644 docs/book/src/plot/term.md diff --git a/docs/book/src/SUMMARY.md b/docs/book/src/SUMMARY.md index 004d358..9fa3dd0 100644 --- a/docs/book/src/SUMMARY.md +++ b/docs/book/src/SUMMARY.md @@ -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) diff --git a/docs/book/src/algebra/index.md b/docs/book/src/algebra/index.md new file mode 100644 index 0000000..2f584cc --- /dev/null +++ b/docs/book/src/algebra/index.md @@ -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) diff --git a/docs/book/src/algebra/matrices.md b/docs/book/src/algebra/matrices.md new file mode 100644 index 0000000..f7b39cb --- /dev/null +++ b/docs/book/src/algebra/matrices.md @@ -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) diff --git a/docs/book/src/algebra/vectors.md b/docs/book/src/algebra/vectors.md new file mode 100644 index 0000000..0ad0245 --- /dev/null +++ b/docs/book/src/algebra/vectors.md @@ -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) diff --git a/docs/book/src/configuration.md b/docs/book/src/configuration.md index d412818..f8ecf4f 100644 --- a/docs/book/src/configuration.md +++ b/docs/book/src/configuration.md @@ -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. diff --git a/docs/book/src/exact/diff.md b/docs/book/src/exact/diff.md new file mode 100644 index 0000000..ac003cb --- /dev/null +++ b/docs/book/src/exact/diff.md @@ -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. + +

Warning

+ +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 `x²`). +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) diff --git a/docs/book/src/exact/index.md b/docs/book/src/exact/index.md new file mode 100644 index 0000000..507de2f --- /dev/null +++ b/docs/book/src/exact/index.md @@ -0,0 +1,3 @@ +# Chapter VII. Exact math + +Exact math has been added between version `v2.11.0` to version `v3.3.3` diff --git a/docs/book/src/exact/rational.md b/docs/book/src/exact/rational.md new file mode 100644 index 0000000..e7592c2 --- /dev/null +++ b/docs/book/src/exact/rational.md @@ -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) diff --git a/docs/book/src/exact/symbolic.md b/docs/book/src/exact/symbolic.md new file mode 100644 index 0000000..b632e8d --- /dev/null +++ b/docs/book/src/exact/symbolic.md @@ -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) diff --git a/docs/book/src/function.md b/docs/book/src/function.md index 11514f6..fe5d20d 100644 --- a/docs/book/src/function.md +++ b/docs/book/src/function.md @@ -1,4 +1,4 @@ -# Functions +# Chapter II. Functions ## Built-in functions The following functions are currently (as of `3.3.0`) built-in diff --git a/docs/book/src/logic.md b/docs/book/src/logic.md index b94c3cd..07a3626 100644 --- a/docs/book/src/logic.md +++ b/docs/book/src/logic.md @@ -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) + diff --git a/docs/book/src/plot.md b/docs/book/src/plot.md index ee24438..9637058 100644 --- a/docs/book/src/plot.md +++ b/docs/book/src/plot.md @@ -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) diff --git a/docs/book/src/plot/gui.md b/docs/book/src/plot/gui.md new file mode 100644 index 0000000..b7c8296 --- /dev/null +++ b/docs/book/src/plot/gui.md @@ -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) + diff --git a/docs/book/src/plot/term.md b/docs/book/src/plot/term.md new file mode 100644 index 0000000..f18d380 --- /dev/null +++ b/docs/book/src/plot/term.md @@ -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) diff --git a/docs/book/src/usage.md b/docs/book/src/usage.md index 3da65f5..d88ec89 100644 --- a/docs/book/src/usage.md +++ b/docs/book/src/usage.md @@ -1,4 +1,4 @@ -# Usage +# Chapter I. Usage ## Basic Operators