Skip to main content

Engineering Calculator Library — Ideal Gas, Ohm's Law, Mohr's Circle, Beam Analysis, and more with rich Jupyter output

Project description

🔬 Phaxor — Engineering Calculator Library

Embeddable engineering calculations for JavaScript and Python.

Install

pip install phaxor

Quick Start

import phaxor

# Ideal Gas Law
result = phaxor.compute('ideal-gas', {
    'solveFor': 'pressure',
    'volume': 0.02241,
    'moles': 1,
    'temperature': 273.15,
    'gas': 'air'
})
print(f"Pressure = {result['P']:.0f} Pa")  # 101325 Pa

# Ohm's Law
result = phaxor.compute('ohms-law', {
    'solveFor': 'I',
    'voltage': 12,
    'resistance': 100
})
print(f"Current = {result['I']} A")  # 0.12 A

# Unit Conversion
km = phaxor.convert('length', 1, 'mi', 'km')
print(f"1 mile = {km:.6f} km")  # 1.609344 km

# Mohr's Circle
result = phaxor.compute('mohrs-circle', {
    'sigmaX': 80,
    'sigmaY': -40,
    'tauXY': 30,
    'theta': 25
})
print(f"σ₁ = {result['sigma1']:.1f} MPa")

# List all calculators
for calc in phaxor.list_calculators():
    print(f"  {calc['id']:20s} {calc['name']}")

Available Calculators (All 74 Engines)

ID Name Category
arrhenius Arrhenius Chemical
cstr CSTR Design Chemical
chem-equilibrium Chem Equilibrium Chemical
distillation Distillation Chemical
gibbs Gibbs Chemical
pfr PFR Design Chemical
packed-bed Packed Bed Chemical
stoichiometry Stoichiometry Chemical
vle VLE / Phase Equilibrium Chemical
battery-ups Battery Ups Electrical
cable-sizing Cable Sizing Electrical
circuit-breaker Circuit Breaker Electrical
dc-motor DC Motor Electrical
earthing Earthing Electrical
electrical-efficiency Electrical Efficiency Electrical
energy-consumption Energy Consumption Electrical
impedance Impedance Electrical
induction-motor Induction Motor Electrical
ohms-law Ohm's Law Electrical
power Power Electrical
pf-correction Power Factor Correction Electrical
rectifier Rectifier Electrical
resonance Resonance Electrical
short-circuit Short Circuit Electrical
solar-sizing Solar Sizing Electrical
transformer Transformer Electrical
geometry Geometry General
matrix Matrix General
unit-converter Unit Converter General
open-channel Open Channel Flow Hydraulics
pavement-thickness Pavement Thickness Hydraulics
sight-distance Sight Distance Hydraulics
weir-orifice Weir & Orifice Hydraulics
apf Atomic Packing Factor Materials
corrosion Corrosion Materials
fatigue-life Fatigue Life Materials
hardness-conversion Hardness Conversion Materials
rule-of-mixtures Rule of Mixtures Materials
beam Beam Mechanical
bearing-life Bearing Life Mechanical
belt-drive Belt Drive Mechanical
bolt-analysis Bolt Analysis Mechanical
cop Coefficient of Performance Mechanical
flywheel Flywheel Mechanical
gear-ratio Gear Ratio Mechanical
heat-exchanger Heat Exchanger Mechanical
heat-transfer Heat Transfer Mechanical
ideal-gas Ideal Gas Law Mechanical
pipe-flow Pipe Flow Mechanical
pressure-force Pressure Force Mechanical
pump-power Pump Power Mechanical
rankine-cycle Rankine Cycle Mechanical
shaft-design Shaft Design Mechanical
spring-design Spring Design Mechanical
torque-power Torque Power Mechanical
vibration Vibration Mechanical
weld-strength Weld Strength Mechanical
beam-deflection Beam Deflection Structural
bearing-capacity Bearing Capacity Structural
column-buckling Column Buckling Structural
concrete-volume Concrete Volume Structural
development-length Development Length Structural
earth-pressure Earth Pressure Structural
failure-theory Failure Theory Structural
isolated-footing Isolated Footing Structural
mohrs-circle Mohr's Circle Structural
rcc-beam RCC Beam Design Structural
rcc-column RCC Column Design Structural
rcc-slab RCC Slab Design Structural
reinforcement-qty Reinforcement Qty Structural
settlement Settlement Structural
soil-properties Soil Properties Structural
steel-weight Steel Weight Structural
stress-strain Stress Strain Structural

Pipe Flow (Detailed Model)

import phaxor

# Pressure-driven solve using NPS + Schedule diameter lookup
result = phaxor.compute('pipe-flow', {
    'solveMode': 'known-pressures',
    'nps': '4',
    'schedule': '40',
    'length': 120,
    'roughness': 0.000045,
    'minorLossK': 6.5,
    'elevationChange': 5,
    'inletPressure': 220,   # kPa gauge
    'outletPressure': 0,    # kPa gauge
    'density': 998,
    'viscosity': 0.001002
})

print(f"Q = {result['flowRate']*3600:.2f} m3/h")
print(f"ID source = {result['diameterSource']}")
print(f"Delta P = {result['pressureDeltaKPa']:.2f} kPa")

The pipe-flow engine now supports:

  • known-flow and known-pressures boundary modes
  • Flow input by volumetric flow, mass flow, or velocity
  • Minor loss (K) and elevation/pump head terms
  • Pipe sizing by direct diameter or nps + schedule
  • Extended outputs (major/minor loss split, power estimates, turbulence initialization fields)

Jupyter Notebooks

In Jupyter, calling phaxor.compute() automatically renders a styled HTML table:

import phaxor

# This renders a beautiful HTML table in Jupyter!
phaxor.compute('ideal-gas', {
    'solveFor': 'pressure',
    'volume': 0.02241,
    'moles': 1,
    'temperature': 273.15,
})

API

phaxor.compute(calculator_type, inputs)  # Run any calculator
phaxor.convert(category, value, from_unit, to_unit)  # Unit conversion
phaxor.list_calculators()  # List all available calculators

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phaxor-1.0.2.tar.gz (69.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phaxor-1.0.2-py3-none-any.whl (90.4 kB view details)

Uploaded Python 3

File details

Details for the file phaxor-1.0.2.tar.gz.

File metadata

  • Download URL: phaxor-1.0.2.tar.gz
  • Upload date:
  • Size: 69.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for phaxor-1.0.2.tar.gz
Algorithm Hash digest
SHA256 cc9d99734427b27219e043fc3a9912e776b6e897f7a89914511c8aa92f42f827
MD5 086e8fa765fac4c0cd2dec49f85f712b
BLAKE2b-256 6fe46acd19653c2d31f677ef66f462d477a1bb878021ae6d84ec0c1cc418fddb

See more details on using hashes here.

File details

Details for the file phaxor-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: phaxor-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 90.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for phaxor-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 71919457190eb8a1211e61149e48938ce3c88bccaf87c3f526e2bbb5b5dafc25
MD5 c9aa4eefd403c800af0cc197c0f837bc
BLAKE2b-256 bdc99508bbeab79a3b765ebe9f5bacb012de973132d00a7ddcc16e417e96fc4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page