#repl #mathcli

app math_repl

Simple REPL for all different kinds of math

2 releases

0.1.1 Apr 14, 2024
0.1.0 Mar 29, 2024

#109 in Math

Download history 114/week @ 2024-03-24 39/week @ 2024-03-31 2/week @ 2024-04-07 149/week @ 2024-04-14

304 downloads per month

Custom license

2.5MB
386 lines

math_repl banner

crates.io docs.rs

math_repl is a CLI REPL that allows a user to quickly calculate expressions, save the results in variables and use those variables in another expression or equation. It additionally allows a user to solve equations, save its results in variables and use them anywhere. All steps that are taken are recorded and can be exported to LaTeX (see Usage below).

math_repl does not only support numbers but also vectors and matrices.

⚠️ math_repl is built on top of math_utils_lib, which has not yet reached 1.0.0. Expect breaking changes and bugs.

Showcase

A Gif Showcase of the REPL

Installation

You can install math_repl from crates.io.

cargo install math_repl

Make sure that ~/.cargo/bin is on PATH.

Usage

Here is some usage information from the internal help command:

Usage:
    You can do 4 basic operations:
        Calculate something: <expr>
        Save the results of a calculation to a variable: <varName> = <expr>
        Solve an equation (using x as variable to solve for): eq <expr> = <expr>
        Solve an equation and save it into a variable (using <varName> as variable to solve for): <varName> = eq <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>]]
        A Variable: Any previously defined variable.

        You can also use all common operations (see https://docs.rs/math_utils_lib/0.2.0/math_utils_lib/parser/enum.SimpleOpType.html)
        between all different types (It will tell you, when it can't calculate something).
        And more advanced operations such as integrals and derivatives (see https://docs.rs/math_utils_lib/0.2.0/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.

Dependencies

~1.6–10MB
~87K SLoC