pydisks
Find the volume or surface area of a shape made by spinning a curve around an axis. Works with formulas (exact answers) or measured points (decimal answers).
Install
pip install pydisks
Formulas
from pydisks import disc, washer, shell, x, y
import sympy as sp
disc(sp.sqrt(4 - x**2), -2, 2) # sphere -> 32*pi/3
washer(x, x**2, 0, 1) # between y=x and y=x^2 -> 2*pi/15
shell(x**2, 0, 2) # about the y-axis -> 8*pi
If SymPy can't solve it, add numeric=True to get a decimal answer.
Measured points
from pydisks import Profile, disc, y
heights = [0, 2, 4, 6, 8, 10, 12, 14]
radii = [3.0, 4.2, 4.8, 4.5, 3.4, 2.4, 2.2, 2.8]
vase = Profile(y, heights, radii, kind="cubic")
disc(vase, 0, 14, axis="y") # -> 576.78
kind="linear" connects the points with straight lines. kind="cubic" draws a smooth curve through them.
Pictures and videos
from pydisks import plot_disc, animate_disc
plot_disc(sp.sqrt(4 - x**2), -2, 2) # picture
animate_disc(sp.sqrt(4 - x**2), -2, 2).save("sphere.mp4") # video (needs ffmpeg)
animate_disc(sp.sqrt(4 - x**2), -2, 2).save("sphere.gif", writer="pillow")
plot_washer and animate_washer do the same for washers.
| Sphere | Washer | Vase from measured points |
|---|---|---|
Axis
| Write | Means |
|---|---|
"x" |
x-axis |
"y" |
y-axis |
"x=2" |
the line x = 2 |
"y=-1" |
the line y = -1 |
Disc and washer: horizontal axis → write the curve in x, vertical axis → in y. Shell is the opposite. pydisks won't rearrange your equation for you; it tells you if it's in the wrong variable.
Errors
Common mistakes raise a clear error instead of a wrong answer: wrong variable, bad bounds, the axis cutting through the shape, or curves that cross. The checks catch most mistakes, not all.
License
MIT
Metadata
Release files for pydisks 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydisks-2.0.0.tar.gz | 23.5 kB | Without provenance | Details for pydisks-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydisks-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for pydisks-2.0.0-py3-none-any.whl |
Total release size: 45.8 kB
Release files / pydisks-2.0.0.tar.gz
| Download URL | pydisks-2.0.0.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6757d2c86d0999123f30fa2f3845e373537b967beecf6d6d3b6cacee44f48fa8
|
|
BLAKE2b-256 checksum How to use checksums |
9d3f49ca29eaba7c4b59487f3bee202b9e5271678774701d7d2786b753e7cf7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / pydisks-2.0.0-py3-none-any.whl
| Download URL | pydisks-2.0.0-py3-none-any.whl |
|---|---|
| Size | 22.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
711801f9a1efbd665f7e18fbf5703e7cb16daa189ad6993a9e3eb183c74f8207
|
|
BLAKE2b-256 checksum How to use checksums |
fef65f045d8b977384ba3df8855011521f3bc3a19cf3dacc3f5ac467e082f12c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for pydisks 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.