UTSAVS26 / PySnippets

Collection of reusable Python code snippets for all.
https://sites.google.com/view/pysnippets/
MIT License
26 stars 63 forks source link

[Feature Request]: Polynomial Addition Functionality #236

Open glodh21 opened 4 hours ago

glodh21 commented 4 hours ago

Is there an existing issue for this?

Feature Description

I would like to propose the addition of a polynomial addition feature in math. This feature would allow users to easily create polynomials and perform addition operations on them, enhancing the functionality and usability of the package.

Proposed Implementation:

Polynomial Class: A class that represents a polynomial and contains methods to add terms and display the polynomial. Addition Function: A function that takes multiple polynomials, merges like terms, and returns the resulting polynomial. Example Usage:

from polynomial_addition import Polynomial, add_polynomials

poly1 = Polynomial() poly1.add_term(3, 2) # 3x^2 poly1.add_term(5, 1) # 5x

poly2 = Polynomial() poly2.add_term(2, 2) # 2x^2 poly2.add_term(-5, 1) # -5x

added_poly = add_polynomials([poly1, poly2]) print("Added Polynomial:", added_poly.display()) #5x^2

I have already tried the code, and it is producing the expected results as shown in the example usage.Please assign this issue to me.

Record

Full Name

Gargi Lodh

Participant Role

GSSOC

github-actions[bot] commented 4 hours ago

🙌 Thank you for bringing this issue to our attention! We appreciate your input and will investigate it as soon as possible.

Feel free to join our community on Discord to discuss more!