Skip to main content

formula-math

I made this cause I always struggled with keeping up with formulas and remembering each one.

This is a beginner-friendly Python library for math, finance, geometry, trigonometry, statistics, physics, and original helpers. No need to memorize formulas — just call the function with your values and get results instantly.

Installation

pip install formula-math

Usage

import formula_math as fm

Math

fm.add(2,3,4,5) # Multi-number addition fm.sub(20,5,3) # Multi-number subtraction fm.multiply(2,3,5) # Multi-number multiplication fm.divide(100,2,5) # Multi-number division fm.remainder(10,3) # Remainder fm.sqrt(25) fm.per(20,30,50) # Percentages of numbers fm.solve_expression("2 + 3 * 4") fm.smart_calc(10,'+',5,'*',2)

Finance

fm.si(1000,5,2) fm.ci(1000,5,2) fm.time_to_double(1000,6) fm.emi(100000,10,12)

Geometry

fm.sq_perimeter(5) fm.sq_area(5) fm.rect_area(4,6) fm.rect_perimeter(4,6) fm.cube_volume(3) fm.cube_surface_area(3) fm.sphere_volume(4) fm.sphere_surface_area(4) fm.cone_volume(3,5) fm.cone_surface_area(3,5) fm.heron(3,4,5) # Heron's formula fm.pyramid_volume(4,5,6) fm.torus_volume(5,2) fm.polygon_area_sides(6,3)

Algebra

fm.solve_quadratic(1,-3,2) fm.linear_solve_2x2(1,2,5,3,4,11) fm.arithmetic_mean(1,2,3) fm.geometric_mean(2,4,8)

Trigonometry

fm.sin_deg(30) fm.cos_deg(60) fm.tan_deg(45) fm.cosec_deg(30) fm.sec_deg(60) fm.cot_deg(45)

Statistics & Probability

fm.mean(1,2,3) fm.median(1,2,3,4) fm.mode(1,2,2,3) fm.stdev(1,2,3,4) fm.permutations(5,2) fm.combinations(5,2) fm.is_even(4) fm.is_odd(3) fm.is_prime(7) fm.factor_pairs(12) fm.prime_factors(36)

Original Helpers

fm.vector_projection((1,2),(3,4)) fm.distance_2d(0,0,3,4) fm.distance_3d(0,0,0,1,2,2) fm.math_trick(5) fm.random_choice(1,2,3,4) fm.shuffle_list([1,2,3,4]) fm.magic_formula(2,3,4)

Physics

fm.force(10,5) fm.weight(10) fm.work(10,5) fm.kinetic_energy(10,5) fm.potential_energy(10,5) fm.momentum(10,5) fm.pressure(10,2) fm.density(10,2) fm.velocity(10,2) fm.acceleration(10,2,4) fm.grav_force(1,2,3) fm.ohms_law(10,2) fm.electric_power(10,2) fm.coulombs_law(1,1,2)

Available Functions

Simple Interest fm.si(principal, rate, time)

  • principal: amount of money (P)
  • rate: annual interest rate in % (R)
  • time: time in years (T) Example: fm.si(1000, 5, 2) # Returns 100.0

Square Perimeter & Area fm.sq_perimeter(side) fm.sq_area(side) Example: fm.sq_area(5) # Returns 25

Cube Volume & Surface Area fm.cube_volume(side) fm.cube_surface_area(side) Example: fm.cube_volume(3) # Returns 27

Sphere Volume & Surface Area fm.sphere_volume(radius) fm.sphere_surface_area(radius) Example: fm.sphere_volume(4) # Returns 268.08 (approx)

Cone Volume & Surface Area fm.cone_volume(radius, height) fm.cone_surface_area(radius, slant_height) Example: fm.cone_volume(3, 5) # Returns 47.12 (approx)

Rectangle Area & Perimeter fm.rect_area(length, width) fm.rect_perimeter(length, width) Example: fm.rect_area(4, 6) # Returns 24

Heron's Triangle Area fm.heron(a, b, c) Example: fm.heron(3,4,5) # Returns 6.0

Percentages fm.per(n1, n2, n3, ...) Example: fm.per(20,30,50) # Returns [20.0, 30.0, 50.0]

Smart Math fm.solve_expression("2 + 3 * 4") fm.smart_calc(10,'+',5,'*',2)

Square Root fm.sqrt(x) Example: fm.sqrt(9) # Resturns 3.0

Cube Root fm.cbrt(x) Example: fm.cbrt(8) # Resturns 2.0

Notes

  • Multi-number arithmetic is supported in add, sub, multiply, divide.
  • All functions return numeric results (float or int as appropriate).
  • Designed to save time in homework, projects, or quick calculations.
  • Original helpers and physics functions make school & creative projects faster.

License

This project is licensed under the MIT License.

Metadata

Release files for formula-math 14.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for formula-math 14.0.1
File Size Uploaded Provenance Actions
formula_math-14.0.1.tar.gz 5.6 kB Without provenance Details for formula_math-14.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for formula-math 14.0.1
File Interpreter ABI Platform Actions
formula_math-14.0.1-py3-none-any.whl Python 3 none any Details for formula_math-14.0.1-py3-none-any.whl

Total release size: 11.9 kB

Release files / formula_math-14.0.1.tar.gz

Download URL formula_math-14.0.1.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
88edc2c6c137a9ff4606ddd9f04bf5c581fb673dac8a305747a980862f523a3f
BLAKE2b-256 checksum
How to use checksums
47a6329a5111b01600d6da248c2744be880288d0997ec6a99717fb8d550aa1d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release files / formula_math-14.0.1-py3-none-any.whl

Download URL formula_math-14.0.1-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c5c17849676000bb35779b854bae4d6652b8c793fe9175c213d55747ded0bf9
BLAKE2b-256 checksum
How to use checksums
19c7d5d048650eecb91be83bdf370bcf611ed528eb408f57040892e2d8f85a63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Security for formula-math 14.0.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page