PyAlgebraLib


NamePyAlgebraLib JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummarySimple and native python program to perform algebra operations using the most efficient algorithms.
upload_time2024-06-22 09:51:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License Copyright (c) 2022 Rodrigo Martín Núñez Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords algebra math development library algorithms
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 😁 Welcome!!

# Contents

- [😁 Welcome!!](#-welcome)
- [Contents](#contents)
- [🧮 PyAlgebraLib](#-pyalgebralib)
- [🚀 Quick start](#-quick-start)
- [✨ Features](#-features)
- [📦 Installation and Usage](#-installation-and-usage)
- [📜 Supported operations:](#-supported-operations)


# 🧮 PyAlgebraLib

Simple Python program to perform algebra operations using efficient algorithms like Karatsuba's algorithm for multiplication or Extended Euclidean Algorithm for great common divisor (GCD).

This program is intended to be lighweight (no dependencies) and very efficient.

# 🚀 Quick start

```bash
pip install PyAlgebraLib
```

You can import the module:
```python
import PyAlgebraLib as ap
```

# ✨ Features

Can operate with numbers from base 2 to base 16. Without converting between bases in each operation.

Note: _**Each number has to be inputted and will be returned as a string, except the base.**_

# 📦 Installation and Usage

```bash
pip install PyAlgebraLib
```

You can import the module:
```python
import PyAlgebraLib as ap
```

Then, you can perform operations like:
```python
pa.karatsuba("364da","-13f", 16)      # Multiplication (karatsuba algorithm)
pa.extEuclid("-1460","44321521", 7)   # GCD (Extended)
```

The output is either a string or a tuple with the result(s), look into the specific function docstrings for more information.

Example:
```python
pa.extEuclid("-1460","44321521", 7)
# Output: ('1', '-20066304', '511')

pa.modularInversion("9a1aa8a02232", "a6a722a", 11)
# Output: '3293845'
```

# 📜 Supported operations:

    - Addition
    - Subtraction 
    - Multiplication (Normal "primary school method" + Karatsuba algorithm)
    - Division
    - GCD of 2 numbers (Extended Euclidean algorithm)
    - Modular Arithmetic:
        - Reduction
        - Addition
        - Subtraction
        - Multiplication
        - Inversion

<hr>

| Function Name          | Input                                                                                      | Output                                                            |
|------------------------|--------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| removeLeadingZeros     | a (str)                                                                                    | str: The modified string with all leading zeros removed           |
| greaterOrEqual         | x (str), y (str)                                                                           | bool: True if x is greater than or equal to y, False otherwise    |
| divide                 | x (str), y (str), r (int) = 10                                                             | str: The quotient of x divided by y, expressed in radix r         |
| elementaryAdd          | x (str), y (str), c (str), r (int) = 10                                                    | tuple: (result (str), carry (str))                                |
| elementarySub          | x (str), y (str), c (str), r (int) = 10                                                    | tuple: (result (str), carry (str))                                |
| elementaryMult         | x (str), y (str), z (str), c (str), r (int) = 10                                           | tuple: (result (str), carry (str))                                |
| add                    | x (str), y (str), r (int) = 10                                                             | str: Result of x + y in radix r                                   |
| subtract               | x (str), y (str), r (int) = 10                                                             | str: Result of x - y in radix r                                   |
| multiply               | x (str), y (str), r (int) = 10                                                             | str: Result of x * y in radix r                                   |
| karatsuba              | x (str), y (str), r (int) = 10                                                             | str: Result of x * y using Karatsuba algorithm in radix r         |
| extEuclid              | x (str), y (str), r (int) = 10                                                             | tuple: (gcd (str), a (str), b (str))                              |
| modularReduction       | n (str), m (str), r (int) = 10                                                             | str: Result of n mod m in radix r                                 |
| modularAddition        | x (str), y (str), m (str), r (int) = 10                                                    | str: Result of (x + y) mod m in radix r                           |
| modularSubtraction     | x (str), y (str), m (str), r (int) = 10                                                    | str: Result of (x - y) mod m in radix r                           |
| modularMultiplication  | x (str), y (str), m (str), r (int) = 10                                                    | str: Result of (x * y) mod m in radix r                           |
| modularInversion       | a (str), m (str), r (int) = 10                                                             | str: Inverse of a mod m in radix r, or prints "Inverse does not exist" |

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "PyAlgebraLib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Rodrigo Martin N\u00fa\u00f1ez <rodrigomartinnunez@gmail.com>",
    "keywords": "algebra, math, development, library, algorithms",
    "author": null,
    "author_email": "Rodrigo Martin N\u00fa\u00f1ez <rodrigomartinnunez@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d9/2d/db437ef4db589a6376947e72da1f5a8285a8414f78eb4d50e82521666046/pyalgebralib-1.0.0.tar.gz",
    "platform": null,
    "description": "# \ud83d\ude01 Welcome!!\n\n# Contents\n\n- [\ud83d\ude01 Welcome!!](#-welcome)\n- [Contents](#contents)\n- [\ud83e\uddee PyAlgebraLib](#-pyalgebralib)\n- [\ud83d\ude80 Quick start](#-quick-start)\n- [\u2728 Features](#-features)\n- [\ud83d\udce6 Installation and Usage](#-installation-and-usage)\n- [\ud83d\udcdc Supported operations:](#-supported-operations)\n\n\n# \ud83e\uddee PyAlgebraLib\n\nSimple Python program to perform algebra operations using efficient algorithms like Karatsuba's algorithm for multiplication or Extended Euclidean Algorithm for great common divisor (GCD).\n\nThis program is intended to be lighweight (no dependencies) and very efficient.\n\n# \ud83d\ude80 Quick start\n\n```bash\npip install PyAlgebraLib\n```\n\nYou can import the module:\n```python\nimport PyAlgebraLib as ap\n```\n\n# \u2728 Features\n\nCan operate with numbers from base 2 to base 16. Without converting between bases in each operation.\n\nNote: _**Each number has to be inputted and will be returned as a string, except the base.**_\n\n# \ud83d\udce6 Installation and Usage\n\n```bash\npip install PyAlgebraLib\n```\n\nYou can import the module:\n```python\nimport PyAlgebraLib as ap\n```\n\nThen, you can perform operations like:\n```python\npa.karatsuba(\"364da\",\"-13f\", 16)      # Multiplication (karatsuba algorithm)\npa.extEuclid(\"-1460\",\"44321521\", 7)   # GCD (Extended)\n```\n\nThe output is either a string or a tuple with the result(s), look into the specific function docstrings for more information.\n\nExample:\n```python\npa.extEuclid(\"-1460\",\"44321521\", 7)\n# Output: ('1', '-20066304', '511')\n\npa.modularInversion(\"9a1aa8a02232\", \"a6a722a\", 11)\n# Output: '3293845'\n```\n\n# \ud83d\udcdc Supported operations:\n\n    - Addition\n    - Subtraction \n    - Multiplication (Normal \"primary school method\" + Karatsuba algorithm)\n    - Division\n    - GCD of 2 numbers (Extended Euclidean algorithm)\n    - Modular Arithmetic:\n        - Reduction\n        - Addition\n        - Subtraction\n        - Multiplication\n        - Inversion\n\n<hr>\n\n| Function Name          | Input                                                                                      | Output                                                            |\n|------------------------|--------------------------------------------------------------------------------------------|-------------------------------------------------------------------|\n| removeLeadingZeros     | a (str)                                                                                    | str: The modified string with all leading zeros removed           |\n| greaterOrEqual         | x (str), y (str)                                                                           | bool: True if x is greater than or equal to y, False otherwise    |\n| divide                 | x (str), y (str), r (int) = 10                                                             | str: The quotient of x divided by y, expressed in radix r         |\n| elementaryAdd          | x (str), y (str), c (str), r (int) = 10                                                    | tuple: (result (str), carry (str))                                |\n| elementarySub          | x (str), y (str), c (str), r (int) = 10                                                    | tuple: (result (str), carry (str))                                |\n| elementaryMult         | x (str), y (str), z (str), c (str), r (int) = 10                                           | tuple: (result (str), carry (str))                                |\n| add                    | x (str), y (str), r (int) = 10                                                             | str: Result of x + y in radix r                                   |\n| subtract               | x (str), y (str), r (int) = 10                                                             | str: Result of x - y in radix r                                   |\n| multiply               | x (str), y (str), r (int) = 10                                                             | str: Result of x * y in radix r                                   |\n| karatsuba              | x (str), y (str), r (int) = 10                                                             | str: Result of x * y using Karatsuba algorithm in radix r         |\n| extEuclid              | x (str), y (str), r (int) = 10                                                             | tuple: (gcd (str), a (str), b (str))                              |\n| modularReduction       | n (str), m (str), r (int) = 10                                                             | str: Result of n mod m in radix r                                 |\n| modularAddition        | x (str), y (str), m (str), r (int) = 10                                                    | str: Result of (x + y) mod m in radix r                           |\n| modularSubtraction     | x (str), y (str), m (str), r (int) = 10                                                    | str: Result of (x - y) mod m in radix r                           |\n| modularMultiplication  | x (str), y (str), m (str), r (int) = 10                                                    | str: Result of (x * y) mod m in radix r                           |\n| modularInversion       | a (str), m (str), r (int) = 10                                                             | str: Inverse of a mod m in radix r, or prints \"Inverse does not exist\" |\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 Rodrigo Mart\u00edn N\u00fa\u00f1ez  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Simple and native python program to perform algebra operations using the most efficient algorithms.",
    "version": "1.0.0",
    "project_urls": {
        "Bug Reports": "https://github.com/P-ict0/PyAlgebraLib/issues",
        "Homepage": "https://github.com/P-ict0/PyAlgebraLib.git"
    },
    "split_keywords": [
        "algebra",
        " math",
        " development",
        " library",
        " algorithms"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "499eb5db0e6f6d0c3c049a4a352f2ab00f245a4e4c1c7fce9b4be7d41c2a0f56",
                "md5": "5b9f756b8f39c8a711ce5591840d304e",
                "sha256": "8d726143c5a4d69e66696cbfd8b9adaf2136f126980aa7abb2f37749f06f6209"
            },
            "downloads": -1,
            "filename": "PyAlgebraLib-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5b9f756b8f39c8a711ce5591840d304e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 8330,
            "upload_time": "2024-06-22T09:51:49",
            "upload_time_iso_8601": "2024-06-22T09:51:49.053806Z",
            "url": "https://files.pythonhosted.org/packages/49/9e/b5db0e6f6d0c3c049a4a352f2ab00f245a4e4c1c7fce9b4be7d41c2a0f56/PyAlgebraLib-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d92ddb437ef4db589a6376947e72da1f5a8285a8414f78eb4d50e82521666046",
                "md5": "5f2551c1c8ab2327b78951aba05e9330",
                "sha256": "304295251d00cd5573abeabe81fbf39725005407f036e18418c922b78f0f3e05"
            },
            "downloads": -1,
            "filename": "pyalgebralib-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5f2551c1c8ab2327b78951aba05e9330",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 7264,
            "upload_time": "2024-06-22T09:51:49",
            "upload_time_iso_8601": "2024-06-22T09:51:49.944033Z",
            "url": "https://files.pythonhosted.org/packages/d9/2d/db437ef4db589a6376947e72da1f5a8285a8414f78eb4d50e82521666046/pyalgebralib-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-22 09:51:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "P-ict0",
    "github_project": "PyAlgebraLib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyalgebralib"
}
        
Elapsed time: 0.33508s