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

ID Name Category
ideal-gas Ideal Gas Law Thermodynamics
ohms-law Ohm's Law Electrical
mohrs-circle Mohr's Circle Structural
gear-ratio Gear Ratio Mechanical
heat-transfer Heat Transfer Thermodynamics
column-buckling Column Buckling Structural
stress-strain Stress & Strain Structural
beam Beam Analysis Structural
pipe-flow Pipe Flow Fluid Mechanics
unit-converter Unit Converter General

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.0.tar.gz (67.6 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.0-py3-none-any.whl (89.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: phaxor-1.0.0.tar.gz
  • Upload date:
  • Size: 67.6 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.0.tar.gz
Algorithm Hash digest
SHA256 0f8db3b4226986c7cd83d51e6c1a8ee8a92e6a910925242fde6fe360aa2a4ef2
MD5 eaf42885fed4ba3bb72128e239d40a0f
BLAKE2b-256 40e58d1ebfbca2a50b6c6f56b2c5e1ac32183332e918c6088a8c9f3df1ef8ea3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: phaxor-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 89.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8dfad7edf14294272475f33db144b4f4e2f6d4280d6a2df242421c3e221e554e
MD5 b2bb989089665ddfd4ba387885b4030c
BLAKE2b-256 b272ed98f341513dc873f7475cf21921d9ef35412a1a30d596f25f2c459b1c85

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