4个版本
0.2.1 | 2024年5月23日 |
---|---|
0.2.0 | 2024年5月22日 |
0.1.1 | 2024年4月14日 |
0.1.0 | 2024年3月29日 |
#178 in 数学
2.5MB
400 行
math_repl是一个CLI REPL,允许用户快速计算表达式,将结果保存到变量中,并在另一个表达式或方程中使用这些变量。它还允许用户解方程,将结果保存到变量中,并在任何地方使用它们。所有步骤都会被记录,并可以导出为LaTeX(见下文使用说明)。
math_repl不仅支持数字,还支持向量和矩阵。
⚠️ math_repl基于math_utils_lib构建,它尚未达到1.0.0版本。预期会有破坏性更改和错误。
展示
安装
您可以从crates.io安装math_repl。
cargo install math_repl
请确保~/.cargo/bin在PATH中。
使用说明
以下是从内部帮助命令中获取的一些使用信息
You can do 4 basic operations:
Calculate something: <expr>
Save the results of a calculation to a variable: <varName> = <expr>
Solve an equation or a system of equations: eq <expr> = <expr> (, <expr> = <expr>, ...)
Solve an equation or a system of equations and save it into a variable: <varName> = eq <expr> = <expr> (, <expr> = <expr>, ...)
As an <expr> counts:
A scalar (number): <number>
A vector: [<1>, <2>, ..., <n>]
A matrix: [[<1:1>, <1:2>, ..., <1:n>], [<2:1>, <2:2>, ..., <2:n>], ..., [<n:1>, <n:2>, ..., <n:n>]] (column major order)
A Variable: Any previously defined variable.
You can also use all common operations (see https://docs.rs/math_utils_lib/latest/math_utils_lib/parser/enum.SimpleOpType.html)
between all different types (It will tell you, when it can't calculate something).
Additionally there are some advanced operations (see https://docs.rs/math_utils_lib/latest/math_utils_lib/parser/enum.AdvancedOpType.html).
Additional commands:
clear: Clears the screen, the history for LaTeX export and all vars except pi and e.
clearvars: Clears all vars except pi and e.
vars: Displays all vars.
export (< --tex | --png >): Exports history since last clear in specified format (leave blank for .pdf).
help: This help page.
exit: Exits the REPL.
Some rules:
Variable Names must start with an alphabetical letter or a \\. (Greek symbols in LaTeX style get replaced before printing).
Numbers in Variable Names are only allowed in LaTeX style subscript.
Any other rules will be explained to you in a (not so) nice manner by the program.
依赖项
~2–9.5MB
~84K SLoC