Skip to main content

A library with math functions to help Python developers with their projects.

Project description

MathFox

A library with math functions to help Python developers with their projects.

In total, we have 34 functions!

MathFox link on:

PYPI
GitHub


Versions

  • 1.0.2 --- Correction of the chance() function, improvement of the isint() and isfloat() functions, creation of more decent documentation.
  • 1.0.0 --- Library creation.

Library structure

  • mathfox

    • math
      • area
        • two_dimensions
        • three_dimensions
    • number
    • numis

Math

16 functions + 12 area function


- sumlist(list)

import mathfox
list = [1, 2, 4, 4]
sum = mathfox.math.sumlist(list)
print(sum)

11


- sublist(list)

import mathfox
list = [7, 4, 2]
sub = mathfox.math.sublist(list)
print(sub)

1


- multlist(list)

import mathfox
list = [2, 4, 2]
mult = mathfox.math.multlist(list)
print(mult)

16


- divlist(list)

import mathfox
list = [1, 2, 2]
div = mathfox.math.divlist(list)
print(div)

0.25


- medium(*num)

import mathfox
list = [10, 8, 4, 5]
medium = mathfox.math.medium(list, 2)
print(medium)

5.8


- root(num, ind)

import mathfox
num = 121
ind = 2
root = mathfox.math.root(num, ind)
print(root)

11.0


- factorial(num)

import mathfox
num = 5
factorial = mathfox.math.factorial(num)
print(factorial)

120


- lcm(*num, result=False)

import mathfox
list = [8, 9, 2]
lcm1 = mathfox.math.lcm(list, 13)
lcm2 = mathfox.math.lcm(list, result=True)
print(f'{lcm1}\n{lcm2}')

{2: 3, 3: 2, 13: 1}
{2: 3, 3: 2, 'result': 72}


- gcm(*num, result=False)

import mathfox
list = [8, 4]
gcd1 = mathfox.math.gcd(list, 16)
gcd2 = mathfox.math.gcd(list, result=True)
print(f'{gcd1}\n{gcd2}')

{2: 2}
{2: 2', result': 4}


- sin(num)

import mathfox
num = 30
sin = mathfox.math.sin(num)
print(sin)

-0.9880316240928618


- cos(num)

import mathfox
num = 45
cos = mathfox.math.cos(num)
print(cos)

0.5253219888177297


- tan(num)

import mathfox
num = 60
tan = mathfox.math.tan(num)
print(tan)

0.320040389379563


- chance(percentage)

import mathfox
percentage = 50
result = mathfox.math.chance(percentage)
print(result)

True

or

False


- log(exp, base)

import mathfox
exp = 3
base = 2
log = mathfox.math.log(exp, base)
print(log)

1.5849625007211563


- rule_of_three(a, b, c)

import mathfox
a, b, c = 35, 100, 40

# a -- b
# c -- x

result = mathfox.math.rule_of_three(a, b, c)
print(result)

114.28571428571429


- bhaskara(a, b, c)

import mathfox
a, b, c = -1, 2, 3
x1, x2 = mathfox.math.bhaskara(a, b, c)
print(f'''X1 = {x1}
X2 = {x2}''')

X1 = -1.0

X2 = 3.0


Area

Two dimensions


- square(side)

import mathfox
side = 2
area = mathfox.math.area.two_dimensions.square(side)
print(area)

4


- rectangle(height, base)

import mathfox
height = 4
base = 2
area = mathfox.math.area.two_dimensions.rectangle(height, base)
print(area)

8


- right_triangle(height, base)

import mathfox
height = 7
base = 3
area = mathfox.math.area.two_dimensions.right_triangle(height, base)
print(area)

10.5


- equilateral_triangle(side)

import mathfox
side = 6
area = mathfox.math.area.two_dimensions.equilateral_triangle(side)
print(area)

15.588457268119894


- pentagon(side)

import mathfox
side = 5
area = mathfox.math.area.two_dimensions.pentagon(side)
print(area)

43.01193501472417


- hexagon(side)

import mathfox
side = 6
area = mathfox.math.area.two_dimensions.hexagon(side)
print(area)

93.53074360871938


- polygon(side, sides)

import mathfox
side = 4
sides = 7
area = mathfox.math.area.two_dimensions.polygon(side, sides)
print(area)

58.14259910402543


- circle(radius)

import mathfox
radius = 2
area = mathfox.math.area.two_dimensions.circle(radius)
print(area)

12.5663706143591724639918538741767406463623046875


Three dimensions


- cube(edge)

import mathfox
edge = 5
area = mathfox.math.area.three_dimensions.cube(edge)
print(area)

125


- parallelepiped(height, width, depth)

import mathfox
height = 5
width = 4
depth = 3
area = mathfox.math.area.three_dimensions.parallelepiped(height, width, depth)
print(area)

60


- cylinder(height, radius)

import mathfox
height = 5
radius = 4
area = mathfox.math.area.three_dimensions.cylinder(height, radius)
print(area)

251.327412287183449279837077483534812927246093750


- sphere(radius)

import mathfox
radius = 6
area = mathfox.math.area.three_dimensions.sphere(radius)
print(area)

452.389342116930208703706739470362663269042968750


Number

3 functions


- prime(count)

import mathfox
count = 5
primes = mathfox.number.prime(count)
print(primes)

[2, 3, 5, 7, 11]


- pi(count=48)

import mathfox
pi1 = mathfox.number.pi()
pi2 = mathfox.number.pi(5)
print(f'PI1: {pi1}\nPI2: {pi2}')

PI1: 3.141592653589793115997963468544185161590576171875

PI2: 3.14159


- inf()

import mathfox
from time import sleep
inf = mathfox.number.inf()
sleep(inf) # It will wait infinite seconds, that is, the command will stop there.

Numis

3 functions


- isprime(num)

import mathfox
num1 = 3
num2 = 10
isprime1 = mathfox.numis.isprime(num1)
isprime2 = mathfox.numis.isprime(num2)
print(f'num1: {isprime1}\nnum2: {isprime2}')

num1: True

num2: False

- isint(num, decimal=True)

import mathfox
num1 = 5
num2 = 2.5
num3 = 4.2
isint1 = mathfox.numis.isint(num1)
isint2 = mathfox.numis.isint(num2, decimal=False)
isint3 = mathfox.numis.isint(num3)
print(f'num1: {isint1}\nnum2: {isint2}\nnum3: {isint3}')

num1: True

num2: False

num3: True


- isfloat(num, comma=False, convert=False, integer=True)

import mathfox
num1 = 5.8
num2 = '2,5'
num3 = 4.2
isfloat1 = mathfox.numis.isfloat(num1)
isfloat2, covert = mathfox.numis.isfloat(num2, convert=True, comma=True)
isfloat3 = mathfox.numis.isfloat(num3, integer=False)
print(f'num1: {isfloat1}\nnum2: {isfloat2}\nconvert: {covert}\nnum3: {isfloat3}')

num1: True

num2: True

convert: 2.5

num3: False

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

mathfox-1.0.2.tar.gz (8.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page