daisy/README.md

86 lines
2.8 KiB
Markdown
Raw Permalink Normal View History

2023-09-22 10:08:10 -07:00
![](./server/site/resources/readme-banner.png)
2023-03-25 21:38:59 -07:00
2023-11-27 14:00:14 -08:00
A pretty, general-purpose scientific calculator with support for units, derivatives, and more.
2023-04-06 10:39:36 -07:00
Many features are missing, this is still under development.
**Web demo: [here](https://daisy.betalupi.com) (won't work on mobile)**
2023-09-21 19:32:44 -07:00
2023-08-01 20:14:03 -07:00
# 📦 Installation
2023-10-14 09:43:48 -07:00
- **From source:** `cargo build --release`, binary will be at `./target/release/daisy`
2023-08-16 22:44:54 -07:00
- **Cargo:** `cargo install daisycalc`
2023-08-01 20:14:03 -07:00
- **Arch:** `yay -S daisy`
- **Debian:** coming soon
2023-10-14 09:43:48 -07:00
- **Nix:** Use `default.nix`. Daisy isn't in nixpkgs yet, you'll need to add something like the following to `configuration.nix`:
```nix
2023-10-15 09:30:32 -07:00
let
daisy = builtins.fetchGit {
url = "https://github.com/rm-dr/daisy.git";
ref = "master";
} + /default.nix;
in
{
environment.systemPackages = with pkgs; [
(callPackage daisy { })
];
}
2023-10-14 09:43:48 -07:00
```
2023-08-01 20:14:03 -07:00
# 📹 Screenshot
2023-08-05 15:11:32 -07:00
![Screenshot](https://github.com/rm-dr/daisy/assets/96270320/cc71887a-0fde-46b2-a13b-96b05098b158)
2023-04-06 10:39:36 -07:00
2023-08-01 20:14:03 -07:00
# 🛠️ Features
2023-08-01 11:02:34 -07:00
- Open-source
2023-10-15 11:42:40 -07:00
- Carefully designed and easy-to-read prompt
2023-08-01 11:02:34 -07:00
- 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
2023-08-01 20:14:03 -07:00
# 📑 Usage
2023-08-01 11:02:34 -07:00
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`
2023-08-01 20:14:03 -07:00
# 🌹 Additional Notes
2023-08-01 11:02:34 -07:00
## 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.
2023-08-02 11:51:04 -07:00
## 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`
2023-10-15 12:07:09 -07:00
Functions `FtoC` and `CtoF` are also provided:
- `FtoC(x) = toCelsius(fromFahrenheit(x))`
- `CtoF(x) = toFahrenheit(fromCelsius(x))`
2023-08-02 11:51:04 -07:00
2023-08-01 11:02:34 -07:00
## Multiplication Order
2023-08-05 14:01:04 -07:00
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.