Lightweight probabilistic calculator that lets you type ranges (with ~) and arithmetic to see exact bounds plus simulated outcomes and a text histogram.
Deployed at: https://calc.pythonic.ninja
- Install prerequisites:
node(v18+ fornode:test) andpython3for the simple dev server. - Run
make devthen openhttp://localhost:8000(override port withDEV_PORT=9000 make dev). - Run
make testto execute the Node unit tests.
index.html— UI shell that loads Tailwind and the calculator script.main.js— all calculator logic (tokenizer, shunting yard with unary minus, evaluator, histogram) shared by browser and tests.tests/main.test.js— minimalnode:testsuite covering tokenization, unary minus handling, precedence, and range evaluation.Makefile— quick commands for local dev and tests.
flowchart TD
A[User Input] --> B[tokenize]
B --> C[shuntingYard to RPN]
C --> D[evalRpn UncertainValue]
D --> E[formatNumber getQuantiles generateTextHistogram]
E --> F[DOM render main.js browser handlers]
subgraph Tests
B
C
D
end
make dev— serve the app viapython3 -m http.server $(DEV_PORT)(defaults to 8000).make test— run the Node test suite (node --test tests).