8000 GitHub - rkpust/my_math: my_math is a simple python package for math.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rkpust/my_math

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

my_math

my_math is a simple Python package designed to provide various mathematical operations and utilities. It offers basic arithmetic, comparison, and bitwise operations, making it easy to perform essential calculations.

Testing CI - Test
Package v0.1
Meta Powered by rkpust

Features

  • Basic arithmetic operations: addition, subtraction, multiplication, division etc.
  • Bitwise Operations: AND, OR, NOT, XOR etc.
  • Comparison Operations: equal, less than, greater than etc.
  • More utilities to be added soon!

Installations

To install the my_math package, you must be installed Python. Python Version >= 3.0 (Recommended)

Using Python, Git

You can install the my_math package directly from GitHub using pip (git must be installed):

pip install git+https://github.com/rkpust/my_math

Using Python

First, you need to download this repository as a .zip, then extract it. Now open CLI and navigate to the setup.py file path. Then run two commands one after the other.

You can install the my_math package by following the command:

i.

python setup.py sdist bdist_wheel

After executing the above command, you will see three folders build, dist, my_math.egg-info. You will also see my_math-0.1.tar.gz, my_math-0.1-py3-none-any.whl in the dist folder.

ii.

pip install dist\my_math-0.1.tar.gz

or

pip install dist\my_math-0.1-py3-none-any.whl

Checking Installation

You can check whether the my_math package is installed correctly by using the following command.

 pip show my_math

or

pip list | findstr my_math

You will get output like below:

Name: my_math
Version: 0.1
Summary: A simple python package for math
Home-page: https://github.com/rkpust/my_math
Author: Md. Rezaul Karim
Author-email: rezaul.cse.pust17@gmail.com
License: MIT
Location: C:\Users\hp\AppData\Local\Programs\Python\Python311\Lib\site-packages
Requires:
Required-by:

my_math                0.1

Congratulations! You have successfully installed the my_math package.

Usage With Examples

Here, some of usage are given below:

Constant

from my_math import mm

#pi
print(mm.PI) # 3.141592653589793

#e
print(mm.E) # 2.718281828459045

#tau
print(mm.TAU) # 6.283185307179586

Arithmetic

from my_math import mm


8022
#addition
print(mm.add(1, 5, -4, 8)) # 10

#subtraction
print(mm.sub(5, -2)) # 7

#multiplication
print(mm.mul(1, 5, 0, 8)) # 0

#division
print(mm.div(5, 2)) # 2.5

#modulus
print(mm.mod(20, 3)) # 2

#floor division
print(mm.flr_div(20, 3)) # 6

#exponentiation
print(mm.exp(2, 5)) # 32

Comparison

from my_math import mm

#equal
print(mm.eq(0, 0)) # True

#not equal
print(mm.ne(2, 5)) # True

#greater than
print(mm.gt(-1, 0)) # False

#less than
print(mm.lt(-3, -3)) # False

#greater than or equal to
print(mm.ge(12, 5)) # True

#less than or equal to
print(mm.le(12, 5)) # False

Bitwise

from my_math import mm

#and
print(mm.band(6, 3)) # 2

#or
print(mm.bor(1, 1)) # 1

#xor
print(mm.bxor(12, 5)) # 9

#not
print(mm.bnot(3)) # -4

#zero fill left shift
print(mm.bls(6, 3)) # 48

#signed right shift
print(mm.brs(6, 3)) # 0

Contributing

Contributions are welcome! If you'd like to improve or add new features to the my_math package, please fork the repository and submit a pull request. Be sure to include tests for new features, and ensure the code adheres to the project’s style.

License

This project is licensed under the MIT License – see the LICENSE file for details.

Author

Md. Rezaul Karim
GitHub: @rkpust
Portfolio: https://sites.google.com/view/rkpust

About

my_math is a simple python package for math.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0