|
| 1 | +.TH amcli 1 "amcli" |
| 2 | +.SH DESCRIPTION |
| 3 | +Why use it? |
| 4 | +- Free and cross-platform |
| 5 | +- CLI interface for script automations |
| 6 | +- Piping for complex operations |
| 7 | +- Fast and small |
| 8 | +.SH SUBCOMMANDS |
| 9 | +.TP |
| 10 | +\fBeval\fR |
| 11 | +to evaluate into a single number, boolean, or a+bi form at for complex numbers. Expects one argument. |
| 12 | + |
| 13 | +Example: |
| 14 | + $ amcli eval "1 / 2" |
| 15 | + 0.5 |
| 16 | + $ amcli eval "e ^ pi > pi ^ e" |
| 17 | + true |
| 18 | + |
| 19 | +.TP |
| 20 | +\fBdiff\fR |
| 21 | +to differentiate the expression over the given variable (the first argument). Expects two arguments. |
| 22 | + |
| 23 | +Example: |
| 24 | + $ amcli diff "x" "sin(x)" |
| 25 | + cos(x) |
| 26 | + $ amcli diff "x" "1 + x^2" |
| 27 | + 2 * x |
| 28 | + $ echo "1 + x^2" | amcli diff "x" |
| 29 | + 2 * x |
| 30 | + |
| 31 | +.TP |
| 32 | +\fBsimp\fR |
| 33 | +to simplify the expression. Expects one argument. |
| 34 | + |
| 35 | +Example: |
| 36 | + $ amcli simp "sin(x)^2 + cos(x)^2" |
| 37 | + 1 |
| 38 | + |
| 39 | +.TP |
| 40 | +\fBfsimp\fR |
| 41 | +to simplify the expression "faster". This one works closer to eval than to simp, but unlike eval, it won't try to collapse to a single number or boolean (e. g. sqrt(3) will stay as it is). Expects one argument. |
| 42 | + |
| 43 | +Example: |
| 44 | + $ amcli fsimp "sin(x)^2 + cos(x)^2" |
| 45 | + 1 |
| 46 | + |
| 47 | +.TP |
| 48 | +\fBsolve\fR |
| 49 | +to solve a *statement* over the given variable. A *statement* is an expression, otherwise evaluable to true or false (e. g. "x > 3" is a statement, but "x ^ 2" is not). |
| 50 | + |
| 51 | +When the solution set is a finite solution, all solutions are written line-by-line. Otherwise, it's written as one line. |
| 52 | + |
| 53 | +Example: |
| 54 | + $ amcli solve "x" "x2 - 1 = 0" |
| 55 | + 1 |
| 56 | + -1 |
| 57 | + $ amcli solve x "x2 > 1" |
| 58 | + (-oo; -1) \/ (1; +oo) |
| 59 | + |
| 60 | +.TP |
| 61 | +\fBlatex\fR |
| 62 | +to convert an expression into LaTeX format. Expects one argument. |
| 63 | + |
| 64 | +Example: |
| 65 | + $ amcli latex "1/2" |
| 66 | + \frac{1}{2} |
| 67 | + $ amcli latex "(sqrt(3) + x) / limit(sin(x) / x, x, 0)" |
| 68 | + \\frac{\\sqrt{3}+x}{\\lim_{x\\to 0} \\left[\\frac{\\sin\\left(x\\right)}{x}\\right]} |
| 69 | + |
| 70 | +.TP |
| 71 | +\fBsub\fR |
| 72 | +to substitute an expression instead of a variable. Expects three arguments (variable to substitute, expression to be substituted instead of the variable, expression). |
| 73 | + |
| 74 | +Example: |
| 75 | + $ amcli sub x pi "sin(x / 3)" |
| 76 | + sin(pi / 3) |
| 77 | + $ amcli sub x "pi / 3" "sin(x)" |
| 78 | + sin(pi / 3) |
| 79 | + |
| 80 | +.SH PIPING |
| 81 | +.TP |
| 82 | + |
| 83 | +Any argument can be received either as a CLI argument or through standard input. |
| 84 | +For example, |
| 85 | + |
| 86 | + amcli eval "1 + 1" |
| 87 | + |
| 88 | +is equivalent to |
| 89 | + |
| 90 | + echo "1 + 1" | amcli eval |
| 91 | + |
| 92 | +This allows to pipe complex evaluations: |
| 93 | + |
| 94 | + echo "sin(x) * cos(y)" \ # 0. initial expression |
| 95 | + | amcli diff x \ # 1. differentiate over x |
| 96 | + | amcli sub x y \ # 2. substitute y instead of x |
| 97 | + | amcli diff y \ # 3. differentiate over y |
| 98 | + | amcli sub y "pi/3" \ # 4. substitute pi/3 instead of y |
| 99 | + | amcli simplify # 5. simplify |
| 100 | + |
| 101 | +Prints |
| 102 | + |
| 103 | + -1/2 * sqrt(3) |
| 104 | + |
| 105 | +Special symbol "_" (underscore) can be used to use stdinput instead of an argument. For instance, if you want to substitute the result of an operation into another expression: |
| 106 | + |
| 107 | + echo "e^x" \ |
| 108 | + | amcli sub u _ "u / (1 + u)" \ |
| 109 | + | amcli sub x 10 \ |
| 110 | + | amcli eval |
| 111 | + |
| 112 | +Here the result of `echo` is substituted instead of the second argument of `amcli sub`, not the last one. |
| 113 | + |
| 114 | +.SH OTHER |
| 115 | + |
| 116 | +You can bind amcli to @ using aliases. On Unix-like operating systems, add |
| 117 | + |
| 118 | + alias @=amcli |
| 119 | + |
| 120 | +(or specify the full path) |
0 commit comments