physics-formulas-uttax 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: physics-formulas-uttax
3
+ Version: 0.1.0
4
+ Summary: High school physics formulas library
5
+ Author: Uttax
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+
9
+ # Physics Formulas
10
+
11
+ A Python library containing 100+ physics formulas.
12
+
13
+ ## Installation
14
+ pip install physics-formulas-uttax
15
+
16
+ ## Usage
17
+ import physics_formulas as pf
18
+
19
+ pf.force(10, 9.8)
@@ -0,0 +1,11 @@
1
+ # Physics Formulas
2
+
3
+ A Python library containing 100+ physics formulas.
4
+
5
+ ## Installation
6
+ pip install physics-formulas-uttax
7
+
8
+ ## Usage
9
+ import physics_formulas as pf
10
+
11
+ pf.force(10, 9.8)
@@ -0,0 +1,62 @@
1
+ # Mechanics
2
+ from .mechanics import (
3
+ force, weight, momentum, impulse,
4
+ kinetic_energy, potential_energy,
5
+ work, power, gravitational_force
6
+ )
7
+
8
+ # Kinematics
9
+ from .kinematics import velocity, acceleration
10
+
11
+ # Electricity
12
+ from .electricity import (
13
+ voltage, current, resistance,
14
+ electric_power, power_resistance, power_voltage
15
+ )
16
+
17
+ # Thermodynamics
18
+ from .thermodynamics import heat, ideal_gas_pressure, efficiency
19
+
20
+ # Optics
21
+ from .optics import mirror_formula, magnification
22
+
23
+ # Magnetism
24
+ from .magnetism import magnetic_force, force_on_wire
25
+
26
+ # Modern Physics
27
+ from .modern_physics import photon_energy, energy_mass, wavelength_from_energy
28
+
29
+ # Modules (optional access)
30
+ from . import mechanics, kinematics, electricity, thermodynamics
31
+ from . import optics, magnetism, modern_physics, constants
32
+
33
+ __all__ = [
34
+ # Mechanics
35
+ "force", "weight", "momentum", "impulse",
36
+ "kinetic_energy", "potential_energy",
37
+ "work", "power", "gravitational_force",
38
+
39
+ # Kinematics
40
+ "velocity", "acceleration",
41
+
42
+ # Electricity
43
+ "voltage", "current", "resistance",
44
+ "electric_power", "power_resistance", "power_voltage",
45
+
46
+ # Thermodynamics
47
+ "heat", "ideal_gas_pressure", "efficiency",
48
+
49
+ # Optics
50
+ "mirror_formula", "magnification",
51
+
52
+ # Magnetism
53
+ "magnetic_force", "force_on_wire",
54
+
55
+ # Modern Physics
56
+ "photon_energy", "energy_mass", "wavelength_from_energy",
57
+
58
+ # Modules
59
+ "mechanics", "kinematics", "electricity",
60
+ "thermodynamics", "optics", "magnetism",
61
+ "modern_physics", "constants"
62
+ ]
@@ -0,0 +1,8 @@
1
+ G = 6.67430e-11
2
+ g = 9.80665
3
+ c = 3.0e8
4
+ h = 6.626e-34
5
+ k = 1.38e-23
6
+ epsilon_0 = 8.854e-12
7
+ mu_0 = 4 * 3.141592653589793e-7
8
+ R = 8.314
@@ -0,0 +1,27 @@
1
+ from .utils import validate_nonzero
2
+
3
+ def voltage(current: float, resistance: float) -> float:
4
+ """V = IR"""
5
+ return current * resistance
6
+
7
+ def current(voltage: float, resistance: float) -> float:
8
+ """I = V / R"""
9
+ validate_nonzero(resistance=resistance)
10
+ return voltage / resistance
11
+
12
+ def resistance(voltage: float, current: float) -> float:
13
+ """R = V / I"""
14
+ validate_nonzero(current=current)
15
+ return voltage / current
16
+
17
+ def electric_power(voltage: float, current: float) -> float:
18
+ """P = VI"""
19
+ return voltage * current
20
+
21
+ def power_resistance(current: float, resistance: float) -> float:
22
+ """P = I^2 R"""
23
+ return current**2 * resistance
24
+
25
+ def power_voltage(voltage: float, resistance: float) -> float:
26
+ """P = V^2 / R"""
27
+ return voltage**2 / resistance
@@ -0,0 +1,23 @@
1
+ from .utils import validate_nonzero
2
+
3
+ def velocity(displacement: float, time: float) -> float:
4
+ """v = s / t"""
5
+ validate_nonzero(time=time)
6
+ return displacement / time
7
+
8
+ def acceleration(v_final: float, v_initial: float, time: float) -> float:
9
+ """a = (v - u) / t"""
10
+ validate_nonzero(time=time)
11
+ return (v_final - v_initial) / time
12
+
13
+ def final_velocity(u: float, a: float, t: float) -> float:
14
+ """v = u + at"""
15
+ return u + a * t
16
+
17
+ def displacement(u: float, t: float, a: float) -> float:
18
+ """s = ut + 0.5at^2"""
19
+ return u * t + 0.5 * a * t**2
20
+
21
+ def velocity_squared(u: float, a: float, s: float) -> float:
22
+ """v^2 = u^2 + 2as"""
23
+ return u**2 + 2 * a * s
@@ -0,0 +1,9 @@
1
+ def magnetic_force(q: float, v: float, B: float, theta: float) -> float:
2
+ """F = qvB sin(theta)"""
3
+ import math
4
+ return q * v * B * math.sin(math.radians(theta))
5
+
6
+ def force_on_wire(I: float, L: float, B: float, theta: float) -> float:
7
+ """F = BIL sin(theta)"""
8
+ import math
9
+ return B * I * L * math.sin(math.radians(theta))
@@ -0,0 +1,41 @@
1
+ from .constants import g, G
2
+ from .utils import validate_nonzero
3
+
4
+ def force(mass: float, acceleration: float) -> float:
5
+ """F = ma"""
6
+ return mass * acceleration
7
+
8
+ def weight(mass: float) -> float:
9
+ """W = mg"""
10
+ return mass * g
11
+
12
+ def momentum(mass: float, velocity: float) -> float:
13
+ """p = mv"""
14
+ return mass * velocity
15
+
16
+ def impulse(force: float, time: float) -> float:
17
+ """J = Ft"""
18
+ return force * time
19
+
20
+ def kinetic_energy(mass: float, velocity: float) -> float:
21
+ """KE = 1/2 mv^2"""
22
+ return 0.5 * mass * velocity**2
23
+
24
+ def potential_energy(mass: float, height: float) -> float:
25
+ """PE = mgh"""
26
+ return mass * g * height
27
+
28
+ def work(force: float, displacement: float, angle: float = 0) -> float:
29
+ """W = F s cos(theta)"""
30
+ import math
31
+ return force * displacement * math.cos(math.radians(angle))
32
+
33
+ def power(work: float, time: float) -> float:
34
+ """P = W / t"""
35
+ validate_nonzero(time=time)
36
+ return work / time
37
+
38
+ def gravitational_force(m1: float, m2: float, r: float) -> float:
39
+ """F = G m1 m2 / r^2"""
40
+ validate_nonzero(r=r)
41
+ return G * m1 * m2 / r**2
@@ -0,0 +1,13 @@
1
+ from .constants import h, c
2
+
3
+ def photon_energy(frequency: float) -> float:
4
+ """E = hf"""
5
+ return h * frequency
6
+
7
+ def energy_mass(mass: float) -> float:
8
+ """E = mc^2"""
9
+ return mass * c**2
10
+
11
+ def wavelength_from_energy(E: float) -> float:
12
+ """λ = hc / E"""
13
+ return (h * c) / E
@@ -0,0 +1,7 @@
1
+ def mirror_formula(f: float, u: float) -> float:
2
+ """1/f = 1/v + 1/u → returns v"""
3
+ return 1 / ((1 / f) - (1 / u))
4
+
5
+ def magnification(v: float, u: float) -> float:
6
+ """m = v/u"""
7
+ return v / u
@@ -0,0 +1,13 @@
1
+ from .constants import R
2
+
3
+ def heat(m: float, c: float, dT: float) -> float:
4
+ """Q = mcΔT"""
5
+ return m * c * dT
6
+
7
+ def ideal_gas_pressure(n: float, T: float, V: float) -> float:
8
+ """P = nRT / V"""
9
+ return n * R * T / V
10
+
11
+ def efficiency(output: float, input_energy: float) -> float:
12
+ """η = output/input * 100"""
13
+ return (output / input_energy) * 100
@@ -0,0 +1,9 @@
1
+ def validate_positive(**kwargs):
2
+ for name, value in kwargs.items():
3
+ if value <= 0:
4
+ raise ValueError(f"{name} must be positive, got {value}")
5
+
6
+ def validate_nonzero(**kwargs):
7
+ for name, value in kwargs.items():
8
+ if value == 0:
9
+ raise ValueError(f"{name} must not be zero")
@@ -0,0 +1,11 @@
1
+ def wave_speed(frequency: float, wavelength: float) -> float:
2
+ """v = fλ"""
3
+ return frequency * wavelength
4
+
5
+ def frequency(speed: float, wavelength: float) -> float:
6
+ """f = v / λ"""
7
+ return speed / wavelength
8
+
9
+ def wavelength(speed: float, frequency: float) -> float:
10
+ """λ = v / f"""
11
+ return speed / frequency
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: physics-formulas-uttax
3
+ Version: 0.1.0
4
+ Summary: High school physics formulas library
5
+ Author: Uttax
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+
9
+ # Physics Formulas
10
+
11
+ A Python library containing 100+ physics formulas.
12
+
13
+ ## Installation
14
+ pip install physics-formulas-uttax
15
+
16
+ ## Usage
17
+ import physics_formulas as pf
18
+
19
+ pf.force(10, 9.8)
@@ -0,0 +1,17 @@
1
+ README.md
2
+ pyproject.toml
3
+ physics_formulas/__init__.py
4
+ physics_formulas/constants.py
5
+ physics_formulas/electricity.py
6
+ physics_formulas/kinematics.py
7
+ physics_formulas/magnetism.py
8
+ physics_formulas/mechanics.py
9
+ physics_formulas/modern_physics.py
10
+ physics_formulas/optics.py
11
+ physics_formulas/thermodynamics.py
12
+ physics_formulas/utils.py
13
+ physics_formulas/waves.py
14
+ physics_formulas_uttax.egg-info/PKG-INFO
15
+ physics_formulas_uttax.egg-info/SOURCES.txt
16
+ physics_formulas_uttax.egg-info/dependency_links.txt
17
+ physics_formulas_uttax.egg-info/top_level.txt
@@ -0,0 +1,14 @@
1
+ [project]
2
+ name = "physics-formulas-uttax" # MUST be unique on PyPI
3
+ version = "0.1.0"
4
+ description = "High school physics formulas library"
5
+ authors = [
6
+ { name="Uttax" }
7
+ ]
8
+ readme = "README.md"
9
+ requires-python = ">=3.8"
10
+ dependencies = []
11
+
12
+ [build-system]
13
+ requires = ["setuptools>=61.0"]
14
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+