https://github.com/rm-dr/daisy
A pretty TUI scientific calculator.
https://github.com/rm-dr/daisy
calculator mathematical-expressions mathematics parser physics quantities rust science scientific-calculator scientific-computing terminal terminal-based units web-app webapp
Last synced: 16 days ago
JSON representation
A pretty TUI scientific calculator.
- Host: GitHub
- URL: https://github.com/rm-dr/daisy
- Owner: rm-dr
- License: gpl-3.0
- Created: 2023-04-03T04:48:26.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-11-27T22:00:55.000Z (about 2 years ago)
- Last Synced: 2024-01-28T13:12:26.619Z (about 2 years ago)
- Topics: calculator, mathematical-expressions, mathematics, parser, physics, quantities, rust, science, scientific-calculator, scientific-computing, terminal, terminal-based, units, web-app, webapp
- Language: Rust
- Homepage: https://daisy.betalupi.com
- Size: 1.37 MB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.MD
- License: LICENSE
Awesome Lists containing this project
README

A pretty, general-purpose scientific calculator with support for units, derivatives, and more.
Many features are missing, this is still under development.
**Web demo: [here](https://daisy.betalupi.com) (won't work on mobile)**
# 📦 Installation
- **From source:** `cargo build --release`, binary will be at `./target/release/daisy`
- **Cargo:** `cargo install daisycalc`
- **Arch:** `yay -S daisy`
- **Debian:** coming soon
- **Nix:** Use `default.nix`. Daisy isn't in nixpkgs yet, you'll need to add something like the following to `configuration.nix`:
```nix
let
daisy = builtins.fetchGit {
url = "https://github.com/rm-dr/daisy.git";
ref = "master";
} + /default.nix;
in
{
environment.systemPackages = with pkgs; [
(callPackage daisy { })
];
}
```
# 📹 Screenshot

# 🛠️ Features
- Open-source
- Carefully designed and easy-to-read prompt
- Supports many physical units, with metric and binary prefixes
- Supports exponential notation
- Clear syntax, parsed input is always re-printed as a sanity check.
- Useful, detailed error messages
# 📑 Usage
All documentation is built into the prompt. Use the `help` command to view it.
## Evaluate expressions:
- Basic math: ``103 / 2 * 43``
- Functions: ``sqrt(1.4^3 + 4) * sin(pi / 4)``
- Scientific notation: ``1.2e12 * 1e-5``
## Physical units
- Unit operations: ``2 day + 1 hour``
- Unit conversion: ``2 day + 1 hour to minutes``
- Compound units: ``10 m/s to mph``
- Conversion errors: ``1 liter to volt``
## Varables
- Previous answer: `ans + 2`
- Variable assignment: `a = 143`
# 🌹 Additional Notes
## Unit Conversion
The conversion operator `to` converts its left argument to the *unit* of its right argument, ignoring its value. For example, `5m to mi` and `5m to 10mi` are identical.
## Celsius and Fahrenheit
Celsius and Fahrenheit are not supported as first-class units because they require an offset when converting from other temperature units. This leads to ambiguity when adding units, since one temperature must be seen as a *difference* rather than an absolute temperature.
Daisy instead provides four functions (`fromCelsius`, `toCelsius`, `fromFahrenheit`, `toFahrenheit`) which convert between scalars and Kelvin.
- "from" functions take a scalar and return a value in Kelvin: `fromCelsius(0) = 273.15K`
- "to" functions take a value in Kelvin and return a scalar: `toCelsius(273.15 K) = 0`
Functions `FtoC` and `CtoF` are also provided:
- `FtoC(x) = toCelsius(fromFahrenheit(x))`
- `CtoF(x) = toFahrenheit(fromCelsius(x))`
## Multiplication Order
Implicit multiplication has a higher priority than division. `pi/2 radians` will parse as `pi/(2 radians)`. Type `(pi/2) radians` or `pi/2 * radians` to get 90 degrees.