fengshui: improve README

This commit is contained in:
NunoSempere 2024-12-30 23:17:39 +01:00
parent 8720530d4e
commit 6c88fbf2ec
2 changed files with 13 additions and 26 deletions

View File

@ -1,4 +1,4 @@
# A calculator for distributions, for Fermi estimation
# A terminal calculator for distributions, for Fermi estimation
This project is a minimalist, calculator-style DSL for fermi estimation. It can multiply, divide, add and subtract scalars, lognormals and beta distributions, and supports variables.
@ -6,36 +6,21 @@ This project is a minimalist, calculator-style DSL for fermi estimation. It can
Sometimes, [Squiggle](https://github.com/quantified-uncertainty/squiggle), [simple squiggle](https://git.nunosempere.com/quantified.uncertainty/simple-squiggle) or [squiggle.c](https://git.nunosempere.com/personal/squiggle.c) are still too complicated and un-unix-like. In particular, their startup cost is not instant.
## Installation
## Build instructions
Install the [go toolchain](https://go.dev/dl/), then:
```
git clone https://git.nunosempere.com/NunoSempere/fermi
make build
./fermi
sudo make install
fermi
```
## Usage
```
$ fermi
5000000 12000000
=> 5.0M 12.0M
* beta 1 200
=> 1.9K 123.1K
* 30 180
=> 122.9K 11.7M
/ 48 52
=> 2.5K 234.6K
/ 5 6
=> 448.8 43.0K
/ 6 8
=> 64.5 6.2K
/ 60
=> 1.1 103.7
```
Perhaps this example is more understandable with comments and better units:
```
$ fermi
5M 12M # number of people living in Chicago
@ -48,10 +33,12 @@ beta 1 200 # fraction of people that have a piano
=: piano_tuners
```
Here are some real-life examples: [Chance for a Russian male of fighting age of being drafted](https://x.com/NunoSempere/status/1829525844169248912), [did the startup Friend burn too much cash](https://x.com/NunoSempere/status/1818810770932568308), [how much did Nikita Bier make mentoring?](https://x.com/NunoSempere/status/1815169781907042504), [what fraction of North Korea's caloric intake is Russia supporting?](https://x.com/NunoSempere/status/1855666428835140078). In general, as a terminal guy, I've found that having zero startup cost makes creating small fermi models much cheaper, and thus happen more often.
If you type "help" (or run fermi -h), you can see a small grammar and some optional command flags:
```
$ fermi
$ fermi -h
1. Grammar:
Operation | Variable assignment | Special
@ -88,6 +75,7 @@ $ fermi
1 10
+ beta 1 100
)
/ 1%
=. y
mx x 1 y 2.33
+ mx x 30% y 70%
@ -104,12 +92,11 @@ $ fermi
```
You can see real life examples [here](https://x.com/NunoSempere/status/1831106442721452312), [here](https://x.com/NunoSempere/status/1829525844169248912), [here](https://x.com/NunoSempere/status/1818810770932568308), [here](https://x.com/NunoSempere/status/1816605190415401100), [here](https://x.com/NunoSempere/status/1816604386703081894), [here](https://x.com/NunoSempere/status/1815169781907042504)
## Tips & tricks
- It's conceptually clearer to have all the multiplications first and then all the divisions
- For distributions between 0 and 1, consider using a beta distribution
- The default operation is multiplication
### Command line options

View File

@ -2,7 +2,7 @@ build:
go build main/fermi.go main/pretty.go main/error.go
run:
go run fermi.go
go run main/fermi.go main/error.go main/pretty.go
install: fermi
rm /usr/bin/fermi