README.md (6679B)
1 > [!CAUTION] 2 > ## UNMAINTAINED REPOSITORY 3 > 4 > This project is no longer actively developed or maintained. It is kept public for historical purposes and reference. <br> 5 > ***Issues and Pull Requests will not be reviewed or merged.*** 6 --- 7 8 # Advanced Math Utilities (adpkg) 9 10 Welcome! π This package gives you a bunch of handy tools for math, finance, and geometry in Python. You donβt need to be a math expertβjust import and use! 11 12 It includes modules for: 13 - **Finance**: Calculate compound interest easily 14 - **Number Theory**: Check primes, factorials, permutations and combinations 15 - **Strings**: Reverse words or phrases 16 - **Matrices**: Add, multiply, transpose, and find determinants 17 - **Statistics**: Mean, median, mode 18 - **Geometry**: Triangle area with Heronβs formula 19 20 [](https://pypi.org/project/adpkg/) 21 [](https://pypi.org/project/adpkg/) 22 [](https://github.com/notamitgamer/adpkg/blob/main/LICENSE) 23 [](https://pepy.tech/project/adpkg) 24 [](https://github.com/notamitgamer/adpkg/commits/main) 25 [](https://github.com/notamitgamer/adpkg/graphs/contributors) 26 27 --- 28 29 ## π Table of Contents 30 - [π¦ Installation](#-installation) 31 - [π Quick Start](#-quick-start) 32 - [π° Finance Module](#-finance-module) 33 - [interest](#interestprime_amount-time_duration_str-n-rate) 34 - [π’ AdCustom Module](#-adcustom-module) 35 - [Number Theory](#number-theory) 36 - [check_prime](#check_primen) 37 - [factorial](#factorialn) 38 - [permutation](#permutationn-r) 39 - [combination](#combinationn-r) 40 - [Strings](#strings) 41 - [string_reverse](#string_reverses) 42 - [Matrices](#matrices) 43 - [matrix_addition](#matrix_additiona-b) 44 - [matrix_multiplication](#matrix_multiplicationa-b) 45 - [matrix_transpose](#matrix_transposea) 46 - [determinant_value](#determinant_valuea) 47 - [Statistics](#statistics) 48 - [mean](#meandata) 49 - [median](#mediandata) 50 - [mode](#modedata) 51 - [πΊ Triangle Module](#-triangle-module) 52 - [areaoftriangle](#areaoftrianglea-b-c-unit) 53 - [π§ͺ Running Tests](#-running-tests) 54 - [π οΈ Contributing](#-contributing) 55 - [πΊοΈ Roadmap](#-roadmap) 56 - [π License](#-license) 57 58 --- 59 60 ## π¦ Installation 61 62 Install from PyPI (make sure you have Python installed): 63 ```bash 64 pip install adpkg 65 ``` 66 67 Check if it worked: 68 ```bash 69 python -m pip show adpkg 70 ``` 71 72 --- 73 74 ## π Quick Start 75 76 Here are simple examples to get you started. More detailed examples are below. 77 78 ```python 79 from adpkg import finance, adcustom, triangle 80 81 # Calculate compound interest 82 print(finance.interest(1000, "1y", 12, 5)) 83 84 # Factorial 85 print(adcustom.factorial(5)) 86 87 # Reverse a string 88 print(adcustom.string_reverse("hello")) 89 90 # Area of a triangle 91 print(triangle.areaoftriangle(3, 4, 5)) 92 ``` 93 94 --- 95 96 ## π° Finance Module 97 98 ### `interest(prime_amount, time_duration_str, n, rate)` 99 - Calculates compound interest based on years/months. 100 - Duration formats: `"2y"`, `"6m"`, or `"1y6m"`. 101 102 ```python 103 from adpkg import finance 104 print(finance.interest(1000, "1y", 12, 5)) # 51.161 105 print(finance.interest(2000, "5y", 4, 7)) # 816.622 106 107 # Edge case: invalid input 108 print(finance.interest(1000, "abc", 12, 5)) # None 109 ``` 110 111 --- 112 113 ## π’ AdCustom Module 114 115 ### Number Theory 116 117 #### `check_prime(n)` β 1 if prime, 0 if not, None if invalid. 118 ```python 119 print(adcustom.check_prime(17)) # 1 120 print(adcustom.check_prime(10)) # 0 121 ``` 122 123 #### `factorial(n)` 124 ```python 125 print(adcustom.factorial(5)) # 120 126 print(adcustom.factorial(-2)) # None 127 ``` 128 129 #### `permutation(n, r)` 130 ```python 131 print(adcustom.permutation(5, 2)) # 20 132 ``` 133 134 #### `combination(n, r)` 135 ```python 136 print(adcustom.combination(5, 2)) # 10 137 ``` 138 139 ### Strings 140 141 #### `string_reverse(s)` 142 ```python 143 print(adcustom.string_reverse("hello")) # "olleh" 144 ``` 145 146 ### Matrices 147 148 #### `matrix_addition(a, b)` 149 ```python 150 print(adcustom.matrix_addition([[1,2],[3,4]], [[5,6],[7,8]])) 151 # [[6,8],[10,12]] 152 ``` 153 154 #### `matrix_multiplication(a, b)` 155 ```python 156 print(adcustom.matrix_multiplication([[1,2],[3,4]], [[5,6],[7,8]])) 157 # [[19,22],[43,50]] 158 ``` 159 160 #### `matrix_transpose(a)` 161 ```python 162 print(adcustom.matrix_transpose([[1,2,3],[4,5,6]])) 163 # [[1,4],[2,5],[3,6]] 164 ``` 165 166 #### `determinant_value(a)` 167 ```python 168 print(adcustom.determinant_value([[1,2],[3,4]])) # -2 169 ``` 170 171 ### Statistics 172 173 #### `mean(data)` 174 ```python 175 print(adcustom.mean([1,2,3,4,5])) # 3.0 176 ``` 177 178 #### `median(data)` 179 ```python 180 print(adcustom.median([1,3,2,5,4])) # 3 181 ``` 182 183 #### `mode(data)` 184 ```python 185 print(adcustom.mode([1,2,2,3,4,4,4,5])) # ([4], 3) 186 ``` 187 188 --- 189 190 ## πΊ Triangle Module 191 192 ### `areaoftriangle(a, b, c, unit='')` 193 - Uses Heronβs formula. 194 ```python 195 print(triangle.areaoftriangle(3, 4, 5)) # 6.0 196 print(triangle.areaoftriangle(3, 4, 5, "sq cm")) # "6.0 sq cm" 197 ``` 198 199 --- 200 201 ## π§ͺ Running Tests 202 203 We included some test files (`test1.py` β `test5.py`). 204 205 Run one test: 206 ```bash 207 python test1.py 208 ``` 209 210 Run all tests at once: 211 ```bash 212 python -m unittest discover -s . -p "test*.py" 213 ``` 214 215 --- 216 ## π οΈ Contributing 217 218 Want to help? Awesome! Hereβs how: 219 1. **Fork this repo** β Make your own copy on GitHub. 220 2. **Create a branch** β Work on your changes in a separate branch. 221 3. **Add your code and tests** β Make sure it works! 222 4. **Open a Pull Request** β Propose your changes. 223 224 --- 225 226 ## πΊοΈ Roadmap 227 - β Current: Finance, number theory, strings, matrices, stats, triangles 228 - π Next: Probability, calculus, polynomials, advanced linear algebra 229 - π Future: Machine learning helpers, symbolic algebra, optimization 230 231 --- 232 233 ## π License 234 235 This project is licensed under the MIT License - see the `LICENSE` file for details. 236 237 --- 238 239 ## π¬ Contact 240 241 [](https://github.com/notamitgamer) 242 [](mailto:amitdutta4255@gmail.com) 243 [](https://github.com/notamitgamer) 244 [](https://pypi.org/project/adpkg/) 245 [](https://linkedin.com/in/notamitgamer) 246 [](https://twitter.com/notamitgamer) 247 [](https://instagram.com/notamitgamer) 248 249 250