https://github.com/endreot/polynomial
API for manipulating polynomials and performing polynomial algebraic and calculus operations
https://github.com/endreot/polynomial
api polynomial python unit-testing
Last synced: about 1 year ago
JSON representation
API for manipulating polynomials and performing polynomial algebraic and calculus operations
- Host: GitHub
- URL: https://github.com/endreot/polynomial
- Owner: EndreoT
- License: mit
- Created: 2018-07-30T18:59:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-04-20T02:58:09.000Z (about 7 years ago)
- Last Synced: 2025-02-13T21:39:40.231Z (over 1 year ago)
- Topics: api, polynomial, python, unit-testing
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Polynomial
### Description
A simple API for manipulating polynomials and performing polynomial algebraic and calculus operations.
### Motivation
Gives users an easy to use mathematical polynomial API. Great for checking homework answers involving polynomials.
### Result
Create a polynomial object first with the constructor accepting either of two arguments:
First, an array of either type int or float. The array's index becomes the polynomial term, and the value of that index is the term's coefficient. Example:
``` Python
>>> poly2 = Polynomial([4, 2, 0, 5, 0])
>>> str(poly2)
'5X^3 + 2X + 4'
```
Second, a list of tuples of length two, each representing a full polynomial term. The first tuple element corresponds to the term's coefficient and is either an int or float. The second tuple element corresponds to the term's power and is must also be either an int or float.
Examples:
``` Python
>>> poly = Polynomial([(2, 3), (5, -2), (.5, 1), (6, 3)])
>>> str(poly)
'8X^3 + 5X^-2 + 1/2X'
```
### Future Improvements
- [ ] Allow for multi-variable polynomials. Example: 3X^2 -7XY + Z^3 + XYZ