algebraic-physics 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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Caleb Brooks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: algebraic-physics
3
+ Version: 0.1.0
4
+ Summary: A project for math and geometry formulas
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: numpy>=2.4.6
9
+ Dynamic: license-file
10
+
11
+ # algebraic-physics
12
+
13
+ A Python utility library for geometry and physics calculations based on the AP Physics 1 curriculum.
14
+
15
+ This library provides automated functions to solve for unknown variables using standard introductory mechanics equations. It accepts numerical inputs for known physical quantities to compute values across kinematics, dynamics, energy, momentum, and rotational motion.
16
+
17
+ ## File Directory
18
+
19
+ ```text
20
+ mathformulas/
21
+ │
22
+ ├── .github/
23
+ │ └── workflows/
24
+ │ └── codeql.yml
25
+ │
26
+ ├── assets/
27
+ │ └── ...
28
+ │
29
+ ├── src/
30
+ │ ├── geometry/
31
+ │ │ ├── __pycache__/
32
+ │ │ └── geom.py
33
+ │ │
34
+ │ ├── physics/
35
+ │ │ ├── __pycache__/
36
+ │ │ └── mechanics.py
37
+ │ │
38
+ │ └── mathformulas.egg-info/
39
+ │
40
+ ├── tests/
41
+ │ └── make_cube.py
42
+ │
43
+ ├── .env
44
+ ├── .gitignore
45
+ ├── LICENSE
46
+ ├── pyproject.toml
47
+ ├── README.md
48
+ └── requirements.txt
49
+ ```
50
+
51
+ ## Tests Example
52
+
53
+ The file 'make_cube.py' under tests/ utilizes a dictionary for holding shapes. The square uses 0.0 floats, and relies on mechanics.py functions for calculations.
54
+
55
+ ```python
56
+ #make_cube.py
57
+ import geometry.geom as gm
58
+ import physics.mechanics as pm
59
+
60
+ my_cube = {
61
+ "side": 4, # Side length, note that this can be subbed out for the result of a distance formula between two coordinates
62
+ "mass": 10, # Dummy mass
63
+ "volume": 0,
64
+
65
+ "pos_x": 0.0, # Starts at coordinates (0,0)
66
+ "pos_y": 0.0,
67
+
68
+ "velocity_x": 0.0,
69
+ "velocity_y": 0.0,
70
+ }
71
+ ...
72
+
73
+ # Volume Calculation:
74
+ my_cube["volume"] = gm.cube_volume(my_cube["side"])
75
+ print(f'The volume is {my_cube["volume"]}')
76
+
77
+ ...
78
+
79
+ # Physics Simulation:
80
+ dt = 0.1 # Timestep
81
+ time = 0.0 # Time that increases according to timestep
82
+ max_time = 5.0 # Dummy max_time, in a real simulation this would be undeclared until input
83
+ current_acceleration = 1.0 # Dummy current_acceleration
84
+ speedy_boost = pm.speed_booster(1) # Connects to a speed boost function in 'mechanics.py'
85
+
86
+ while time < max_time:
87
+ current_acceleration = pm.speed_booster(current_acceleration)
88
+
89
+ my_cube["velocity_x"] = pm.find_instantaneous_velocity(
90
+ my_cube["velocity_x"],
91
+ speedy_boost,
92
+ dt
93
+ )
94
+ time += dt
95
+ ```
96
+
97
+ ## Source Formulas
98
+
99
+ ![Mechanics and Fluids](assets/formulas.png)
100
+
101
+ ![Geometry/Conversion](assets/geometry.png)
@@ -0,0 +1,91 @@
1
+ # algebraic-physics
2
+
3
+ A Python utility library for geometry and physics calculations based on the AP Physics 1 curriculum.
4
+
5
+ This library provides automated functions to solve for unknown variables using standard introductory mechanics equations. It accepts numerical inputs for known physical quantities to compute values across kinematics, dynamics, energy, momentum, and rotational motion.
6
+
7
+ ## File Directory
8
+
9
+ ```text
10
+ mathformulas/
11
+ │
12
+ ├── .github/
13
+ │ └── workflows/
14
+ │ └── codeql.yml
15
+ │
16
+ ├── assets/
17
+ │ └── ...
18
+ │
19
+ ├── src/
20
+ │ ├── geometry/
21
+ │ │ ├── __pycache__/
22
+ │ │ └── geom.py
23
+ │ │
24
+ │ ├── physics/
25
+ │ │ ├── __pycache__/
26
+ │ │ └── mechanics.py
27
+ │ │
28
+ │ └── mathformulas.egg-info/
29
+ │
30
+ ├── tests/
31
+ │ └── make_cube.py
32
+ │
33
+ ├── .env
34
+ ├── .gitignore
35
+ ├── LICENSE
36
+ ├── pyproject.toml
37
+ ├── README.md
38
+ └── requirements.txt
39
+ ```
40
+
41
+ ## Tests Example
42
+
43
+ The file 'make_cube.py' under tests/ utilizes a dictionary for holding shapes. The square uses 0.0 floats, and relies on mechanics.py functions for calculations.
44
+
45
+ ```python
46
+ #make_cube.py
47
+ import geometry.geom as gm
48
+ import physics.mechanics as pm
49
+
50
+ my_cube = {
51
+ "side": 4, # Side length, note that this can be subbed out for the result of a distance formula between two coordinates
52
+ "mass": 10, # Dummy mass
53
+ "volume": 0,
54
+
55
+ "pos_x": 0.0, # Starts at coordinates (0,0)
56
+ "pos_y": 0.0,
57
+
58
+ "velocity_x": 0.0,
59
+ "velocity_y": 0.0,
60
+ }
61
+ ...
62
+
63
+ # Volume Calculation:
64
+ my_cube["volume"] = gm.cube_volume(my_cube["side"])
65
+ print(f'The volume is {my_cube["volume"]}')
66
+
67
+ ...
68
+
69
+ # Physics Simulation:
70
+ dt = 0.1 # Timestep
71
+ time = 0.0 # Time that increases according to timestep
72
+ max_time = 5.0 # Dummy max_time, in a real simulation this would be undeclared until input
73
+ current_acceleration = 1.0 # Dummy current_acceleration
74
+ speedy_boost = pm.speed_booster(1) # Connects to a speed boost function in 'mechanics.py'
75
+
76
+ while time < max_time:
77
+ current_acceleration = pm.speed_booster(current_acceleration)
78
+
79
+ my_cube["velocity_x"] = pm.find_instantaneous_velocity(
80
+ my_cube["velocity_x"],
81
+ speedy_boost,
82
+ dt
83
+ )
84
+ time += dt
85
+ ```
86
+
87
+ ## Source Formulas
88
+
89
+ ![Mechanics and Fluids](assets/formulas.png)
90
+
91
+ ![Geometry/Conversion](assets/geometry.png)
@@ -0,0 +1,20 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "algebraic-physics"
7
+ version = "0.1.0"
8
+ description = "A project for math and geometry formulas"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ dependencies = [
12
+ "numpy>=2.4.6"
13
+ ]
14
+
15
+ [tool.setuptools.packages.find]
16
+ where = ["src"]
17
+
18
+ [tool.pytest.ini_options]
19
+ testpaths = ["tests"]
20
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,101 @@
1
+ Metadata-Version: 2.4
2
+ Name: algebraic-physics
3
+ Version: 0.1.0
4
+ Summary: A project for math and geometry formulas
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: numpy>=2.4.6
9
+ Dynamic: license-file
10
+
11
+ # algebraic-physics
12
+
13
+ A Python utility library for geometry and physics calculations based on the AP Physics 1 curriculum.
14
+
15
+ This library provides automated functions to solve for unknown variables using standard introductory mechanics equations. It accepts numerical inputs for known physical quantities to compute values across kinematics, dynamics, energy, momentum, and rotational motion.
16
+
17
+ ## File Directory
18
+
19
+ ```text
20
+ mathformulas/
21
+ │
22
+ ├── .github/
23
+ │ └── workflows/
24
+ │ └── codeql.yml
25
+ │
26
+ ├── assets/
27
+ │ └── ...
28
+ │
29
+ ├── src/
30
+ │ ├── geometry/
31
+ │ │ ├── __pycache__/
32
+ │ │ └── geom.py
33
+ │ │
34
+ │ ├── physics/
35
+ │ │ ├── __pycache__/
36
+ │ │ └── mechanics.py
37
+ │ │
38
+ │ └── mathformulas.egg-info/
39
+ │
40
+ ├── tests/
41
+ │ └── make_cube.py
42
+ │
43
+ ├── .env
44
+ ├── .gitignore
45
+ ├── LICENSE
46
+ ├── pyproject.toml
47
+ ├── README.md
48
+ └── requirements.txt
49
+ ```
50
+
51
+ ## Tests Example
52
+
53
+ The file 'make_cube.py' under tests/ utilizes a dictionary for holding shapes. The square uses 0.0 floats, and relies on mechanics.py functions for calculations.
54
+
55
+ ```python
56
+ #make_cube.py
57
+ import geometry.geom as gm
58
+ import physics.mechanics as pm
59
+
60
+ my_cube = {
61
+ "side": 4, # Side length, note that this can be subbed out for the result of a distance formula between two coordinates
62
+ "mass": 10, # Dummy mass
63
+ "volume": 0,
64
+
65
+ "pos_x": 0.0, # Starts at coordinates (0,0)
66
+ "pos_y": 0.0,
67
+
68
+ "velocity_x": 0.0,
69
+ "velocity_y": 0.0,
70
+ }
71
+ ...
72
+
73
+ # Volume Calculation:
74
+ my_cube["volume"] = gm.cube_volume(my_cube["side"])
75
+ print(f'The volume is {my_cube["volume"]}')
76
+
77
+ ...
78
+
79
+ # Physics Simulation:
80
+ dt = 0.1 # Timestep
81
+ time = 0.0 # Time that increases according to timestep
82
+ max_time = 5.0 # Dummy max_time, in a real simulation this would be undeclared until input
83
+ current_acceleration = 1.0 # Dummy current_acceleration
84
+ speedy_boost = pm.speed_booster(1) # Connects to a speed boost function in 'mechanics.py'
85
+
86
+ while time < max_time:
87
+ current_acceleration = pm.speed_booster(current_acceleration)
88
+
89
+ my_cube["velocity_x"] = pm.find_instantaneous_velocity(
90
+ my_cube["velocity_x"],
91
+ speedy_boost,
92
+ dt
93
+ )
94
+ time += dt
95
+ ```
96
+
97
+ ## Source Formulas
98
+
99
+ ![Mechanics and Fluids](assets/formulas.png)
100
+
101
+ ![Geometry/Conversion](assets/geometry.png)
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/algebraic_physics.egg-info/PKG-INFO
5
+ src/algebraic_physics.egg-info/SOURCES.txt
6
+ src/algebraic_physics.egg-info/dependency_links.txt
7
+ src/algebraic_physics.egg-info/requires.txt
8
+ src/algebraic_physics.egg-info/top_level.txt
9
+ src/geometry/__init__.py
10
+ src/geometry/geom.py
11
+ src/physics/__init__.py
12
+ src/physics/mechanics.py
@@ -0,0 +1,2 @@
1
+ geometry
2
+ physics
@@ -0,0 +1,11 @@
1
+ from .geom import (
2
+ rectangle_area,
3
+ cube_volume,
4
+ triangle_area,
5
+ circle,
6
+ rectangular_solid,
7
+ cylinder,
8
+ sphere,
9
+ arc_relations,
10
+ pythag
11
+ )
@@ -0,0 +1,54 @@
1
+ import numpy as np
2
+
3
+ gravity_m3 = 6.67 * 10**-11
4
+
5
+ one_atm = 1.0 * 10**5
6
+
7
+
8
+ def rectangle_area(length, width):
9
+ return length * width
10
+
11
+
12
+ def cube_volume(side_length):
13
+ volume = side_length**3
14
+ return volume
15
+
16
+
17
+ def triangle_area(base, height):
18
+ return 0.5 * base * height
19
+
20
+
21
+ def circle(radius):
22
+ area = np.pi * (radius**2)
23
+ circumference = 2 * np.pi * radius
24
+
25
+ return area, circumference
26
+
27
+
28
+ def rectangular_solid(length, width, height):
29
+ volume = length * width * height
30
+
31
+ return volume
32
+
33
+
34
+ def cylinder(radius, length):
35
+ volume = np.pi * (radius**2) * length
36
+ surface_area = (2 * np.pi * radius * length) + (2 * np.pi * (radius**2))
37
+
38
+ return volume, surface_area
39
+
40
+
41
+ def sphere(radius):
42
+ volume = 4/3 * np.pi * (radius**3)
43
+ surface_area = 4 * np.pi * (radius**2)
44
+ return volume, surface_area
45
+
46
+
47
+ def arc_relations(r, theta):
48
+ s = r*theta
49
+ return s
50
+
51
+
52
+ def pythag(side1, side2):
53
+ side3 = (side1**2 + side2**2)**(1/2)
54
+ return side3
@@ -0,0 +1,15 @@
1
+ from .mechanics import (
2
+ find_instantaneous_velocity,
3
+ find_position,
4
+ find_velocity_squared,
5
+ center_of_mass,
6
+ total_acceleration,
7
+ newtons_law_of_universal_gravitation,
8
+ kinetic_energy,
9
+ work,
10
+ delta_ke,
11
+ momentum,
12
+ centripetal_acceleration,
13
+ density,
14
+ speed_booster
15
+ )
@@ -0,0 +1,113 @@
1
+ import numpy as np
2
+ import geometry.geom as geom
3
+
4
+ # #1
5
+
6
+
7
+ def find_instantaneous_velocity(initial_velocity, acceleration, time):
8
+
9
+ v_x = initial_velocity + (acceleration * time)
10
+ return v_x
11
+
12
+ # #2
13
+
14
+
15
+ def find_position(inital_position, initial_velocity, time, current_acceleration):
16
+
17
+ x = inital_position + (initial_velocity*time) + \
18
+ ((1/2)*current_acceleration*(time**2))
19
+ return x
20
+
21
+ # #3
22
+
23
+
24
+ def find_velocity_squared(initial_velocity, acceleration, current_position, initial_position=0):
25
+ v_x_squared = initial_velocity**2 + 2 * \
26
+ acceleration * (current_position - initial_position)
27
+ return v_x_squared
28
+
29
+ # example: [["Ball", 2, 5, forceof10righthere],["Block", 4, 6, forceof8righthere]]
30
+
31
+ # #4
32
+
33
+
34
+ def center_of_mass(list_of_object_lists):
35
+ top_part = 0
36
+ total_mass = 0
37
+ for obj in list_of_object_lists:
38
+ top_part += (obj[1]*obj[2])
39
+ total_mass += obj[1]
40
+
41
+ center_of_mass = float(top_part/total_mass)
42
+ return center_of_mass
43
+
44
+ # #5
45
+
46
+
47
+ def total_acceleration(list_of_object_lists):
48
+ top_part = 0
49
+ bottom_part = 0
50
+
51
+ for obj in list_of_object_lists:
52
+ top_part += obj[3]
53
+ bottom_part += obj[1]
54
+
55
+ total_acceleration = top_part/bottom_part
56
+ return total_acceleration
57
+
58
+ # #6
59
+
60
+
61
+ def newtons_law_of_universal_gravitation(mass1, mass2, radius):
62
+ attractive_force = geom.gravity_m3 * ((mass1 * mass2)/(radius**2))
63
+ return attractive_force
64
+
65
+ # #10
66
+
67
+
68
+ def kinetic_energy(mass, velocity):
69
+ KE = (1/2) * mass * (velocity**2)
70
+ return KE
71
+
72
+ # #11
73
+
74
+
75
+ def work(force, distance, angle):
76
+
77
+ if isinstance(angle, float) or isinstance(angle, int):
78
+ angle = np.radians(angle)
79
+
80
+ work = (force * distance) * np.cos(angle)
81
+ return work
82
+
83
+ # #12
84
+
85
+
86
+ def delta_ke(*work):
87
+ return sum(work)
88
+
89
+ # #16
90
+
91
+
92
+ def momentum(mass, velocity):
93
+ momentum = mass * velocity
94
+
95
+ return momentum
96
+
97
+ # #9
98
+
99
+
100
+ def centripetal_acceleration(velocity, radius):
101
+ centripetal_acceleration = (velocity**2)/radius
102
+ return centripetal_acceleration
103
+
104
+
105
+ def density(mass, volume):
106
+ density = mass/volume
107
+ return density
108
+
109
+
110
+ def speed_booster(scalar):
111
+ if scalar < 1000:
112
+ scalar += 1
113
+ return scalar