Skip to main content

A Python module for calculating The Ideal Gas Law, focusing make it easy and high school-friendly

Project description

💨Ideal Gas Module

Calculating The Ideal Gas Law in python, focusing make it easy and high school-friendly

🐍Language

Pure Python version >= 3.10

☕Features

Unit

  • Pressure atm, Torr and mmHg
  • Volume ml, cm3, L and dm3
  • Mole mol
  • Temperature C and K
  • Gram g and kg
  • Molar mass g/mol
  • Density g/L
  • Molarity mol/dm3 and mol/L

Default Mode

Gas Constant (R) 0.082057 Kelvin (K) 273.15

School Mode

Gas Constant (R) 0.0821 Kelvin (K) 273

Function

  • PV=nRT
  • PV=(g/M)RT
  • PV=dRT
  • P=MRT

⚙️Install

pip install ideal-gas

📃Example

PV = nRT

from ideal_gas import PVnRT, Volume, Mole, Temperature
# Pressure, Volume, Mole, Temperature

gas = PVnRT(
    volume=Volume(volume=7600, unit="ml"),
    mole=Mole(mole=8, unit="mol"),
    temperature=Temperature(temperature=27, unit="C", school_mode=False),
)

# Pressure ~ 25.92569
print(gas.calculate_pressure)

PV = (g/M)RT

from ideal_gas import PVgMRT, Volume, Gram, MolarMass, Temperature
# Pressure, Volume, Gram, MolarMass, Temperature

gas = PVgMRT(
    volume=Volume(volume=400, unit="ml"),
    gram=Gram(gram=5, unit="kg"),
    molar_mass=MolarMass(molar_mass=4, unit="g/mol"),
    temperature=Temperature(temperature=298, unit="K", school_mode=False),
)

# Pressure ~ 76415.58125
print(gas.calculate_pressure)

PV = dRT

from ideal_gas import PVdRT, Volume, Density, Temperature
# Pressure, Volume, Density, Temperature

gas = PVdRT(
    volume=Volume(volume=800, unit="ml"),
    density=Density(density=2, unit="g/L"),
    temperature=Temperature(temperature=300, unit="K", school_mode=False),
)

# Pressure ~ 61.54275
print(gas.calculate_pressure)

P = MRT

from ideal_gas import PMRT, Molarity, Temperature
# Pressure, Molarity, Temperature

gas = PMRT(
    molarity=Molarity(molarity=7, unit="mol/L"),
    temperature=Temperature(temperature=300, unit="K", school_mode=False),
)

# Pressure ~ 172.3197
print(gas.calculate_pressure)

Mode Gas Constant

from ideal_gas import PVnRT, Volume, Mole, Temperature, GasConstant
# Pressure, Volume, Mole, Temperature

gas = PVnRT(
    volume=Volume(volume=7600, unit="ml"),
    mole=Mole(mole=8, unit="mol"),
    temperature=Temperature(temperature=27, unit="C", school_mode=False),
    gas_constant=GasConstant(school_mode=False)

    #gas_constant=GasConstant() [ Default Mode ]
    #gas_constant=GasConstant(school_mode=True) [School Mode]

)

# Pressure ~ 25.925693
print(gas.calculate_pressure)

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

ideal_gas-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

ideal_gas-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file ideal_gas-0.1.0.tar.gz.

File metadata

  • Download URL: ideal_gas-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for ideal_gas-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ddda15bb7f6a6a8041ee7894e9b419e4e5679c6fb387a8c08991aed13249a9de
MD5 4274715dc7d4d2d3d147f1f81636c8f7
BLAKE2b-256 757c58d7370a16dc919de938c0c4fef4afcb94e9fceba8a5c9b3d3806465b65d

See more details on using hashes here.

File details

Details for the file ideal_gas-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ideal_gas-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for ideal_gas-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01d70d631c6c1048a82c365c46d61569ac98f71bf89ff4ab9b01bce43baa8c22
MD5 c5f4c4c746fffba03b8cba19da04f7cd
BLAKE2b-256 7178fbd0b6b3581df362f0c64b669da392bdf3abfcca621a18ec15f5bdb4f81b

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