Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nexus Engineering Calculator

A modern engineering calculator built with FastAPI and a responsive static web UI.

Features

  • Degree, radian, and gradian angle modes
  • Arithmetic, powers, percentages, logarithms, trigonometric functions, roots, factorials, and engineering constants
  • Calculation history and memory keys in the browser
  • Safe expression evaluation without Python eval
  • JSON API at POST /api/calc

Run locally

Create and activate a virtual environment, then install the dependencies:

python -m venv .venv
source .venv/bin/activate       # Windows: .venv\\Scripts\\activate
python -m pip install -r requirements.txt

Start the server:

uvicorn calculator:app --reload

Open http://127.0.0.1:8000 in your browser.

API usage

Send an expression to the calculation endpoint:

curl -X POST http://127.0.0.1:8000/api/calc \
  -H "Content-Type: application/json" \
  -d '{"expression":"sin(30) + sqrt(16) * 2","angle_mode":"DEG"}'

Response:

{
  "expression": "sin(30) + sqrt(16) * 2",
  "result": 8.5,
  "formatted": "8.5",
  "angle_mode": "DEG"
}

The request supports DEG, RAD, and GRAD angle modes. Previous results can be supplied using the ans field.

Supported functions and constants

Functions include sin, cos, tan, asin, acos, atan, log, log10, ln, sqrt, cbrt, abs, exp, floor, ceil, factorial, hypot, sinh, cosh, and tanh where applicable.

Constants include pi, e, tau, phi, and ans. The UI also provides quick-access values for the speed of light and standard gravity.

Project structure

calculator.py       FastAPI app and safe calculation engine
Calculator.py       Compatibility entrypoint
static/index.html   Calculator interface
static/styles.css   UI styling
static/app.js       UI behavior and API client
requirements.txt    Python dependencies

License

✌️

About

A modern engineering and scientific calculator built with Python, FastAPI and JavaScript.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages