Skip to content
This repository was archived by the owner on Oct 2, 2026. It is now read-only.

Commit 616fbc3

Browse files
Flake (#6)
* Flake added * Man page * Readme replaced with the man page
1 parent c30561f commit 616fbc3

9 files changed

Lines changed: 229 additions & 168 deletions

File tree

‎CLI.csproj‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,10 @@
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88

9-
<SelfContained>true</SelfContained>
10-
<PublishAot>true</PublishAot>
11-
<PublishTrimmed>true</PublishTrimmed>
12-
<TrimMode>full</TrimMode>
13-
<IlcInvariantGlobalization>true</IlcInvariantGlobalization>
14-
<IlcOptimizationPreference>Speed</IlcOptimizationPreference>
15-
<IlcDisableReflection>false</IlcDisableReflection>
16-
<StripSymbols>true</StripSymbols>
179
</PropertyGroup>
1810

1911
<ItemGroup>
20-
<PackageReference Include="AngouriMath" Version="10.0.0-master-1664389750-0b77b8d" />
12+
<PackageReference Include="AngouriMath" Version="1.4-preview.3" />
2113
<Compile Remove="**/publishing/**" />
2214
</ItemGroup>
2315

‎Makefile‎

Lines changed: 0 additions & 11 deletions
This file was deleted.

‎NuGet.Config‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
<packageSources>
44
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
55
<clear />
6-
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
7-
<add key="dotnet-experimental" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json" />
86
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
97
<add key="myget" value="https://www.myget.org/F/angourimath/api/v3/index.json" />
108
</packageSources>

‎README‎

Lines changed: 0 additions & 146 deletions
This file was deleted.

‎README‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
amcli.1

‎amcli.1‎

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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)

‎build.sh‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,19 @@ fi
77
rm -r bin
88
rm -r obj
99

10+
# dotnet publish \
1011
dotnet publish \
1112
-r $1 \
1213
-c release \
1314
-o ./publish-output \
15+
-p:SelfContained=true \
16+
-p:PublishAot=true \
17+
-p:PublishTrimmed=true \
18+
-p:TrimMode=full \
19+
-p:IlcInvariantGlobalization=true \
20+
-p:IlcOptimizationPreference=Speed \
21+
-p:IlcDisableReflection=false \
22+
-p:StripSymbols=true \
1423
-p:Version=$(cat ./VERSION/VERSION)
1524

1625
mv ./publish-output/CLI ./publish-output/amcli

‎deps.nix‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{ fetchNuGet }:
2+
[
3+
(fetchNuGet { pname = "AngouriMath"; version = "1.4-preview.3"; sha256 = "sha256-3dshHCoJXXYjGK/fyfHcXRrg9sw1jVY41JMXfeWQESE="; })
4+
(fetchNuGet { pname = "Antlr4.Runtime.Standard"; version = "4.9.2"; sha256 = "sha256-DmkQMkacJyzmTvnSWJ0RHu/NuhWj/DlpnKJofGDioT0="; })
5+
(fetchNuGet { pname = "GenericTensor"; version = "1.0.4"; sha256 = "sha256-UdVaEPlgFHZ2Qmrp3kZQG8StMjSMEDncz+QzE0TRoio="; })
6+
(fetchNuGet { pname = "HonkSharp"; version = "1.0.3"; sha256 = "sha256-5IbhkOI/Or5H17WeepbeTOs2iRPf/JLfroi3ep4o0CY="; })
7+
(fetchNuGet { pname = "PeterO.Numbers"; version = "1.8.0"; sha256 = "sha256-kCP+s7atwFqHbCorA8Mhos9rfxlSXYDWtTtsD1glhWg="; })
8+
]

‎flake.lock‎

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)