Skip to main content

Math formulas as Python functions

Project description

formula-math

I made this cause I always struggled with keeping up with formulas and remebering 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) fm.sub(10,4) fm.multiply(2,3,5) fm.divide(20,5) fm.remainder(10,3) fm.sqrt(25) fm.solve_expression("2 + 3 * 4") fm.smart_calc(10,'+',5,'*',2)

Finance

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

Geometry

fm.sq_perimeter(5) fm.rect_area(4,6) fm.cube_volume(3) fm.sphere_volume(4) fm.cone_volume(3,5) 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)

Trigonometry

fm.sin_deg(30) fm.cos_deg(60) fm.heron_area(3,4,5)

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)

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)

Physics

fm.force(10,5) fm.weight(10) fm.work(10,5,60) 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 fm.sq_perimeter(side)

  • side: length of square side Example: fm.sq_perimeter(5) # Returns 20

Cube Volume fm.cube_volume(side)

  • side: length of cube side Example: fm.cube_volume(3) # Returns 27

Sphere Volume fm.sphere_volume(radius)

  • radius: radius of sphere Example: fm.sphere_volume(4) # Returns 268.08 (approx)

Cone Volume fm.cone_volume(radius, height)

  • radius: base radius
  • height: height of cone Example: fm.cone_volume(3, 5) # Returns 47.12 (approx)

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

Circle Circumference fm.circle_circumference(radius) Example: fm.circle_circumference(7) # Returns 43.96 (approx)

Notes

  • All functions return numeric results (float or int as appropriate).
  • Designed to save time in homework, projects, or quick calculations.

License

This project is licensed under the MIT License.

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

formula_math-13.5.12.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

formula_math-13.5.12-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file formula_math-13.5.12.tar.gz.

File metadata

  • Download URL: formula_math-13.5.12.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for formula_math-13.5.12.tar.gz
Algorithm Hash digest
SHA256 42c0633918f57aaa4b84f40d78a24b789ec67bc3464187176145442899ea1b20
MD5 36f8582363014f6b196f6aab876c54da
BLAKE2b-256 90bb00bca5e0772c0785942a33f55d1d29419e32796930f0e335c990c7d0e54c

See more details on using hashes here.

File details

Details for the file formula_math-13.5.12-py3-none-any.whl.

File metadata

  • Download URL: formula_math-13.5.12-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for formula_math-13.5.12-py3-none-any.whl
Algorithm Hash digest
SHA256 e9a7dac11d9c800070c7da4b984413d130bcec825f7ba647cf57f64e634d4ee8
MD5 978501ff11a347c47e3557bd5b49a9a3
BLAKE2b-256 60e8e21819f70a89b4285de7f273520d1c8f728fadad403902c70842801cddb8

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