Crates.io | taschenrechner |
lib.rs | taschenrechner |
version | 0.2.5 |
source | src |
created_at | 2021-03-08 15:10:48.465989 |
updated_at | 2021-08-19 15:42:09.305641 |
description | Computer-Algebra-System including a REPL. |
homepage | |
repository | |
max_upload_size | |
id | 365712 |
size | 86,105 |
Taschenrechner
– Computer-Algebra-System :leftwards_arrow_with_hook:A
CAS
is an advanced symbolic calculator. It can evaluate, simplify, differentiate, integrate and solve algebraic expressions. This is a crate written in Rust.
Warning: This is not yet feature-complete. See libqalculate for a better alternative.
The current eval is not very sophisticated. It is functional, but can't simplify any expressions, if a subexpression remains unresolved.
This crate comes with an interactive comand-line-interface: Read-Eval-Print-Loop.
use cas::prelude::*;
fn main() {
REPL::start();
}
(for a full complete list see default_env.txt
)
π
(pi), τ
(tau), e
(eurler's number), inf
(infinity), nan
(not a number)sin
, cos
, tan
, their inverse and hyperboleabs
, ceil
, floor
, trunc
, fract
Also see my blog post!
4.3 - π^2 = sin y
is an algebraic expression. It consists of atoms (4.3, π, 2, y
) and operators (-, ^, =, sin
). Operators manipulate atoms. We normally write such expressions in infix-notaion, where one has to know the precedence and associativity of an operator. The exponent (^
) must be evaluated before the the substraction (-
), evon though it appears later. To evaluate the expression linearly, it has to be converted into polish noation, which is basicly a single function call of function calls (= - 4.3 ^ π 2 sin y
).
To evaluate the string of an expression, it undergoes 3 steps:
4.3, -, π, ^, 2, =, sin, y
)