-
Notifications
You must be signed in to change notification settings - Fork 0
Command-line interface based on AngouriMath
License
asc-community/AngouriMathCLI
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
.TH amcli 1 "amcli" .SH DESCRIPTION Why use it? - Free and cross-platform - CLI interface for script automations - Piping for complex operations - Fast and small .SH SUBCOMMANDS .TP \fBeval\fR to evaluate into a single number, boolean, or a+bi form at for complex numbers. Expects one argument. Example: $ amcli eval "1 / 2" 0.5 $ amcli eval "e ^ pi > pi ^ e" true .TP \fBdiff\fR to differentiate the expression over the given variable (the first argument). Expects two arguments. Example: $ amcli diff "x" "sin(x)" cos(x) $ amcli diff "x" "1 + x^2" 2 * x $ echo "1 + x^2" | amcli diff "x" 2 * x .TP \fBsimp\fR to simplify the expression. Expects one argument. Example: $ amcli simp "sin(x)^2 + cos(x)^2" 1 .TP \fBfsimp\fR 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. Example: $ amcli fsimp "sin(x)^2 + cos(x)^2" 1 .TP \fBsolve\fR 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). When the solution set is a finite solution, all solutions are written line-by-line. Otherwise, it's written as one line. Example: $ amcli solve "x" "x2 - 1 = 0" 1 -1 $ amcli solve x "x2 > 1" (-oo; -1) \/ (1; +oo) .TP \fBlatex\fR to convert an expression into LaTeX format. Expects one argument. Example: $ amcli latex "1/2" \frac{1}{2} $ amcli latex "(sqrt(3) + x) / limit(sin(x) / x, x, 0)" \\frac{\\sqrt{3}+x}{\\lim_{x\\to 0} \\left[\\frac{\\sin\\left(x\\right)}{x}\\right]} .TP \fBsub\fR to substitute an expression instead of a variable. Expects three arguments (variable to substitute, expression to be substituted instead of the variable, expression). Example: $ amcli sub x pi "sin(x / 3)" sin(pi / 3) $ amcli sub x "pi / 3" "sin(x)" sin(pi / 3) .SH PIPING .TP Any argument can be received either as a CLI argument or through standard input. For example, amcli eval "1 + 1" is equivalent to echo "1 + 1" | amcli eval This allows to pipe complex evaluations: echo "sin(x) * cos(y)" \ # 0. initial expression | amcli diff x \ # 1. differentiate over x | amcli sub x y \ # 2. substitute y instead of x | amcli diff y \ # 3. differentiate over y | amcli sub y "pi/3" \ # 4. substitute pi/3 instead of y | amcli simplify # 5. simplify Prints -1/2 * sqrt(3) 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: echo "e^x" \ | amcli sub u _ "u / (1 + u)" \ | amcli sub x 10 \ | amcli eval Here the result of `echo` is substituted instead of the second argument of `amcli sub`, not the last one. .SH OTHER You can bind amcli to @ using aliases. On Unix-like operating systems, add alias @=amcli (or specify the full path)
About
Command-line interface based on AngouriMath
Resources
License
Code of conduct
Stars
Watchers
Forks
Packages 0
No packages published